Java JFrame set bound

Description

Java JFrame set bound


import javax.swing.JFrame;

public class Main {
    public static void main(String[] args) {
        // Create a frame
        JFrame frame = new JFrame("Revised Simplest Swing");

        // Set the default close behavior to exit the application
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Set the x, y, width and height properties in one go
        frame.setBounds(50, 50, 300, 200);
        //w  w w .  jav  a  2  s .  c  o  m
        // Display the frame
        frame.setVisible(true);
    }
}



PreviousNext

Related