- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to maximize JFrame in Java Swing
To maximize JFrame in Java Swing, use the following −
JFrame.MAXIMIZED_BOTH
The following is an example to maximize JFrame in Java −
Example
package my; import javax.swing.JFrame; import javax.swing.JPanel; public class SwingDemo extends JFrame { JPanel panel = new JPanel(); public SwingDemo() { setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setAlwaysOnTop(true); setResizable(true); setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); } public static void main(String[] args) { new SwingDemo(); } }
The output is as follows. Here, the JFrame is visible with no border and title −
Output
- Related Articles
- How can we minimize/maximize a JFrame programmatically in Java?
- How can we disable the maximize button of a JFrame in Java?
- How to activate and deactivate JFrame in Java
- How to change JFrame background color in Java
- How to set FlowLayout for JFrame in Java?
- How to add background Image to JFrame in Java
- How to set default button for JFrame in Java?
- How to change Button Border in Java Swing
- How to make a canvas in Java Swing?
- How to add JTable to Panel in Java Swing?
- How to disable close button on a JFrame in Java?
- How to create a Titleless and Borderless JFrame in Java?
- How to display row count in Java Swing JList
- How to leave space with EmptyBorder in Java Swing
- How to add a title to JTable in Java Swing?

Advertisements