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); } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -