use of java.awt.event.WindowAdapter in project zookeeper by apache.
the class ZooInspector method main.
/**
* @param args
* - not used. The value of these parameters will have no effect
* on the application
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame frame = new JFrame("ZooInspector");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
iconResource = new IconResource();
final ZooInspectorPanel zooInspectorPanel = new ZooInspectorPanel(new ZooInspectorManagerImpl(), iconResource);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
super.windowClosed(e);
zooInspectorPanel.disconnect(true);
}
});
frame.setContentPane(zooInspectorPanel);
frame.setSize(1024, 768);
frame.setVisible(true);
} catch (Exception e) {
LoggerFactory.getLogger().error("Error occurred loading ZooInspector", e);
JOptionPane.showMessageDialog(null, "ZooInspector failed to start: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
use of java.awt.event.WindowAdapter in project qi4j-sdk by Qi4j.
the class Envisage method showMainFrame.
private void showMainFrame() {
mainFrame = new EnvisageFrame(application);
mainFrame.setLocationByPlatform(true);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
mainFrame.setSize(new Dimension(1024, 768));
mainFrame.setVisible(true);
mainFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
mainFrame.initQi4J();
}
});
}
});
}
use of java.awt.event.WindowAdapter in project jreversepro by akkumar.
the class GUIMain method addListeners.
/**
* Method to add property listeners to MenuItems and the MainFrame.
*/
private void addListeners() {
mMbrGen.onFileOpen.addActionListener(this);
mMbrGen.onFileSave.addActionListener(this);
mMbrGen.onFileExit.addActionListener(this);
mMbrGen.onEditCut.addActionListener(this);
mMbrGen.onEditCopy.addActionListener(this);
mMbrGen.onViewCPool.addActionListener(this);
mMbrGen.onOptFont.addActionListener(this);
mMbrGen.onHelpAbout.addActionListener(this);
addWindowListener(new WindowAdapter() {
/**
* WindowClosing event handler.
*
* @param aEvent
* Event generated.
*/
@Override
public void windowClosing(WindowEvent aEvent) {
appClose();
super.windowClosing(aEvent);
}
});
}
use of java.awt.event.WindowAdapter in project jmonkeyengine by jMonkeyEngine.
the class TestSafeCanvas method main.
public static void main(String[] args) throws InterruptedException {
AppSettings settings = new AppSettings(true);
settings.setWidth(640);
settings.setHeight(480);
final TestSafeCanvas app = new TestSafeCanvas();
app.setPauseOnLostFocus(false);
app.setSettings(settings);
app.createCanvas();
app.startCanvas(true);
JmeCanvasContext context = (JmeCanvasContext) app.getContext();
Canvas canvas = context.getCanvas();
canvas.setSize(settings.getWidth(), settings.getHeight());
Thread.sleep(3000);
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
app.stop();
}
});
frame.getContentPane().add(canvas);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Thread.sleep(3000);
frame.getContentPane().remove(canvas);
Thread.sleep(3000);
frame.getContentPane().add(canvas);
}
use of java.awt.event.WindowAdapter in project jmonkeyengine by jMonkeyEngine.
the class TestAwtPanels method createWindowForPanel.
private static void createWindowForPanel(AwtPanel panel, int location) {
JFrame frame = new JFrame("Render Display " + location);
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(panel, BorderLayout.CENTER);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
if (++panelsClosed == 2) {
app.stop();
}
}
});
frame.pack();
frame.setLocation(location, Toolkit.getDefaultToolkit().getScreenSize().height - 400);
frame.setVisible(true);
}
Aggregations