A swing/awt component that looks like a LED

Discussion in 'Java' started by =?iso-8859-1?q?J=FCrgen_Gerstacker?=, Dec 15, 2006.

  1. 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
    =?iso-8859-1?q?J=FCrgen_Gerstacker?=, Dec 15, 2006
    #1
    1. Advertising

  2. Jürgen Gerstacker schrieb:
    > 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).

    --
    Thomas
    Thomas Fritsch, Dec 15, 2006
    #2
    1. Advertising

  3. Thomas Fritsch wrote:
    > Jürgen Gerstacker schrieb:
    > > 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).
    >
    > --
    > Thomas


    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
    =?iso-8859-1?q?J=FCrgen_Gerstacker?=, Dec 17, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Mark Bram
    Replies:
    2
    Views:
    5,932
    Robert Mark Bram
    Dec 11, 2003
  2. Don Sykes
    Replies:
    3
    Views:
    655
    Christophe Vanfleteren
    Feb 25, 2004
  3. mkrause
    Replies:
    0
    Views:
    652
    mkrause
    May 6, 2005
  4. AAaron123
    Replies:
    11
    Views:
    1,105
    AAaron123
    Nov 27, 2008
  5. justncase80

    Web Control that looks like a Component in the designer

    justncase80, Oct 11, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    115
    justncase80
    Oct 11, 2005
Loading...

Share This Page