Saturday, January 27, 2007

JSwing Maximize Both on load

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;

public class Desk extends JFrame {

Container contentPane = getContentPane();

public Desk() {

addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {
System.exit(0);
}

public void windowOpened(WindowEvent e) {
setExtendedState(MAXIMIZED_BOTH); // Load the main window in a maximize state
}
}
);
setVisible(true);

}

public static void main(String[] args) {
Desk mainWindow = new Desk();
}
}