Derived from the Java API documentation.
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. (The operation is usually JFrame.EXIT_ON_CLOSE .) |
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 frame. |
void |
setLocation(int x,
int y)
Moves this frame to a new location. |
void |
setSize(int width,
int height)
Resizes this frame so that it has width width
and height height . |
void |
setVisible(boolean b)
Shows or hides this frame depending on the value of parameter b . |
void |
setBackground(Color bg)
Sets the background color of this frame. |
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 | |
---|---|
BorderLayout()
Creates a border layout. Place components in the managed container by calling add(component, place) , where
place is one of BorderLayout.NORTH ,
.SOUTH , .EAST , .WEST , or .CENTER .
|
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 panel. |
Component |
add(Component comp)
Appends the specified component to the end of this panel. |
void |
setBackground(Color bg)
Sets the background color of this panel. |
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 label 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 JTextField . |
|
JTextField(int columns)
Constructs a new empty JTextField with the specified
number of columns. |
|
JTextField(String text)
Constructs a new JTextField initialized with the
specified text. |
|
JTextField(String text,
int columns)
Constructs a new JTextField initialized with the
specified text and columns. |
Method Summary | |
---|---|
String |
getText()
Returns the text contained in this JTextField . |
void |
setText(String t)
Set the text in this JTextField . |
Constructor Summary | |
---|---|
JTextArea()
Constructs a new JTextArea . |
|
JTextArea(int rows, int columns)
Constructs a new empty JTextArea with the specified
number of rows and columns. |
Method Summary | |
---|---|
String |
getText()
Returns the text contained in this JTextArea . |
void |
setText(String t)
Set the text in this JTextArea . |
void |
setLineWrap(boolean wrap)
Set the line-wrapping policy of this JTextArea . |
void |
setWrapStyleWord(boolean word)
Set the style of wrapping used if the text area is wrapping lines. |