本文整理了Java中javax.swing.JDialog.getWidth()
方法的一些代码示例,展示了JDialog.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.getWidth()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:getWidth
暂无
代码示例来源:origin: stackoverflow.com
final JDialog d = new JDialog();
d.setSize(200, 200);
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final int x = (screenSize.width - d.getWidth()) / 2;
final int y = (screenSize.height - d.getHeight()) / 2;
d.setLocation(x, y);
d.setVisible(true);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd
private Point findScreenCenter(JDialog dialog) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
int x = toolkit.getScreenSize().width / 2 - dialog.getHeight() / 2;
int y = toolkit.getScreenSize().height / 2 - dialog.getWidth() / 2;
return new Point(x, y);
}
}
代码示例来源:origin: danfickle/openhtmltopdf
/**
* Description of the Method
*
* @param frame PARAM
*/
public static void center(JDialog frame) {
//p("centering");
Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((int) ((screen_size.getWidth() - frame.getWidth()) / 2),
(int) ((screen_size.getHeight() - frame.getHeight()) / 2));
}
代码示例来源:origin: org.xhtmlrenderer/core-renderer
/**
* Description of the Method
*
* @param frame PARAM
*/
public static void center(JDialog frame) {
//p("centering");
Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((int) ((screen_size.getWidth() - frame.getWidth()) / 2),
(int) ((screen_size.getHeight() - frame.getHeight()) / 2));
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer
/**
* Description of the Method
*
* @param frame PARAM
*/
public static void center(JDialog frame) {
//p("centering");
Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((int) ((screen_size.getWidth() - frame.getWidth()) / 2),
(int) ((screen_size.getHeight() - frame.getHeight()) / 2));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
private static Point fitToScreen( int x, int y, int altHeight ) {
Rectangle screen = org.openide.util.Utilities.getUsableScreenBounds();
Point p = new Point( x, y );
// Adjust the x postition if necessary
if ( ( p.x + popupWindow.getWidth() ) > ( screen.x + screen.width - X_INSET ) ) {
p.x = screen.x + screen.width - X_INSET - popupWindow.getWidth();
}
// Adjust the y position if necessary
if ( ( p.y + popupWindow.getHeight() ) > ( screen.y + screen.height - X_INSET ) ) {
p.y = p.y - popupWindow.getHeight() - altHeight;
}
return p;
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
public void run() {
if (!window.isVisible()) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
taskLabel.setText(message);
cancelledAction.setEnabled(true);
window.setLocation(screenSize.width / 2 - window.getWidth() / 2,
screenSize.height / 2 - window.getHeight() / 2);
window.setVisible(true);
}
}
});
代码示例来源:origin: org.protege/protege-editor-owl
public void run() {
if (!window.isVisible()) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
window.setLocation(screenSize.width / 2 - window.getWidth() / 2,
screenSize.height / 2 - window.getHeight() / 2);
window.setVisible(true);
}
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2
public void rememberFrom(JDialog dialog) {
location = dialog.getLocation();
width = dialog.getWidth();
height = dialog.getHeight();
}
代码示例来源:origin: HearthStats/HearthStats.net-Uploader
public void offset(int offset) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle bounds = env.getMaximumWindowBounds();
int x = bounds.width - frame.getWidth() - 5;
int y = bounds.height - frame.getHeight() - 5 - (frame.getHeight() + 5) * offset;
frame.setLocation(x, y);
}
public void show() {
代码示例来源:origin: hneemann/Digital
@Override
public void setVisible(boolean visible) {
if (!isVisible())
setLocation(parent.getX() + parent.getWidth(), parent.getY());
super.setVisible(visible);
}
代码示例来源:origin: freeplane/freeplane
public static void setDialogLocationUnder(final JDialog dialog, final NodeModel node) {
final Controller controller = Controller.getCurrentController();
final IMapViewManager viewController = controller.getMapViewManager();
final JComponent c = (JComponent) viewController.getComponent(node);
final int x = 0;
final int y = c.getHeight();
final Point location = new Point(x, y);
SwingUtilities.convertPointToScreen(location, c);
UITools.setBounds(dialog, location.x, location.y, dialog.getWidth(), dialog.getHeight());
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
/**
* Save settings for a dialog
*
* @param dialog
* the dialog
*/
public void saveSettings(JDialog dialog) {
if (!dialog.getName().contains("dialog")) {
storeWindowBounds(dialog.getName(), dialog.getX(), dialog.getY(), dialog.getWidth(), dialog.getHeight());
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans
private static void resizePopup() {
popupWindow.pack();
Point point = new Point(0,0);
SwingUtilities.convertPointToScreen(point, getMainWindow());
popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils
private static void resizePopup() {
popupWindow.pack();
Point point = new Point(0, 0);
SwingUtilities.convertPointToScreen(point, getMainWindow());
popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
private static final int X_INSET = 10;
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private static void resizePopup() {
popupWindow.pack();
Point point = new Point(0, 0);
SwingUtilities.convertPointToScreen(point, getMainWindow());
popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
private static void resizePopup() {
popupWindow.pack();
Point point = new Point(0,0);
SwingUtilities.convertPointToScreen(point, getMainWindow());
popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils-ui
private static void resizePopup() {
popupWindow.pack();
Point point = new Point(0, 0);
SwingUtilities.convertPointToScreen(point, getMainWindow());
popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
private static final int X_INSET = 10;
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-io
private static void resizePopup() {
popupWindow.pack();
Point point = new Point(0,0);
SwingUtilities.convertPointToScreen(point, getMainWindow());
popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
代码示例来源:origin: freeplane/freeplane
public void storeDialogPositions(final JDialog dialog, final String window_preference_storage_property) {
setX((dialog.getX()));
setY((dialog.getY()));
setWidth((dialog.getWidth()));
setHeight((dialog.getHeight()));
final String marshalled = marshall();
ResourceController.getResourceController().setProperty(window_preference_storage_property, marshalled);
}
内容来源于网络,如有侵权,请联系作者删除!