List of usage examples for javax.swing WindowConstants HIDE_ON_CLOSE
int HIDE_ON_CLOSE
To view the source code for javax.swing WindowConstants HIDE_ON_CLOSE.
Click Source Link
From source file:fxts.stations.trader.ui.frames.ChildFrame.java
/** * Constructor./*from w ww . j ava 2s . co m*/ * * @param aName name of frame * @param aMainFrame main frame */ public ChildFrame(String aName, IMainFrame aMainFrame) { super(aName, true, //resizable true, //closable true); //maximizable setMainFrame(aMainFrame); //sets reaction on closings setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); //adds listener addInternalFrameListener(new InternalFrameAdapter() { //overriden public void internalFrameClosing(InternalFrameEvent aEvent) { //unselects associated menu item setMenuItemState(false); ChildFrame.this.setVisible(false); //checking for existing of visible frames mMainFrame.checkForVisibleChilds(); } }); //sets name of the frame setName(aName); //adds mouse listener addMouseListener(new MouseAdapter() { /** * Invoked when a mouse button has been pressed on a component. */ public void mousePressed(MouseEvent aEvent) { if (!ChildFrame.this.isSelected()) { try { ChildFrame.this.setSelected(true); } catch (Exception e) { e.printStackTrace(); } } } }); }
From source file:OAT.ui.AbstractChartFrame.java
private void initComponent() { setJMenuBar(new MainMenuBar(this)); chartPanel.setPreferredSize(getChartPanelSize()); setContentPane(chartPanel);/*from ww w. j a v a 2s. c o m*/ setDefaultCloseOperation( disposeOnClose() ? WindowConstants.DISPOSE_ON_CLOSE : WindowConstants.HIDE_ON_CLOSE); if (hideWhenFocusLost()) { addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setVisible(false); } }); } init(); //pack and display pack(); }
From source file:net.sf.profiler4j.console.util.task.LongTaskExecutorDialog.java
/** * This method initializes this// w w w.j a va2s . c o m */ private void initialize() { this.setSize(486, 107); this.setResizable(false); this.setModal(true); this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.setTitle("Remote Command Monitor"); this.setContentPane(getJContentPane()); }
From source file:iqq.app.ui.manager.MainManager.java
public void show() { if (mainFrame == null) { mainFrame = new MainFrame(); mainFrame.setVisible(true);// w w w .j a v a 2 s . c o m mainFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); enableTray(); } if (!mainFrame.isVisible()) { mainFrame.setVisible(true);// ?? // ??(??) mainFrame.setExtendedState(Frame.NORMAL); } }
From source file:de.tbuchloh.kiskis.gui.MainFrame.java
private void init() { _tray = SystemTrayFactory.create(this); this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.setIconImage(loadImage(ICON_PNG).getImage()); this.addWindowListener(new WindowAdapter() { @Override//from ww w. j ava 2s.co m public void windowClosing(final WindowEvent e) { onClosing(); } }); _main = new MainFramePanel(this); this.getContentPane().setLayout(new BorderLayout()); setMainView(_main); final StatusBar statusBar = new StatusBar(); _statusMsg = new SimpleTextField(SimpleTextField.LEFT); statusBar.add(_statusMsg, 0, 1); this.getContentPane().add(statusBar, BorderLayout.SOUTH); this.pack(); }
From source file:dk.dma.epd.shore.gui.views.SendRouteDialog.java
/** * Create the frame.//from w ww.j a v a 2 s .co m */ public SendRouteDialog(JFrame frame) { super(frame, "Tactical Route Exchange", Dialog.ModalityType.MODELESS); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setLocation(100, 100); initGUI(); // Hook up enter key to send and escape key to cancel getRootPane().setDefaultButton(sendBtn); getRootPane().registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); pack(); }
From source file:events.InternalFrameEventDemo.java
public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { //They clicked the Show button. //Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, //resizable true, //closable true, //maximizable true); //iconifiable //We want to reuse the internal frame, so we need to //make it hide (instead of being disposed of, which is //the default) when the user closes it. listenedToWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); //Add an internal frame listener so we can see //what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); //And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); //Set its size and location. We'd use pack() to set the size //if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation(desktopWidth / 2 - listenedToWindow.getWidth() / 2, desktopHeight - listenedToWindow.getHeight()); }//ww w . j av a 2 s. c o m //Show the internal frame. listenedToWindow.setVisible(true); } else { //They clicked the Clear button. display.setText(""); } }
From source file:InternalFrameEventDemo.java
public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { // They clicked the Show button. // Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, // resizable true, // closable true, // maximizable true); // iconifiable // We want to reuse the internal frame, so we need to // make it hide (instead of being disposed of, which is // the default) when the user closes it. listenedToWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); // Add an internal frame listener so we can see // what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); // And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); // Set its size and location. We'd use pack() to set the size // if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation(desktopWidth / 2 - listenedToWindow.getWidth() / 2, desktopHeight - listenedToWindow.getHeight()); }// w w w .j a v a2 s . co m // Show the internal frame. listenedToWindow.setVisible(true); } else { // They clicked the Clear button. display.setText(""); } }
From source file:InternalFrameEventDemo.java
public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { //They clicked the Show button. //Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, //resizable true, //closable true, //maximizable true); //iconifiable //We want to reuse the internal frame, so we need to //make it hide (instead of being disposed of, which is //the default) when the user closes it. listenedToWindow.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); //Add an internal frame listener so we can see //what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); //And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); //Set its size and location. We'd use pack() to set the size //if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation(desktopWidth / 2 - listenedToWindow.getWidth() / 2, desktopHeight - listenedToWindow.getHeight()); }//from w ww.j ava2 s. c om //Show the internal frame. listenedToWindow.setVisible(true); } else { //They clicked the Clear button. display.setText(""); } }
From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java
public void showFlattenedImage() { if (imageHolder == null) { imageHolder = new JFrame("Flattened Image"); JButton save = new JButton("Save"); ImagePanelControler control = new ImagePanelControler(previewPanel); // FrameFactroy.getFrame(control); JPanel panel = new JPanel(new FlowLayout()); panel.add(showImageOverlay);//from w ww. j a v a 2 s. c om panel.add(realTimeImage); JPanel pan = new JPanel(); previewPanel.putIntoPanel(pan); imageHolder.getContentPane().setLayout(new BorderLayout()); imageHolder.getContentPane().add(pan, BorderLayout.CENTER); imageHolder.getContentPane().add(save, BorderLayout.SOUTH); imageHolder.getContentPane().add(panel, BorderLayout.NORTH); imageHolder.setSize(600, 480); imageHolder.setVisible(true); showImageOverlay.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { previewPanel.setImage(getFlattenedImage(showImageOverlay.isSelected())); } }); imageHolder.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); save.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { File f = FileSelectionField.getUserFile(); if (f != null) { ImageIO.write(previewPanel.getImage(), "png", f); } } catch (Exception e1) { e1.printStackTrace(); } } }); } previewPanel.setImage(getFlattenedImage(showImageOverlay.isSelected())); imageHolder.setVisible(true); }