Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Jframe, auto-maximize screen

$
0
0
hi guys,

im starting to program java with jframe, i want to know how to set the app to run maximized when its starting.

Here is my code:
package alkent;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GraphicsConfiguration;
import java.awt.Insets;
import java.awt.Toolkit;
import javax.swing.JButton;
import javax.swing.JFrame;

public class Alkent {

    public static JFrame Display;
    public static Dimension screenSize;
    public static Insets screenInsets;
    public static GraphicsConfiguration gc;
    public static void initDisplay()
    {
        screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        
        Display = new JFrame();
        Display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Display.setBounds(0, 0, screenSize.width, screenSize.height);
        Display.setTitle("Alkent");
        Display.setVisible(true);
        Display.setResizable(false);
    }
    public static void main(String[] args) {
       initDisplay();
       Display.setLayout(new FlowLayout());
       //JButton button = new JButton("Click");
       
       //Display.add(button);
       
    }
    
    
}



Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>