本文整理了Java中javax.swing.JDialog.getX()
方法的一些代码示例,展示了JDialog.getX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.getX()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:getX
暂无
代码示例来源:origin: chatty/chatty
/**
* Returns a list of Strings that contain the location/size of open dialogs
* and of closed dialogs that weren't reused.
*
* Format: "x,y;width,height"
*
* @return
*/
public List getPopoutAttributes() {
List<String> attributes = new ArrayList<>();
for (JDialog dialog : dialogs.values()) {
attributes.add(dialog.getX()+","+dialog.getY()
+";"+dialog.getWidth()+","+dialog.getHeight());
}
for (LocationAndSize attr : dialogsAttributes) {
attributes.add(attr.location.x + "," + attr.location.y
+ ";" + attr.size.width + "," + attr.size.height);
}
return attributes;
}
代码示例来源:origin: notzippy/JALOPY2-MAIN
/**
* {@inheritDoc} Overriden to dispatch the call to the top-level container if invoked
* from the command line.
*/
public int getX()
{
Container c = getParent();
if (c instanceof SettingsFrame)
{
return c.getX();
}
return super.getX();
}
代码示例来源:origin: hneemann/Digital
@Override
public void setVisible(boolean visible) {
if (!isVisible())
setLocation(parent.getX() + parent.getWidth(), parent.getY());
super.setVisible(visible);
}
代码示例来源:origin: igniterealtime/Spark
private void showStatusMessage(ContactItem item)
{
Frame = new JDialog();
Frame.setTitle(item.getDisplayName() + " - Status");
JPanel pane = new JPanel();
JTextArea textArea = new JTextArea(5, 30);
JButton btn_close = new JButton(Res.getString("button.close"));
btn_close.addActionListener( e -> Frame.setVisible(false) );
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
pane.add(new JScrollPane(textArea));
Frame.setLayout(new BorderLayout());
Frame.add(pane, BorderLayout.CENTER);
Frame.add(btn_close, BorderLayout.SOUTH);
textArea.setEditable(false);
textArea.setText(item.getStatus());
Frame.setLocationRelativeTo(SparkManager.getMainWindow());
Frame.setBounds(Frame.getX() - 175, Frame.getY() - 75, 350, 150);
Frame.setSize(350, 150);
Frame.setResizable(false);
Frame.setVisible(true);
}
代码示例来源: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: google/sagetv
public static void safePositionDialog(javax.swing.JDialog theDialog)
{
// Check to see if we want to put the menu origin up some because it
// might go off the screen.
int x = theDialog.getX();
int y = theDialog.getY();
java.awt.Point screenLoc = new java.awt.Point(x, y);
//screenLoc.x += x;
//screenLoc.y += y;
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
java.awt.Insets screenInsets = java.awt.Toolkit.getDefaultToolkit().getScreenInsets(
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration());
if ((screenLoc.x + theDialog.getWidth()) > screenSize.width - screenInsets.right)
{
x -= theDialog.getWidth();
screenLoc.x -= theDialog.getWidth();
}
if ((screenLoc.y + theDialog.getHeight()) > screenSize.height - screenInsets.bottom)
{
y -= theDialog.getHeight();
screenLoc.y -= theDialog.getHeight();
}
if (screenLoc.x < screenInsets.left)
x += screenInsets.left - screenLoc.x;
if (screenLoc.y < screenInsets.top)
y += screenInsets.top - screenLoc.y;
theDialog.setLocation(x, y);
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!