Java Code Examples for javax.swing.JDialog#getHeight()
The following examples show how to use
javax.swing.JDialog#getHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseEvent.java From HBaseClient with GNU General Public License v3.0 | 5 votes |
/** * 屏幕中间显示对话窗口 * * @param i_JDialog */ public void showCreate(JDialog i_JDialog) { Toolkit v_Toolkit = Toolkit.getDefaultToolkit(); int v_X = (v_Toolkit.getScreenSize().height - i_JDialog.getHeight()) / 2; int v_Y = (v_Toolkit.getScreenSize().width - i_JDialog.getWidth() ) / 2; i_JDialog.setLocation(v_Y ,v_X); i_JDialog.setVisible(true); }
Example 2
Source File: Handler.java From ramus with GNU General Public License v3.0 | 5 votes |
/** * Floats the associated toolbar at the specified screen location, * optionally centering the floating frame on this point. */ public void floatToolBar(int x, int y, final boolean center) { final JDialog floatFrame = getFloatingFrame(); if (floatFrame == null) return; final Container target = ourDockLayout.getTargetContainer(); if (target != null) target.remove(ourToolBar); floatFrame.setVisible(false); floatFrame.getContentPane().remove(ourToolBar); ourToolBar.setOrientation(ToolBarLayout.HORIZONTAL); floatFrame.getContentPane().add(ourToolBar, BorderLayout.CENTER); floatFrame.pack(); if (center) { x -= floatFrame.getWidth() / 2; y -= floatFrame.getHeight() / 2; } // x and y are given relative to screen floatFrame.setLocation(x, y); floatFrame.setTitle(ourToolBar.getName()); floatFrame.setVisible(true); ourToolBarShouldFloat = true; if (target != null) { target.validate(); target.repaint(); } }
Example 3
Source File: Controller.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Sets the dialog position in the centre of the application window. * * @param dialog the dialog to centre */ public void centreDialog(JDialog dialog) { if ((frame != null) && (dialog != null)) { final int x = frame.getX() + (frame.getWidth() - dialog.getWidth()) / 2; final int y = frame.getY() + (frame.getHeight() - dialog.getHeight()) / 2; dialog.setLocation(x, y); } }
Example 4
Source File: ProgressPanel.java From swift-explorer with Apache License 2.0 | 5 votes |
@Override public void ancestorAdded(AncestorEvent event) { JDialog parent = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, panel); if (parent != null) { height = parent.getHeight() ; } }
Example 5
Source File: MainPanel.java From swift-explorer with Apache License 2.0 | 4 votes |
private void center(JDialog dialog) { int x = owner.getLocation().x + (owner.getWidth() - dialog.getWidth()) / 2; int y = owner.getLocation().y + (owner.getHeight() - dialog.getHeight()) / 2; dialog.setLocation(x, y); }