Constructor Summary | |
---|---|
JFrame()
Constructs a new frame that is initially invisible. |
|
JFrame(String title)
Creates a new, initially invisible Frame with the
specified title. |
Method Summary | |
---|---|
Container |
getContentPane()
Returns the contentPane (panel) object for this frame. (Use this when you need to operate on the JFrame as if it were a JPanel .)
|
void |
setDefaultCloseOperation(int operation)
Sets the operation that will happen by default when the user initiates a "close" on this frame. |
void |
setLayout(LayoutManager manager)
Sets the LayoutManager . |
void |
setTitle(String title)
Sets the title for this frame to the specified string. |
Component |
add(Component comp)
Appends the specified component to the end of this container. |
void |
setLocation(int x,
int y)
Moves this component to a new location. |
void |
setSize(int width,
int height)
Resizes this component so that it has width width
and height height . |
void |
setVisible(boolean b)
Shows or hides this component depending on the value of parameter b . |
void |
setBackground(Color bg)
Sets the background color of this component. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Invoked when an action occurs. |
Constructor Summary | |
---|---|
FlowLayout()
Constructs a new FlowLayout with a centered alignment and a
default 5-unit horizontal and vertical gap. |
Constructor Summary | |
---|---|
GridLayout()
Creates a grid layout with a default of one column per component, in a single row. |
|
GridLayout(int rows,
int cols)
Creates a grid layout with the specified number of rows and columns. |
Constructor Summary | |
---|---|
ImageIcon(String filename)
Creates an ImageIcon from the specified file. |
Constructor Summary | |
---|---|
JPanel()
Creates a new JPanel with a double buffer
and a flow layout. |
Method Summary | |
---|---|
void |
setLayout(LayoutManager mgr)
Sets the layout manager for this container. |
Component |
add(Component comp)
Appends the specified component to the end of this container. |
void |
setBackground(Color bg)
Sets the background color of this component. |
Constructor Summary | |
---|---|
JLabel()
Creates a JLabel instance with
no image and with an empty string for the title. |
|
JLabel(String text)
Creates a JLabel instance with the specified text. |
Method Summary | |
---|---|
String |
getText()
Returns the text string that the label displays. |
void |
setText(String text)
Defines the single line of text this component will display. |
Constructor Summary | |
---|---|
JButton()
Creates a button with no set text or icon. |
|
JButton(Icon icon)
Creates a button with an icon. |
|
JButton(String text)
Creates a button with text. |
|
JButton(String text,
Icon icon)
Creates a button with initial text and an icon. |
Method Summary | |
---|---|
void |
addActionListener(ActionListener l)
Adds an ActionListener to the button. |
void |
setIcon(Icon defaultIcon)
Sets the button's default icon. |
void |
setText(String text)
Sets the button's text. |
Constructor Summary | |
---|---|
JTextField()
Constructs a new TextField . |
|
JTextField(int columns)
Constructs a new empty TextField with the specified
number of columns. |
|
JTextField(String text)
Constructs a new TextField initialized with the
specified text. |
|
JTextField(String text,
int columns)
Constructs a new TextField initialized with the
specified text and columns. |
Method Summary | |
---|---|
String |
getText()
Returns the text contained in this TextComponent . |