use of java.awt.event.WindowAdapter in project processdash by dtuma.
the class TimeLogEditor method constructUserInterface.
/*
* methods for constructing the user interface
*/
private void constructUserInterface() {
loadCustomDimensions();
frame = new JFrame(getResource("Time_Log_Editor_Window_Title"));
DashboardIconFactory.setWindowIcon(frame);
frame.setSize(new Dimension(frameWidth, frameHeight));
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
confirmClose(true);
}
});
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
PCSH.enableHelpKey(frame, "UsingTimeLogEditor");
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, constructTreePanel(), constructEditPanel());
splitPane.setDividerLocation(dividerLocation);
// Setup drag-and-drop support on Java 6 and above
new FallbackObjectFactory<TimeLogEditorDragDropSetup>(TimeLogEditorDragDropSetup.class).add(//
"TimeLogEditorDragDropSetupJava6").get(true).setupEditorForDragDrop(this);
Container panel = frame.getContentPane();
panel.setLayout(new BorderLayout());
panel.add(BorderLayout.NORTH, constructFilterPanel());
panel.add(BorderLayout.CENTER, splitPane);
panel.add(BorderLayout.SOUTH, constructControlPanel());
createRecalcTimer();
}
use of java.awt.event.WindowAdapter in project sling by apache.
the class RequestAnalyzerWebConsole method showWindow.
private synchronized void showWindow() throws ServletException, IOException {
if (this.frame == null) {
final File toAnalyze = this.getLogFileCopy();
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
MainFrame frame = new MainFrame(toAnalyze, Integer.MAX_VALUE, screenSize);
// exit the application if the main frame is closed
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
// remove the tmp file we showed
if (toAnalyze.exists()) {
toAnalyze.delete();
}
// clear the window reference
RequestAnalyzerWebConsole.this.frame = null;
}
});
this.frame = frame;
}
// make sure the window is visible, try to bring to the front
this.frame.setVisible(true);
this.frame.toFront();
}
use of java.awt.event.WindowAdapter in project sling by apache.
the class Main method main.
public static void main(String[] args) throws IOException {
if (GraphicsEnvironment.isHeadless()) {
System.err.println("Cannot run in headless mode");
System.exit(1);
}
if (args.length == 0) {
System.err.println("Missing argument <file>");
System.exit(1);
}
File file = new File(args[0]);
if (!file.canRead()) {
System.err.println("Cannot read from file " + file);
System.exit(1);
}
final int limit;
if (args.length >= 2) {
limit = Integer.parseInt(args[1]);
} else {
limit = Integer.MAX_VALUE;
}
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
MainFrame frame = new MainFrame(file, limit, screenSize);
frame.setVisible(true);
// exit the application if the main frame is closed
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
use of java.awt.event.WindowAdapter in project sling by apache.
the class RequestListSelectionListener method valueChanged.
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
int idx = lsm.getMinSelectionIndex();
if (idx >= 0) {
try {
idx = table.getRowSorter().convertRowIndexToModel(idx);
TableModel tm = ((RequestTrackerFile) table.getModel()).getData(idx);
if (dataField == null) {
dataField = new JTable();
dataField.setAutoCreateRowSorter(true);
dataField.setGridColor(Color.GRAY);
dataField.setShowGrid(true);
dataField.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
dataField.setRowSelectionAllowed(true);
dataField.setTableHeader(new JTableHeader(dataField.getColumnModel()));
dataField.setFont(new Font("Monospaced", dataField.getFont().getStyle(), dataField.getFont().getSize()));
dataField.setShowHorizontalLines(false);
// dataField.setIntercellSpacing(new Dimension(3, 5));
JDialog d = new JDialog(this.parent);
d.add(new JScrollPane(dataField));
d.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
dataField = null;
}
});
// setup location and size and ensure updating preferences
Util.setupComponentLocationSize(d, REQUEST_X, REQUEST_Y, REQUEST_WIDTH, REQUEST_HEIGHT, (int) screenSize.getWidth() / 4, (int) screenSize.getHeight() / 4, (int) screenSize.getWidth() / 2, (int) screenSize.getHeight() / 2);
d.setVisible(true);
}
dataField.setModel(tm);
Util.setupColumnWidths(dataField.getColumnModel(), REQUEST_COLS);
} catch (IOException e1) {
// ignore
}
}
}
}
use of java.awt.event.WindowAdapter in project cloudstack by apache.
the class VncClient method createVncClientMainWindow.
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
// Create AWT windows
final Frame frame = new Frame(title + " - VNCle");
// Use scrolling pane to support screens, which are larger than ours
ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
scroller.add(canvas);
scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight());
frame.add(scroller);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
frame.setVisible(false);
shutdown();
}
});
return frame;
}
Aggregations