Professional Documents
Culture Documents
Chapter 2 SWING
Chapter 2 SWING
• JLabel
• JButton
• JCheckbox
• JCheckboxGroup These classes are subclasses of
• JChoice JComponent Class
• JList
• JScrollbar
• JTextField
• JTextArea
JLabel.LEFT
JLabel.RIGHT
JLabel.CENTER
2. String getText( )
4. int getHorizontalAlignment( )
5. Icon getIcon()
2. String getText()
1. JButton (Icon i)
2. JButton (String s)
3. JCheckbox(String str)
3. JRadioButton(String s)
5. JRadioButton(String s, Icon i)
2. JComboBox(Vector v)
3. JComboBox(Object obj[])
Constructor J
1. JTextField( )
J J
2. JTextField(int cols)
4. JTextField(String s))
1. JTextArea()
2. JTextArea(String text)
3. JTextArea(int rows , int cols)
4. JTextArea ( String txt, int rows,int cols)
2. JScrollPane(Component comp)
Where vsb
1. ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
2. ScrollPaneConstants. VERTICAL_SCROLLBAR_AS_NEEDED
Where hsb
1. ScrollPaneConstants. HORIZONTAL_SCROLLBAR_ALWAYS
2. ScrollPaneConstants.
HORIZONTAL_SCROLLBAR_AS_NEEDED
4. JTree( Vector v)
DefaultMutableTreeNode(Object obj)
3. JPasswordField(String text)