A swing/awt component that looks like a LED

  • Thread starter =?iso-8859-1?q?J=FCrgen_Gerstacker?=
  • Start date
?

=?iso-8859-1?q?J=FCrgen_Gerstacker?=

Hi,
I want to create LED (light emitting diodes) inside a panel, or
rectangulars that can be given any color at any time. What is the best
solution? java.awt.Canvas?

Juergen
 
T

Thomas Fritsch

Jürgen Gerstacker said:
I want to create LED (light emitting diodes) inside a panel, or
rectangulars that can be given any color at any time. What is the best
solution? java.awt.Canvas?
If using AWT (without Swing):
extend Canvas, override method paint(Graphics).
If using Swing:
extend JComponent, override method paintComponent(Graphics).
 
?

=?iso-8859-1?q?J=FCrgen_Gerstacker?=

Thomas said:
If using AWT (without Swing):
extend Canvas, override method paint(Graphics).
If using Swing:
extend JComponent, override method paintComponent(Graphics).

A few minutes after I had posted I found a solution, that's the reason
I deleted the original post.

pan_swi=new JPanel();
pan_swi.setPreferredSize(dim1);
pan_swi.setBackground(Color.black);
....
pan_swi.setBackground(Color.red);

Thank you for your solutions, I will try them

Juergen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top