List of usage examples for javax.swing JWindow JWindow
public JWindow(Window owner)
From source file:Main.java
public static void main(String[] arg) throws Exception { Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Robot robot = new Robot(); BufferedImage image = robot/*from w ww.ja v a2 s . c o m*/ .createScreenCapture(new Rectangle(0, 0, (int) screenDim.getWidth(), (int) screenDim.getHeight())); JWindow window = new JWindow(new JFrame()); window.getContentPane().setLayout(new BorderLayout()); window.getContentPane().add(BorderLayout.CENTER, new JLabel(new ImageIcon(image))); window.pack(); window.setVisible(true); }
From source file:javazoom.jlgui.player.amp.StandalonePlayer.java
/** * Load player front-end./* w ww.j a va 2s .co m*/ */ public void loadUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { log.debug(ex); } config = Config.getInstance(); config.load(initConfig); config.setTopParent(this); if (showPlaylist != null) { if (showPlaylist.equalsIgnoreCase("true")) { config.setPlaylistEnabled(true); } else { config.setPlaylistEnabled(false); } } if (showEqualizer != null) { if (showEqualizer.equalsIgnoreCase("true")) { config.setEqualizerEnabled(true); } else { config.setEqualizerEnabled(false); } } if (config.isPlaylistEnabled()) eqFactor = 2; else eqFactor = 1; setTitle(Skin.TITLETEXT); ClassLoader cl = this.getClass().getClassLoader(); URL iconURL = cl.getResource("javazoom/jlgui/player/amp/jlguiicon.gif"); if (iconURL != null) { ImageIcon jlguiIcon = new ImageIcon(iconURL); setIconImage(jlguiIcon.getImage()); config.setIconParent(jlguiIcon); } setUndecorated(true); mp = new PlayerUI(); if ((showDsp != null) && (showDsp.equalsIgnoreCase("false"))) { mp.getSkin().setDspEnabled(false); } if (skinPath != null) { mp.getSkin().setPath(skinPath); } mp.getSkin().setSkinVersion(skinVersion); mp.loadUI(this); setContentPane(mp); setSize(new Dimension(mp.getSkin().getMainWidth(), mp.getSkin().getMainHeight())); eqWin = new JWindow(this); eqWin.setContentPane(mp.getEqualizerUI()); eqWin.setSize(new Dimension(mp.getSkin().getMainWidth(), mp.getSkin().getMainHeight())); eqWin.setVisible(false); plWin = new JWindow(this); plWin.setContentPane(mp.getPlaylistUI()); plWin.setSize(new Dimension(mp.getSkin().getMainWidth(), mp.getSkin().getMainHeight())); plWin.setVisible(false); // Window listener addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { // Closing window (Alt+F4 under Win32) close(); } }); // Keyboard shortcut setKeyBoardShortcut(); // Display front-end setLocation(config.getXLocation(), config.getYLocation()); setVisible(true); if (config.isPlaylistEnabled()) plWin.setVisible(true); if (config.isEqualizerEnabled()) eqWin.setVisible(true); }
From source file:com.igormaznitsa.sciareto.ui.MainFrame.java
private void menuFullScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFullScreenActionPerformed final Component currentComponent = this.tabPane.getSelectedComponent(); if (!(currentComponent instanceof Container)) { LOGGER.warn("Detected attempt to full screen not a container : " + currentComponent); return;//w w w. jav a 2 s. c om } final GraphicsConfiguration gconfig = this.getGraphicsConfiguration(); if (gconfig != null) { final GraphicsDevice device = gconfig.getDevice(); if (device.isFullScreenSupported()) { if (device.getFullScreenWindow() == null) { final JLabel label = new JLabel("Opened in full screen"); final int tabIndex = this.tabPane.getSelectedIndex(); this.tabPane.setComponentAt(tabIndex, label); final JWindow window = new JWindow(Main.getApplicationFrame()); window.setAlwaysOnTop(true); window.setContentPane((Container) currentComponent); endFullScreenIfActive(); final KeyEventDispatcher fullScreenEscCatcher = new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(@Nonnull final KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && (e.getKeyCode() == KeyEvent.VK_ESCAPE || e.getKeyCode() == KeyEvent.VK_F11)) { endFullScreenIfActive(); return true; } return false; } }; if (this.taskToEndFullScreen.compareAndSet(null, new Runnable() { @Override public void run() { try { window.dispose(); } finally { tabPane.setComponentAt(tabIndex, currentComponent); device.setFullScreenWindow(null); KeyboardFocusManager.getCurrentKeyboardFocusManager() .removeKeyEventDispatcher(fullScreenEscCatcher); } } })) { try { KeyboardFocusManager.getCurrentKeyboardFocusManager() .addKeyEventDispatcher(fullScreenEscCatcher); device.setFullScreenWindow(window); } catch (Exception ex) { LOGGER.error("Can't turn on full screen", ex); endFullScreenIfActive(); KeyboardFocusManager.getCurrentKeyboardFocusManager() .removeKeyEventDispatcher(fullScreenEscCatcher); } } else { LOGGER.error("Unexpected state, processor is not null!"); } } else { LOGGER.warn("Attempt to full screen device which already in full screen!"); } } else { LOGGER.warn("Device doesn's support full screen"); DialogProviderManager.getInstance().getDialogProvider() .msgWarn("The Device doesn't support full-screen mode!"); } } else { LOGGER.warn("Can't find graphics config for the frame"); } }
From source file:org.geopublishing.atlasViewer.swing.AtlasViewerGUI.java
/** * Called via SingleInstanceListener / SingleInstanceService. Shows a * splashscreen and bring the existing instance to the front. *//*from ww w .j av a 2s . c o m*/ @Override public void newActivation(String[] arg0) { LOGGER.info( "A second instance of AtlasViewer has been started.. The single instance if requesting focus now..."); /* * Showing the Spalshscreen for one secong */ try { final URL splashscreenUrl = atlasConfig.getResource(AtlasConfig.SPLASHSCREEN_RESOURCE_NAME); if (splashscreenUrl != null) { JWindow splashWindow = new JWindow(atlasJFrame); JPanel panel = new JPanel(new BorderLayout()); ImageIcon icon = new ImageIcon(splashscreenUrl); panel.add(new JLabel(icon), BorderLayout.CENTER); panel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); splashWindow.getContentPane().add(panel); splashWindow.getRootPane().setOpaque(true); splashWindow.pack(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); splashWindow.setLocation((int) (d.getWidth() - splashWindow.getWidth()) / 2, (int) (d.getHeight() - splashWindow.getHeight()) / 2); splashWindow.setVisible(true); Thread.sleep(1500); splashWindow.dispose(); splashWindow = null; } } catch (Exception e) { LOGGER.warn("Singleinstance.newActivation had problems while showing the splashscreen:", e); } if (getJFrame() != null) { if (!getJFrame().isShowing()) getJFrame().setVisible(true); /* In case that it has been iconified */ getJFrame().setExtendedState(Frame.NORMAL); getJFrame().requestFocus(); getJFrame().toFront(); } }
From source file:org.openconcerto.erp.core.finance.accounting.element.AnalytiqueSQLElement.java
private void actionModifierAxe(MouseEvent e, final int index) { if (index == -1) return;/*from www . j ava 2s.c o m*/ Component comp = (Component) e.getSource(); JFrame frame = (JFrame) SwingUtilities.getRoot(comp); this.windowChangeNom = new JWindow(frame); Container container = this.windowChangeNom.getContentPane(); container.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.insets = new Insets(0, 0, 0, 0); c.weightx = 1; this.editedAxeIndex = index; this.text = new JTextField(" " + this.tabAxes.getTitleAt(index) + " "); this.text.setEditable(true); container.add(this.text, c); this.text.setBorder(null); // text.setBackground(this.tabAxes.getBackground()); this.text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ENTER) { validAxeText(); } } }); this.windowChangeNom.pack(); int ecartY = this.tabAxes.getBoundsAt(index).height - this.text.getBounds().height + 2; int ecartX = this.tabAxes.getBoundsAt(index).width - this.text.getBounds().width; this.windowChangeNom.setLocation( comp.getLocationOnScreen().x + this.tabAxes.getBoundsAt(index).getLocation().x + ecartX / 2, comp.getLocationOnScreen().y + this.tabAxes.getBoundsAt(index).getLocation().y + ecartY / 2); this.windowChangeNom.setVisible(true); }