List of usage examples for javax.swing JFrame requestFocus
public void requestFocus()
From source file:es.emergya.ui.gis.popups.RouteDialog.java
public void showRouteDialog(LatLon from, LatLon to, CustomMapView view) { JFrame f = getRouteDialog(from, to, view); f.setVisible(true);//w w w. j a v a2 s. c o m f.setExtendedState(JFrame.NORMAL); f.requestFocus(); }
From source file:LineChart.java
public LineChart(JTable table) { final JFrame frame = new JFrame("jshow Chart"); final JFreeChart chart = createDataset(table); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); frame.setContentPane(chartPanel);/*from ww w . j ava 2 s. com*/ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setIconImage(Toolkit.getDefaultToolkit() .createImage(LineChart.class.getResource("de/skelton/images/chart.png"))); frame.pack(); frame.setVisible(true); frame.requestFocus(); frame.toFront(); }
From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java
/** * System Tray Icon setup/* ww w . ja v a2 s . co m*/ * @param frame owner JFrame */ private void setupTrayIcon(final JFrame frame) { // Idle Icon idleIcon = Toolkit.getDefaultToolkit() .getImage(ClassLoader.getSystemResource("META-INF/resources/cluster_inactive.png")); // Active Icon activeIcon = Toolkit.getDefaultToolkit() .getImage(ClassLoader.getSystemResource("META-INF/resources/cluster_active.png")); frame.setIconImage(idleIcon); // If system tray is supported by OS if (SystemTray.isSupported()) { // Set Icon trayIcon = new TrayIcon(idleIcon, "Nebula Grid Cluster", createTrayPopup()); trayIcon.setImageAutoSize(true); trayIcon.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { if (!frame.isVisible()) { frame.setVisible(true); } frame.setExtendedState(JFrame.NORMAL); frame.requestFocus(); frame.toFront(); } } }); try { SystemTray.getSystemTray().add(trayIcon); } catch (AWTException ae) { log.debug("[UI] Unable to Initialize Tray Icon"); return; } frame.addWindowListener(new WindowAdapter() { @Override public void windowIconified(WindowEvent e) { // Hide (can be shown using tray icon) frame.setVisible(false); } }); } }
From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java
/** * Setup System Tray Icon./*from w w w . j ava 2s. c o m*/ * * @param frame owner frame */ private void setupTrayIcon(final JFrame frame) { idleIcon = Toolkit.getDefaultToolkit() .getImage(ClassLoader.getSystemResource("META-INF/resources/node_inactive.png")); activeIcon = Toolkit.getDefaultToolkit() .getImage(ClassLoader.getSystemResource("META-INF/resources/node_active.png")); frame.setIconImage(idleIcon); // If system tray is supported by OS if (SystemTray.isSupported()) { trayIcon = new TrayIcon(idleIcon, "Nebula Grid Node", createTrayPopup()); trayIcon.setImageAutoSize(true); trayIcon.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { if (!frame.isVisible()) { frame.setVisible(true); } frame.setExtendedState(JFrame.NORMAL); frame.requestFocus(); frame.toFront(); } } }); try { SystemTray.getSystemTray().add(trayIcon); } catch (AWTException ae) { log.debug("[UI] Unable to Initialize Tray Icon"); return; } frame.addWindowListener(new WindowAdapter() { @Override public void windowIconified(WindowEvent e) { // Hide (can be shown using tray icon) frame.setVisible(false); } }); } }