use of java.awt.event.WindowListener in project JMRI by JMRI.
the class LinkingLabelTest method tearDown.
@Override
protected void tearDown() {
if (panel != null) {
// now close panel window
java.awt.event.WindowListener[] listeners = panel.getTargetFrame().getWindowListeners();
for (WindowListener listener : listeners) {
panel.getTargetFrame().removeWindowListener(listener);
}
junit.extensions.jfcunit.TestHelper.disposeWindow(panel.getTargetFrame(), this);
panel = null;
}
apps.tests.Log4JFixture.tearDown();
}
use of java.awt.event.WindowListener in project JMRI by JMRI.
the class MemorySpinnerIconTest method tearDown.
@Override
protected void tearDown() {
// now close panel window
if (panel != null) {
java.awt.event.WindowListener[] listeners = panel.getTargetFrame().getWindowListeners();
for (WindowListener listener : listeners) {
panel.getTargetFrame().removeWindowListener(listener);
}
junit.extensions.jfcunit.TestHelper.disposeWindow(panel.getTargetFrame(), this);
}
apps.tests.Log4JFixture.tearDown();
}
use of java.awt.event.WindowListener in project JMRI by JMRI.
the class MemoryIconTest method tearDown.
@Override
protected void tearDown() throws Exception {
// now close panel window
if (panel != null) {
java.awt.event.WindowListener[] listeners = panel.getTargetFrame().getWindowListeners();
for (WindowListener listener : listeners) {
panel.getTargetFrame().removeWindowListener(listener);
}
junit.extensions.jfcunit.TestHelper.disposeWindow(panel.getTargetFrame(), this);
}
super.tearDown();
apps.tests.Log4JFixture.tearDown();
JUnitUtil.resetInstanceManager();
}
use of java.awt.event.WindowListener in project DistributedFractalNetwork by Budder21.
the class FractalChooserMenu method chooseFractal.
/**
* Allows a user to choose a saved fractal and set zoom speed and resolution
* parameters
* @return a RenderManger for the network to use. Will return null if no fractal if the window is closed
*/
public static RenderManager chooseFractal() {
waiting = true;
manager = null;
JFrame f = new JFrame();
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
JLabel message = new JLabel(" Fractal:");
message.setFont(Constants.mediumFont);
p.add(message, BorderLayout.WEST);
RoundedButton chooseFile = new RoundedButton();
chooseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) {
e1.printStackTrace();
}
JFileChooser fileChooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Fractal", "prop");
fileChooser.setFileFilter(filter);
manager = new RenderManager(fileChooser.getSelectedFile());
}
});
p.add(chooseFile, BorderLayout.CENTER);
f.setContentPane(p);
f.pack();
f.setLocationRelativeTo(null);
f.setResizable(false);
f.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
waiting = false;
}
});
f.setVisible(true);
while (manager == null || waiting) {
}
return manager;
}
use of java.awt.event.WindowListener in project DistributedFractalNetwork by Budder21.
the class Display method run.
/**
* This contains one of the main logic loops of this class. It starts by creating the JFrame the display
* is shown in. After that, it enters a loop where every few seconds it will ask the server for updates
*/
@Override
public void run() {
JFrame f = new JFrame("Network");
f.setContentPane(this);
f.pack();
f.setResizable(false);
f.setLocationRelativeTo(null);
f.setVisible(true);
f.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
System.out.println("closing");
running = false;
server.setDisplay(null);
}
});
updateParameters(server.getAdminParameters());
while (running) {
try {
t.sleep(5000);
} catch (InterruptedException e) {
log.addError(e);
}
updateParameters(server.getAdminParameters());
}
}
Aggregations