List of usage examples for java.awt Window toFront
public void toFront()
From source file:Main.java
public static void parentWindowToFront(Component component) { if (component == null) { throw new NullPointerException("component == null"); }//from w w w. j av a 2s . com Container parent = component.getParent(); while (parent != null) { if ((parent instanceof Window)) { Window parentWindow = (Window) parent; parentWindow.toFront(); return; } parent = parent.getParent(); } }
From source file:Main.java
/** * Makes a window visible - if invisible - and brings it to front. * * @param window window//from w ww . j a va 2s . c o m */ public static void show(Window window) { if (window == null) { throw new NullPointerException("window == null"); } if (!window.isVisible()) { window.setVisible(true); } window.toFront(); }
From source file:com.sshtools.sshterm.SshTermSessionPanel.java
/** * * * @throws IOException/* w w w . j av a 2s . c o m*/ */ public boolean onOpenSession() throws IOException { Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, SshTermSessionPanel.this); if (w != null) { w.toFront(); } terminal.requestFocus(); SshToolsConnectionProfile profile = getCurrentConnectionProfile(); setTerminalProperties(profile); // We are now connected statusBar.setStatusText("Connected"); statusBar.setConnected(true); this.setContainerTitle(null); //If the eol setting is EOL_DEFAULT, then use the // value guessed by j2ssh if (eol == TerminalEmulation.EOL_DEFAULT) { if (manager.getRemoteEOL() == TransportProtocolCommon.EOL_CRLF) { emulation.setEOL(TerminalEmulation.EOL_CR_LF); } else { emulation.setEOL(TerminalEmulation.EOL_CR); } } if (profile.getOnceAuthenticatedCommand() != SshToolsConnectionProfile.DO_NOTHING) { if (profile.getOnceAuthenticatedCommand() == SshToolsConnectionProfile.EXECUTE_COMMANDS) { BufferedReader reader = new BufferedReader(new StringReader(profile.getCommandsToExecute() + "\n")); String cmd; while ((cmd = reader.readLine()) != null) { if (cmd.trim().length() > 0) { log.info("Executing " + cmd); session = createNewSession(false); if (session.executeCommand(cmd)) { session.bindInputStream(emulation.getTerminalInputStream()); session.bindOutputStream(emulation.getTerminalOutputStream()); try { session.getState().waitForState(ChannelState.CHANNEL_CLOSED); } catch (InterruptedException ex) { JOptionPane.showMessageDialog(this, "The command was interrupted!", "Interrupted Exception", JOptionPane.OK_OPTION); } } } } } else { // Start the users shell session = createNewSession(true); if (session.startShell()) { session.bindInputStream(emulation.getTerminalInputStream()); session.bindOutputStream(emulation.getTerminalOutputStream()); } } } // Set the connection status setAvailableActions(); return true; }
From source file:com.sshtools.sshterm.SshTerminalPanel.java
public boolean postConnection() { Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, SshTerminalPanel.this); if (w != null) { w.toFront(); }//from ww w. ja v a 2 s . c om terminal.requestFocus(); return true; }
From source file:com.diversityarrays.kdxplore.trials.TrialExplorerPanel.java
private void handleServiceDetected(String msgTitle, Trial trial, TrialDataEditorService service) { CurationParams params = new CurationParams(); params.title = msgTitle;//ww w . j av a 2 s . c o m params.trial = trial; params.offlineData = offlineData; params.messageLogger = messageLogger; params.component = TrialExplorerPanel.this; params.windowOpener = windowOpener; long start = System.currentTimeMillis(); Consumer<Either<InitError, TrialDataEditorResult>> onComplete = new Consumer<Either<InitError, TrialDataEditorResult>>() { @Override public void accept(Either<InitError, TrialDataEditorResult> either) { long elapsed = System.currentTimeMillis() - start; Shared.Log.i(TAG, "doEditTrial.generateResult: Time to load trialData for trialId#" + params.trial.getTrialId() + "=" + elapsed + " ms"); if (either.isRight()) { TrialDataEditorResult result = either.right(); result.curationData.addSamplesSavedListener(samplesSavedListener); result.frame.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { result.frame.removeWindowListener(this); result.curationData.removeSamplesSavedListener(samplesSavedListener); Window ownerWindow = GuiUtil.getOwnerWindow(TrialExplorerPanel.this); if (ownerWindow != null) { ownerWindow.toFront(); ownerWindow.repaint(); } } }); GuiUtil.ensureMaximized(result.frame); } else { InitError initError = either.left(); if (initError.throwable == null) { messageLogger.e(TAG, params.title); MsgBox.error(TrialExplorerPanel.this, initError.message, trial.getTrialName() + ": Unable to create editor"); } else { Throwable error = initError.throwable; messageLogger.e(TAG, params.title, error); MsgBox.error(TrialExplorerPanel.this, error.getMessage(), trial.getTrialName() + ": Unable to create editor"); } } } }; service.createUserInterface(backgroundRunner, params, onComplete); }
From source file:org.eclipse.jubula.rc.swing.components.AUTSwingHierarchy.java
/** * Searchs for the component in the AUT with the given * <code>componentIdentifier</code>. * @param componentIdentifier the identifier created in object mapping mode * @throws IllegalArgumentException if the given identifer is null or <br>the hierarchy is not valid: empty or containing null elements * @throws InvalidDataException if the hierarchy in the componentIdentifier does not consist of strings * @throws ComponentNotManagedException if no component could be found for the identifier * @return the instance of the component of the AUT *//*www . j ava2 s. co m*/ public Component findComponent(IComponentIdentifier componentIdentifier) throws IllegalArgumentException, ComponentNotManagedException, InvalidDataException { Component comp = (Component) findBP.findComponent(componentIdentifier, ComponentHandler.getAutHierarchy()); if (comp != null && comp.isShowing()) { Window window = SwingUtilities.getWindowAncestor(comp); if (window != null && window.isShowing() && !window.isActive()) { window.toFront(); } return comp; } throw new ComponentNotManagedException("unmanaged component with identifier: '" //$NON-NLS-1$ + componentIdentifier.toString() + "'.", //$NON-NLS-1$ MessageIDs.E_COMPONENT_NOT_MANAGED); }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void showPopupInCenter(Window container) { Container parent = main;//from ww w .j ava 2 s. c om Point parentLocation = parent.getLocationOnScreen(); Dimension parentSize = parent.getSize(); int calcedXLoc = (parentLocation.x) + ((parentSize.width) / 2) - (container.getWidth() / 2); int calcedYLoc = (parentLocation.y) + ((parentSize.height) / 2) - (container.getHeight() / 2); container.setVisible(true); container.setLocation(calcedXLoc, calcedYLoc); container.toFront(); container.requestFocusInWindow(); }
From source file:org.pgptool.gui.ui.tools.UiUtils.java
/** * Hack to make sure window is visible. On windows it's sometimes created but on * a background. User can see "flashing" icon in a task bar but window stays on * a background.// w w w .j av a 2s . c om * * PRESUMING: setVisible(true) was already called * * More ion tihs jere: * http://stackoverflow.com/questions/309023/how-to-bring-a-window-to-the-front */ public static void makeSureWindowBroughtToFront(Window window) { // int state = dialog.getExtendedState(); // state &= ~JFrame.ICONIFIED; // dialog.setExtendedState(state); window.setAlwaysOnTop(true); window.toFront(); window.requestFocus(); window.setAlwaysOnTop(false); window.repaint(); }