Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to maximize a JFrame through code?

How to maximize a JFrame through code?

like image 939
Tony Ogrewall Avatar asked Mar 10 '11 10:03

Tony Ogrewall


People also ask

How do I resize a JFrame?

You can change the size of the JFrame by simply placing the cursor in the corners and dragging it. Or if you press the resize option next to close(X) in the upper right corner, it will be enlarged to full-screen size. This happens because the resize is set to “true” by default.

How do you remove minimize maximize close button from JFrame?

Try this code: JFrame frame = new JFrame("Example"); frame. setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); frame.

What is extends javax swing JFrame?

public class JFrame extends Frame implements WindowConstants, Accessible, RootPaneContainer. An extended version of java. awt. Frame that adds support for the JFC/Swing component architecture. You can find task-oriented documentation about using JFrame in The Java Tutorial, in the section How to Make Frames.


1 Answers

Try this:

f.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH ); 
like image 110
Harry Joy Avatar answered Sep 25 '22 02:09

Harry Joy