import java.awt.*; import javax.swing.*; public class SwingSetBounds{ public static void main(String[] args){ JFrame frame = new JFrame("Frame to set the bound"); Rectangle bounds = new Rectangle(0, 0, 500, 500); frame.setMaximizedBounds(bounds); frame.setSize(400, 400); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }