L8B-GUI-Hw6

L8B-GUI-Hw6 - CSE205 Concepts of Computer Science and Data...

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

View Full Document Right Arrow Icon
CSE205 Concepts of Computer Science and Data Structures
Background image of page 1

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

View Full DocumentRight Arrow Icon
Outline _ GUI - Components Used in Assignment 6 Color Class JButton Class JLabel Class JTextField Class JTextArea Class JList Class JTabbedPane Class JScrollPane Class JComboBox Class JRadioButton Class JSplitPanel Class
Background image of page 2
Color Class - An object of the Color class represents a color. - It can be defined by RGB (red, green, and blue) value. There are also predefined 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 3

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 4
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: JLabel label1 = new JLabel(“Example”); where “Example” is the string shown in this case. To change the text string, we can use setText method as:
Background image of page 5

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

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

Page1 / 14

L8B-GUI-Hw6 - CSE205 Concepts of Computer Science and Data...

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

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