本文整理了Java中javax.swing.JDialog.getSize()
方法的一些代码示例,展示了JDialog.getSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.getSize()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:getSize
暂无
代码示例来源:origin: org.netbeans.api/org-openide-util
dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(), dialog.getSize()));
代码示例来源:origin: org.netbeans.api/org-openide-util-ui
dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(), dialog.getSize()));
代码示例来源:origin: jpcsp/jpcsp
@Override
public Dimension getSize() {
return dialog.getSize();
}
代码示例来源:origin: antlr/antlrworks
public Dimension getSize() {
return jDialog.getSize();
}
代码示例来源:origin: openpnp/openpnp
@Override
public void componentResized(ComponentEvent e) {
prefs.putInt(PREF_MACHINECONTROLS_WINDOW_WIDTH, frameMachineControls.getSize().width);
prefs.putInt(PREF_MACHINECONTROLS_WINDOW_HEIGHT, frameMachineControls.getSize().height);
}
};
代码示例来源:origin: openpnp/openpnp
@Override
public void componentResized(ComponentEvent e) {
prefs.putInt(PREF_CAMERA_WINDOW_WIDTH, frameCamera.getSize().width);
prefs.putInt(PREF_CAMERA_WINDOW_HEIGHT, frameCamera.getSize().height);
}
};
代码示例来源:origin: org.scijava/scijava-ui-awt
private void ensureDialogSizeReasonable(final JDialog dialog) {
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
final Dimension dialogSize = dialog.getSize();
int newWidth = dialogSize.width;
int newHeight = dialogSize.height;
final int maxWidth = 3 * screenSize.width / 4;
final int maxHeight = 3 * screenSize.height / 4;
if (newWidth > maxWidth) newWidth = maxWidth;
if (newHeight > maxHeight) newHeight = maxHeight;
dialog.setSize(newWidth, newHeight);
}
代码示例来源:origin: org.jodd/jodd-wot
/**
* Center JDialog.
*/
public static void center(JDialog dialog) {
Dimension dialogSize = dialog.getSize();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
dialog.setLocation((screenSize.width - dialogSize.width) >> 1, (screenSize.height - dialogSize.height) >> 1);
}
代码示例来源:origin: org.languagetool/languagetool-gui-commons
/**
* Set dialog location to the center of the screen
*
* @param dialog the dialog which will be centered
* @since 2.6
*/
public static void centerDialog(JDialog dialog) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = dialog.getSize();
dialog.setLocation(screenSize.width / 2 - frameSize.width / 2,
screenSize.height / 2 - frameSize.height / 2);
dialog.setLocationByPlatform(true);
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4
@Override
public void windowClosing(WindowEvent e) {
prefs.putInt(DIALOG_WIDTH_PREFS_KEY, (int) dialog.getSize().getWidth());
prefs.putInt(DIALOG_HEIGHT_PREFS_KEY, (int) dialog.getSize().getHeight());
prefs.putDouble(DIALOG_X_PREFS_KEY, dialog.getLocationOnScreen().getX());
prefs.putDouble(DIALOG_Y_PREFS_KEY, dialog.getLocationOnScreen().getY());
prefs.putInt(DIALOG_DIVIDER_LOC_PREFS_KEY, splitPane.getDividerLocation());
prefs.putDouble(DIALOG_VIEWER_SCALE_PREFS_KEY, viewer.getScale());
dialog.setVisible(false);
dialog.dispose();
}
};
代码示例来源:origin: uk.co.nichesolutions/antlr4
public void windowClosing(WindowEvent e) {
prefs.putInt(DIALOG_WIDTH_PREFS_KEY, (int) dialog.getSize().getWidth());
prefs.putInt(DIALOG_HEIGHT_PREFS_KEY, (int) dialog.getSize().getHeight());
prefs.putDouble(DIALOG_X_PREFS_KEY, dialog.getLocationOnScreen().getX());
prefs.putDouble(DIALOG_Y_PREFS_KEY, dialog.getLocationOnScreen().getY());
prefs.putInt(DIALOG_DIVIDER_LOC_PREFS_KEY, splitPane.getDividerLocation());
prefs.putDouble(DIALOG_VIEWER_SCALE_PREFS_KEY, viewer.getScale());
dialog.setVisible(false);
dialog.dispose();
}
};
代码示例来源:origin: undera/jmeter-plugins
public static void centerDialog(Frame parent, JDialog dialog) {
if(parent != null && dialog != null) {
dialog.setLocation(parent.getLocation().x + (parent.getSize().width - dialog.getSize().width) / 2,
parent.getLocation().y + (parent.getSize().height - dialog.getSize().height) / 2);
}
}
}
代码示例来源:origin: senbox-org/snap-desktop
/**
* Standard constructor - builds and returns a new WizardDialog.
*
* @param owner the owner.
* @param modal modal?
* @param title the title.
* @param helpID the help id
* @param firstPanel the first panel.
*/
public WizardDialog(final JDialog owner, final boolean modal,
final String title, final String helpID, final WizardPanel firstPanel) {
super(owner, title, modal);
init(title, helpID, firstPanel);
setLocation(owner.getSize());
}
代码示例来源:origin: otros-systems/otroslogviewer
public ReturnValue showOpenDialog(Component parent, String title) {
JDialog dialog = createDialog(parent);
dialog.setName("VfsBrowserDialog");
dialog.setTitle(title);
if (size == null) {
dialog.pack();
} else {
dialog.setSize(size);
}
dialog.setVisible(true);
size = dialog.getSize();
return returnValue;
}
代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter
public static void centerDialog(Frame parent, JDialog dialog) {
if(parent != null && dialog != null) {
dialog.setLocation(parent.getLocation().x + (parent.getSize().width - dialog.getSize().width) / 2,
parent.getLocation().y + (parent.getSize().height - dialog.getSize().height) / 2);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2
public void applyto(JDialog dialog) {
if (location != null) {
dialog.setLocation(location);
} else {
dialog.setBounds(Utilities.findCenterBounds(dialog.getSize()));
}
}
}
代码示例来源:origin: bcdev/beam
@Override
public int show() {
setButtonID(0);
final JDialog dialog = getJDialog();
if (!shown) {
dialog.pack();
center();
}
dialog.setMinimumSize(dialog.getSize());
dialog.setVisible(true);
shown = true;
return getButtonID();
}
代码示例来源:origin: bcdev/beam
@Override
public void actionPerformed(CommandEvent event) {
super.actionPerformed(event);
final OpendapAccessPanel opendapAccessPanel = new OpendapAccessPanel(getAppContext(), event.getCommand().getHelpId());
final JDialog jDialog = new JDialog(getAppContext().getApplicationWindow(), "OPeNDAP Access");
jDialog.setContentPane(opendapAccessPanel);
jDialog.pack();
final Dimension size = jDialog.getSize();
jDialog.setPreferredSize(size);
jDialog.setVisible(true);
}
}
代码示例来源:origin: chatty/chatty
/**
* Adjusts the size of the dialog to the preferred size, but only if that
* is bigger than the current size.
*/
private void adjustSize() {
if (dialog.isVisible()) {
Dimension p = dialog.getPreferredSize();
Point bottomRight = dialog.getLocationOnScreen();
bottomRight.translate(p.width, p.height);
if (bigger(p, dialog.getSize())
&& GuiUtil.isPointOnScreen(bottomRight)) {
dialog.pack();
}
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* Called by about button. Raises about dialog. Currently the about box has
* the product image and the copyright notice. The dialog box is centered
* over the MainFrame.
*/
private void about() {
JFrame mainFrame = GuiPackage.getInstance().getMainFrame();
JDialog dialog = initDialog(mainFrame);
// NOTE: these lines center the about dialog in the current window.
Point p = mainFrame.getLocationOnScreen();
Dimension d1 = mainFrame.getSize();
Dimension d2 = dialog.getSize();
dialog.setLocation(p.x + (d1.width - d2.width) / 2, p.y + (d1.height - d2.height) / 2);
dialog.setVisible(true);
}
内容来源于网络,如有侵权,请联系作者删除!