/** Returns the window handle from LWJGL needed by OIS. */ static public long getWindowHandle () { // don't need a window handle for Mac OS X if (IS_MAC) { return 0; } try { if (Gdx.graphics.getType() == GraphicsType.JGLFW) return (Long)Gdx.graphics.getClass().getDeclaredMethod("getWindow").invoke(null); if (Gdx.graphics.getType() == GraphicsType.LWJGL) { if (Gdx.app.getClass().getName().equals("com.badlogic.gdx.backends.lwjgl.LwjglCanvas")) { Class canvasClass = Class.forName("com.badlogic.gdx.backends.lwjgl.LwjglCanvas"); Object canvas = canvasClass.getDeclaredMethod("getCanvas").invoke(Gdx.app); return (Long)invokeMethod(invokeMethod(SwingUtilities.windowForComponent((Component)canvas), "getPeer"), "getHWnd"); } Class displayClass = Class.forName("org.lwjgl.opengl.Display"); Method getImplementation = displayClass.getDeclaredMethod("getImplementation", new Class[0]); getImplementation.setAccessible(true); Object display = getImplementation.invoke(null, (Object[])null); Field field = display.getClass().getDeclaredField(IS_WINDOWS ? "hwnd" : "parent_window"); field.setAccessible(true); return (Long)field.get(display); } } catch (Exception ex) { throw new RuntimeException("Unable to get window handle.", ex); } return 0; }
@Override public void mouseClicked(MouseEvent e) { RuneliteColorPicker colorPicker = new RuneliteColorPicker(SwingUtilities.windowForComponent(ConfigPanel.this), colorPickerBtn.getBackground(), cid.getItem().name(), cid.getAlpha() == null); colorPicker.setLocation(getLocationOnScreen()); colorPicker.setOnColorChange(c -> { colorPickerBtn.setBackground(c); colorPickerBtn.setText(ColorUtil.toHexColor(c).toUpperCase()); }); colorPicker.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { changeConfiguration(listItem, config, colorPicker, cd, cid); } }); colorPicker.setVisible(true); } });
private void openFillColorPicker() { RuneliteColorPicker colorPicker = new RuneliteColorPicker(SwingUtilities.windowForComponent(this), marker.getMarker().getFill(), marker.getMarker().getName() + " Fill", false); colorPicker.setLocation(getLocationOnScreen()); colorPicker.setOnColorChange(c -> { marker.getMarker().setFill(c); updateFill(); }); colorPicker.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { plugin.updateConfig(); } }); colorPicker.setVisible(true); }
private void openBorderColorPicker() { RuneliteColorPicker colorPicker = new RuneliteColorPicker(SwingUtilities.windowForComponent(this), marker.getMarker().getColor(), marker.getMarker().getName() + " Border", false); colorPicker.setLocation(getLocationOnScreen()); colorPicker.setOnColorChange(c -> { marker.getMarker().setColor(c); updateBorder(); }); colorPicker.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { plugin.updateConfig(); } }); colorPicker.setVisible(true); } }
private JDialog createJumpDialog() final JDialog dialog = new JDialog(SwingUtilities.windowForComponent(this), "Jump to index"); dialog.setLocationRelativeTo(this); final JLabel nowLabel = new JLabel("Present index: " + selectedIndex);
private static boolean willPopupBeContained(JPopupMenu popup, Point origin) { if (!popup.isShowing()) { return false; } Window w = SwingUtilities.windowForComponent(popup.getInvoker()); Rectangle r = new Rectangle(origin, popup.getSize()); return (w != null) && w.getBounds().contains(r); }
Window parentWindow = SwingUtilities.windowForComponent(button); JDialog dialog = new JDialog(parentWindow); dialog.setLocationRelativeTo(button);
/** * Returns the wizard dialog that contains this panel. Note that this * method can only be called after this panel has been added to a wizard * dialog. * * @return The wizard dialog. */ protected WizardPluginDialog getWizard() { return (WizardPluginDialog)SwingUtilities.windowForComponent(this); }
/** * @see javax.swing.SwingUtilities#windowForComponent */ public static Window getOwner(Component aComponent) { return SwingUtilities.windowForComponent(aComponent); } }
/** * Centers the component on its window */ public static void centerOnWindow(Component componentToMove) { center(componentToMove, SwingUtilities.windowForComponent(componentToMove)); }
@Override public void process(List<Object> obj) { SwingUtilities.windowForComponent(callback).setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }
private void onRenameGraph() { // i18n[graph.newName=Please enter a new name] Window parent = SwingUtilities.windowForComponent(_desktopPane); String newName = JOptionPane.showInputDialog(parent, s_stringMgr.getString("graph.newName")); if(null != newName && 0 != newName.trim().length()) { _listener.renameRequest(newName); } }
protected void process(List<String> chunks) { initView.doInProgress(); SwingUtilities.windowForComponent(initView).setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }
public void actionPerformed(ActionEvent e) { if (e.getSource() == detailsButton) { throwableVisible = !throwableVisible; updateThrowableVisibility(); SwingUtilities.windowForComponent(this).pack(); } }
public void forceRepaint() { renderMgr.setDirty(true); Component source = SwingUtilities.windowForComponent(this); if (source == null) source = this; source.repaint(); }
@Override public void invoke(long window, int width, int height) { Dimension size = parent.getSize(); if(size.width != width || size.height != height) SwingUtilities.windowForComponent(canvas).setSize(width, height); ignore_resize = true; } };
private void scriptAllTables() { Vector<TableFrameController> tblCtrls = _tableFramesModel.getTblCtrls(); ITableInfo[] tableInfos = new ITableInfo[tblCtrls.size()]; for (int i = 0; i < tblCtrls.size(); i++) { TableFrameController tableFrameController = tblCtrls.get(i); tableInfos[i] = tableFrameController.getTableInfo(); } Window parent = SwingUtilities.windowForComponent(_panelController.getGraphPanel()); SqlScriptAcessor.scriptTablesToSQLEntryArea(parent, _session, tableInfos); }
@Override protected void done() { try { callback.updateEntry(get()); SwingUtilities.windowForComponent(callback).setCursor(Cursor.getDefaultCursor()); } catch (Exception e) { // There is no reason why we should end here e.printStackTrace(); return; } }
private void openWindowForTable(DataSetViewerTablePanel simpleTable) { Window parent = SwingUtilities.windowForComponent(_overviewPanel.btnShowInTableWin); OverviewFrame overviewFrame = new OverviewFrame(simpleTable, _app, parent); _app.getMainFrame().addWidget(overviewFrame); overviewFrame.setLayer(JLayeredPane.PALETTE_LAYER); overviewFrame.setVisible(true); DialogWidget.centerWithinDesktop(overviewFrame); }
public static void setupEnclosingDialogBounds(final JComponent component) { component.revalidate(); component.repaint(); final Window window = SwingUtilities.windowForComponent(component); if (window != null && (window.getSize().height < window.getMinimumSize().height || window.getSize().width < window.getMinimumSize().width)) { window.pack(); } }