hw6Fall10

hw6Fall10 - Color class (defined in java.awt package) -An...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Color class (defined in java.awt package) -An object of the Color class represents a color. -It can be defined by RGB (red, green, and blue) value. There are also pre-defined colors such as red defined in the Color class. Each of RGB value varies between 0 and 255. ( 8bits) Object Color.black Color.blue Color.cyan Color.orange Color.white Color.yellow RGB Value 0, 0, 0 0, 0, 255 0, 255, 255 255, 200, 0 255, 255, 255 255, 255, 0 There are foreground color and background color. Foreground color – color used to draw shapes or strings. If comp is a component object, we can set foreground color as follows: comp.setForeground(Color.red); To set background color: comp.setBackground(Color.blue);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
JButton class (defined in javax.swing package) -An object of the JButton class is a button that a user can push. It can be instantiated as: JButton button1 = new JButton(“Button 1”); where “Button 1” is the string shown in the button in this case.
Background image of page 2
JLabel class (defined in javax.swing package) -An object of the JLabel class is a component that shows a string. It can be instantiated as:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

hw6Fall10 - Color class (defined in java.awt package) -An...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online