Swing
Frames
Display a frame
A frame that doesn't contain any components
Common methods of the Frame class
Method | Description |
---|---|
setTitle(String) | Sets the title to the specified string. |
setResizable(boolean) | If the boolean value is true, the user can resize the frame. |
A class that defines a frame
class FutureValueFrame extends JFrame { public FutureValueFrame() { setTitle("Future Value Calculator"); setBounds(267, 200, 267, 200); setResizable(false); } }
A class that displays the frame
import javax.swing.*; public class FutureValueApp { public static void main(String[] args) { JFrame frame = new FutureValueFrame(); frame.setVisible(true); } }