1 / 1100%
the components of GUI are the button a label to display the counter a panel to
organize the components and the main frame
if you write your prog, and nothing happens, you need to add an action listener
layout managers is an object that determines the way components are arranged in
a container
every contaner has a default layout manager, but we can explicitly set one
you create multiple jpanels, then add components with different layouts, THEN
you add it to the jApplet
JButton b1 = new JButton ("BUTTON 1");
JButton b2 = new JButton ("BUTTON 2");
add (b1);
add (b2);
public BorderPanel()
{
setLayout(new BorderLayout());
setBackground (Color green);
JButton b1 = new JButton ("BUTTON 1");
JButton b2 = new JButton ("BUTTON 2");
add (b1, BorderLayout.CENTER);
add (b2, BorderLayout.SOUTH);
}
Look through Code examples for layout examples
Powered by TCPDF (www.tcpdf.org)
what is jlabel is used for?
getting user input
Students also viewed