T
tss
Hi,
It's my first application with JFrame. I have a problem with changing
colors in my application.
Frame name is: JFrame1.
It contains a JPanel class named jPanel1.
The panel contains a JButton.
Event handler for the button has this code, which does nothing to the
colors. It only draws in black no matter what the color is:
jPanel1.getGraphics().setColor(java.awt.Color.blue);
jPanel1.getGraphics().drawRect(0,0,100,100);
I tried to change the foreground:
jPanel1.setForeground(java.awt.Color.blue);
It drew also in black !!!!!!
can anyone explain this to me?????
Thanks alot
It's my first application with JFrame. I have a problem with changing
colors in my application.
Frame name is: JFrame1.
It contains a JPanel class named jPanel1.
The panel contains a JButton.
Event handler for the button has this code, which does nothing to the
colors. It only draws in black no matter what the color is:
jPanel1.getGraphics().setColor(java.awt.Color.blue);
jPanel1.getGraphics().drawRect(0,0,100,100);
I tried to change the foreground:
jPanel1.setForeground(java.awt.Color.blue);
It drew also in black !!!!!!
can anyone explain this to me?????
Thanks alot