java - How to add a color indicator (LED-lookalike) to a JFrame? -
i want add color-indicator jframe. should turned red when click button , if not click button should green. how should implement this?
jlabel lblled = new jlabel("•"); lblled.setforeground(color.green);
add changelistener jbutton , in statechanged() method add this:
if (buttonispressed) { lblled.setforeground(color.red); } else { lblled.setforeground(color.green); }