use of java.awt.event.WindowEvent in project intellij-community by JetBrains.
the class ModeSwitchableDialog method show.
@Override
public void show() {
final Window window = SwingUtilities.windowForComponent(getContentPane());
window.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
final Dimension size = dimensionService.getSize(getPrivateDimensionKey());
if (size != null) {
setSize(size.width, size.height);
validate();
}
}
});
super.show();
dimensionService.setSize(getPrivateDimensionKey(), getSize());
dimensionService.setLocation(getPrivateDimensionKey(), getLocation());
PropertiesComponent.getInstance().setValue(getPrivateDimensionServiceKey() + ".MODE", myMode.ordinal(), 0);
}
use of java.awt.event.WindowEvent in project ACS by ACS-Community.
the class AlarmPanelFrame method initialize.
/**
* Initialize the GUI
*/
private void initialize() {
setTitle("AlarmPanel");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new BorderLayout());
alarmPanel = new AlarmPanel(this);
add(alarmPanel, BorderLayout.CENTER);
pack();
addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
super.windowClosed(e);
System.out.println("Window closed");
try {
System.out.println("Stopping panel");
alarmPanel.stop();
} catch (Throwable t) {
System.err.println("Error stopping the alarmPanel: " + t.getMessage());
}
if (acsHelper != null) {
System.out.println("Stopping acsHelper");
acsHelper.done();
}
}
});
setVisible(true);
}
use of java.awt.event.WindowEvent in project ACS by ACS-Community.
the class CommandCenterGui method prepare.
public void prepare() {
boolean setLookAndFeel = false;
if (setLookAndFeel) {
String lafName = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(lafName);
} catch (Exception exc) {
log.fine("Couldn't set look and feel " + lafName + " due to " + exc);
}
}
// title added later in doFrameTitle()
frame = new JFrame("");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
controller.stop();
}
});
dlgContainerSettings = new EditContainerSettingsDialog(this);
frontPanel = new TabPanel(this);
writeModelToFrontPanel();
// Splitter between tree and the rest
splitLeftRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitLeftRight.setOneTouchExpandable(true);
JPanel p2 = new JPanel(new BorderLayout());
p2.setBorder(new EmptyBorder(10, 10, 10, 10));
p2.add(frontPanel, BorderLayout.NORTH);
splitLeftRight.setLeftComponent(p2);
// Deployment Tree
deploymentInfoPanel = new JPanel(new BorderLayout());
deploymentInfoPanel.setBorder(new CompoundBorder(new EmptyBorder(5, 7, 5, 7), new TitledBorder(LineBorder.createBlackLineBorder(), " Deployment Info ")));
deployTree = new DeploymentTree(controller.deploymentTreeControllerImpl);
JPanel addToDeployTree = new AddToDeployTree(this, deployTree);
deploymentInfoPanel.add(addToDeployTree, BorderLayout.NORTH);
deploymentInfoPanel.add(new JScrollPane(deployTree), BorderLayout.CENTER);
splitLeftRight.setRightComponent(deploymentInfoPanel);
// Feedback Area
feedbackTabs = new FeedbackTabs(this, FeedbackTabs.BOTTOM);
// Logo Panel
JPanel logoPanel = new LogoPanel(COLOR_LogoBackground_A, COLOR_LogoBackground_B);
logoPanel.setLayout(new BorderLayout());
JLabel alma = new JLabel(new ImageIcon(controller.findResource("alma.jpg")));
logoPanel.add(alma, BorderLayout.WEST);
JLabel text = new JLabel("Acs Command Center");
text.setForeground(COLOR_LogoForeground);
text.setHorizontalTextPosition(SwingConstants.CENTER);
text.setFont(text.getFont().deriveFont((float) (text.getFont().getSize() * 2.5)));
text.setBorder(new EmptyBorder(5, 30, 5, 30));
logoPanel.add(text, BorderLayout.CENTER);
// JLabel version = new JLabel(controller.version());
// version.setForeground(COLOR_LogoForeground);
// version.setBorder(new EmptyBorder(0, 0, 0, 4));
// JPanel pnl2 = new JPanel(new BorderLayout());
// pnl2.setOpaque(false);
// pnl2.add(version, BorderLayout.SOUTH);
// logoPanel.add(pnl2, BorderLayout.EAST);
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("Project");
fileMenu.setMnemonic(KeyEvent.VK_P);
{
JMenu newMenu = new JMenu("New");
newMenu.add(new ActionNewProject("Project"));
fileMenu.add(newMenu);
}
fileMenu.add(new ActionOpenProject("Open..."));
fileMenu.add(new ActionSaveProject("Save"));
fileMenu.add(new ActionSaveAsProject("Save As..."));
fileMenu.addSeparator();
fileMenu.add(new ActionExit("Exit"));
menuBar.add(fileMenu);
toolsMenu = new JMenu("Tools");
toolsMenu.setMnemonic(KeyEvent.VK_T);
toolsMenu.add(new ActionConfigureTools("Configure Tools..."));
toolsMenu.addSeparator();
menuBar.add(toolsMenu);
// ---
JMenu extrasMenu = new JMenu("Expert");
extrasMenu.setMnemonic(KeyEvent.VK_E);
{
// JMenu sshMode = new JMenu("SSH Library");
// sshMode.add(new ActionSetSshMode("Platform-independent", false, false));
// sshMode.add(new ActionSetSshMode("Natively installed ssh", true, true));
// extrasMenu.add(sshMode);
// extrasMenu.add(new JSeparator());
JMenu extraTools = new JMenu("Tools Menu");
extraTools.add(new ActionShowExtraTools("View..."));
extraTools.add(new ActionInstallExtraTools("Replace..."));
extrasMenu.add(extraTools);
JMenu builtinTools = new JMenu("Acs Scripts");
builtinTools.add(new ActionShowBuiltinTools("View..."));
builtinTools.add(new ActionLoadBuiltinTools("Replace..."));
extrasMenu.add(builtinTools);
}
extrasMenu.add(new JSeparator());
extrasMenu.add(new ActionShowVariables("Variables..."));
menuBar.add(extrasMenu);
// ---
JMenuItem item;
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic(KeyEvent.VK_H);
item = helpMenu.add(new ActionShowHelp("Online Help"));
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
item = helpMenu.add(new ActionShowAbout("About"));
menuBar.add(Box.createHorizontalGlue());
menuBar.add(helpMenu);
// ---
JPanel h = new JPanel(new SpringLayout());
h.add(logoPanel);
h.add(menuBar);
SpringUtilities.makeCompactGrid(h, 0, 1);
frame.getContentPane().add(h, BorderLayout.NORTH);
// ---
pnlManagerLocationForTools = new ManagerLocationPanel.ForTools();
managerLocationDialog1 = new BasicDialog(this, "Specify Manager and Services for Tools", "Set", pnlManagerLocationForTools);
// ---
pnlManagerLocationForContainers = new ManagerLocationPanel.ForContainers();
managerLocationDialog2 = new BasicDialog(this, "Specify Manager and Services for Containers", "Set", pnlManagerLocationForContainers);
// ---
splitTopBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitLeftRight, feedbackTabs);
splitTopBottom.setOneTouchExpandable(true);
// ---
// 2009-04: Introducing a desktop layout so i can make the
// progress dialog a lightweight window on top the front panel
AccInternalFrame bigInternalFrame = new AccInternalFrame();
bigInternalFrame.add(splitTopBottom);
desktop = new JDesktopPane();
bigInternalFrame.setVisible(true);
desktop.add(bigInternalFrame);
frame.getContentPane().add(desktop, BorderLayout.CENTER);
try {
bigInternalFrame.setSelected(true);
bigInternalFrame.setMaximum(true);
} catch (PropertyVetoException exc) {
}
// for mysterious swing reasons, the desktop has a preferred size
// of (1,1) instead of picking up the preferred size of its child
// component, so i'm doing this manually here.
desktop.setPreferredSize(bigInternalFrame.getPreferredSize());
doFrameTitle();
}
use of java.awt.event.WindowEvent in project ACS by ACS-Community.
the class SysPropEditor method openFrame.
public static JFrame openFrame(final SysPropEditor inst) {
// frame
final JFrame f = new JFrame(SysPropEditor.class.getName());
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
int answer = JOptionPane.showConfirmDialog(f, "Really close?", "Close Window", JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION) {
f.setVisible(false);
f.dispose();
}
}
});
f.getContentPane().add(inst);
f.pack();
f.setVisible(true);
return f;
}
use of java.awt.event.WindowEvent in project ACS by ACS-Community.
the class LogManagerGui method openFrame.
//
// ============= Stand-Alone Launch==================
//
public static JFrame openFrame(final LogManagerGui inst) {
// frame
final JFrame f = new JFrame(LogManagerGui.class.getName());
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
int answer = JOptionPane.showConfirmDialog(f, "Really close?", "Close Window", JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION) {
f.setVisible(false);
f.dispose();
}
}
});
f.getContentPane().add(inst);
f.pack();
f.setVisible(true);
return f;
}
Aggregations