Java swings Continued
Java swings Continued
Java JRadioButton
• The JRadioButton class is used to create a radio button.
Constructor Description
Methods Description
• The list of text items can be set up so that the user can choose
Constructor Description
Methods Description
Void It is used to add a listener to the list, to
addListSelectionListener(ListSelectionLi be notified each time a change to the
stener listener) selection occurs.
• The object of JMenuItem class adds a simple labeled menu item. The
items used in a menu must belong to the JMenuItem or any of its
subclass.
Constructors
new=new MenuItem(“New”,VK_A);
Methods
1. add(MenuItem menuitemObj): file.add(new)
4. String getLabel()
Java JScrollPane
Constructor Purpose
JScrollPane(int, int)
JScrollPane(Component,
int, int)
Useful Methods
void setColumnHeaderView(Compone It sets the column header for the scroll pane.
nt)
void setRowHeaderView(Component) It sets the row header for the scroll pane.
void setCorner(String, Component) It sets or gets the specified corner. The int parameter
specifies which corner and must be one of the following
Component getCorner(String)
constants defined in ScrollPaneConstants:
UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER,
LOWER_LEFT_CORNER,
LOWER_RIGHT_CORNER,
LOWER_LEADING_CORNER,
LOWER_TRAILING_CORNER,
UPPER_LEADING_CORNER,
UPPER_TRAILING_CORNER.
void setViewportView(Component) Set the scroll pane's client.
Java JTabbedPane
Constructor Description
tabLayoutPolicy) policy.
Java JComboBox
Constructor Description
data model.
list.
JComboBox is editable.
a)
Constructors
Constructor Description
2) FlowLayout
FlowLayout
• The FlowLayout arranges the components in a directional flow,
either from left to right or from right to left.
• Normally all components are set to one row, according to the
order of different components.
• If all components can not be fit into one row, it will start a new
row and fit the rest in.
BorderLayout
• A BorderLayout lays out a container, arranging its components
to fit into five regions: NORTH, SOUTH, EAST, WEST and
CENTER.
• For each region, it may contain no more than one component.
• When adding different components, you need to specify the
orientation of it to be the one of the five regions.