Hi Chris,
Try this, it will get you started anyhow, from some code I have here....Ike
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
public class JTASToggleButton extends JToggleButton {
public boolean pressed;
/** Creates a new instance of JTASToggleButton */
public JTASToggleButton() {
super();
addMouseListener(new MouseAdapter(){
//the following functions not needed since this is an adapter
class:
public void mousePressed(MouseEvent Me){
pressed=!pressed;
if(pressed)
setForeground(Color.MAGENTA);
else
setForeground(Color.BLACK);
}
});
}
}
> I would like to change the color of a selected JToggleButton (in a
> ButtonGroup) to red from grey. About the only solution I can find online
[quoted text clipped - 12 lines]
> Thanks,
> Chris
Chris - 01 Mar 2004 03:24 GMT
Thanks Ike. I tried adding a MouseListener to my JToggleButton class but
found that:
1. setForeground doesn't do anything, but setBackground does
2. setBackground changes the color of the non-selected buttons, not the
selected button
So I'm still looking for something to change just the color of the
selected button and nothing else.
Thanks,
Chris