本文整理了Java中javax.swing.JDialog.setLocation()
方法的一些代码示例,展示了JDialog.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.setLocation()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:setLocation
暂无
代码示例来源: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: stanfordnlp/CoreNLP
public void about() {
aboutBox.setSize(360, 240);
aboutBox.setLocation((int)this.getLocation().getX() + 22, (int)this.getLocation().getY() + 22);
aboutBox.setResizable(false);
aboutBox.setVisible(true);
}
代码示例来源:origin: stanfordnlp/CoreNLP
dialog.setLocation(location);
final JList fileList = new JList(new Vector<>(files));
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
代码示例来源:origin: worstcase/gumshoe
public void setLocation(int x, int y) {
if(dialog!=null) {
dialog.setLocation(x, y);
}
locationX = x;
locationY = y;
}
代码示例来源:origin: stackoverflow.com
static class MyChooser extends JFileChooser {
protected JDialog createDialog(Component parent)
throws HeadlessException {
JDialog dlg = super.createDialog(parent);
dlg.setLocation(20, 20);
return dlg;
}
}
代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common
/**
* Shows the dialog at the given screen location.
* @param x the dialogs location
* @param y the dialogs location
*/
public void open( int x, int y ){
dialog.pack();
dialog.setLocation( x, y );
validateBounds();
dialog.setVisible( true );
}
代码示例来源:origin: worstcase/gumshoe
protected JDialog createDialog(Component parent) throws HeadlessException {
dialog = super.createDialog(parent);
dialog.setLocation(locationX, locationY);
return dialog;
}
代码示例来源: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.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: 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: stackoverflow.com
JOptionPane pane = new JOptionPane("Message", JOptionPane.WARNING_MESSAGE,
JOptionPane.DEFAULT_OPTION);
JDialog dialog = pane.createDialog("TITLE");
dialog.setLocation(0, 0);
dialog.setVisible(true);
// dialog box shown here
dialog.dispose();
Object selection = pane.getValue();
代码示例来源:origin: net.sf.sf3jswing/kernel-core
@Override
public void mouseDragged(MouseEvent e) {
if (dragEvent != null) {
d.setLocation(d.getLocation().x + (e.getX() - dragEvent.getX()), d.getLocation().y + (e.getY() - dragEvent.getY()));
}
dragEvent = e;
}
}
代码示例来源:origin: stackoverflow.com
JOptionPane pane = new JOptionPane(arguments);
pane.set.Xxxx(...); // Configure
JDialog dialog = pane.createDialog(parentComponent, title);
dialog.setLocation(....); // added!
dialog.setModal(....); // added! Do you want it modal or not?
// ....
dialog.setVisible(true);
代码示例来源:origin: freeplane/freeplane
public static void setDialogLocationRelativeTo(final JDialog dialog, final Component c) {
if (c == null || ! c.isShowing()) {
return;
}
final Point location = findBestLocation(dialog, c);
dialog.setLocation(location);
}
代码示例来源:origin: biojava/biojava
/**
* Place the suggestion window under the JTextField.
*/
private void updateLocation() {
try {
location = getLocationOnScreen();
location.y += getHeight();
dialog.setLocation(location);
} catch (IllegalComponentStateException e) {
return; // might happen on window creation
}
}
代码示例来源:origin: stackoverflow.com
JOptionPane pane = new JOptionPane("Message", JOptionPane.QUESTION_MESSAGE,
JOptionPane.OK_CANCEL_OPTION, null, null, null);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(null, "Title");
dialog.setLocation(0, 0);
dialog.setVisible(true);
String str = (String) pane.getInputValue();
代码示例来源: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.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: 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: 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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!