本文整理了Java中javax.swing.JFrame.getX()
方法的一些代码示例,展示了JFrame.getX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getX()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getX
暂无
代码示例来源:origin: fossasia/neurolab-desktop
buttonFrame.setResizable(false);
buttonFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buttonFrame.move(buttonFrame.getX(), buttonFrame.getY() + height / 2);
代码示例来源:origin: leMaik/swing-material
/**
* {@inheritDoc}
* <p/>
* <b>NOTE:</b> If this window is casting a shadow, calling this method
* might provide inaccurate results unless you take into account the margin
* constants found in {@link MaterialShadow}. In order to make things easier
* to handle, it is preferable to use {@link #getXLocation()}.
* @deprecated use {@link #getXLocation()} instead.
*/
@Override
@Deprecated
public int getX() {
return super.getX();
}
代码示例来源:origin: stackoverflow.com
final JFrame jFrame = new JFrame();
jFrame.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.VK_UNDEFINED), "moveRight");
jFrame.getRootPane().getActionMap().put("moveRight", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
jFrame.setLocation(jFrame.getX() + 5, jFrame.getY());
}
});
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setLocationRelativeTo(null);
jFrame.setVisible(true);
代码示例来源:origin: leMaik/swing-material
/**
* Alternative method to {@link JFrame#getX()}. Use it to get the location
* of this window in the desktop, excluding any margins present because of
* the shadow.
* @return the current x coordinate of this window's origin
*/
public int getXLocation() {
return super.getX() + (!isShadowed() ? 0:MaterialShadow.OFFSET_LEFT);
}
代码示例来源:origin: stackoverflow.com
JFrame f1 = ...;
JFrame f2 = ...;
f1.setLocationRelativeTo(null);
f2.setLocation(new Point(f1.getX(), f2.getY() + 20));
代码示例来源:origin: stackoverflow.com
public class Test
{
public static void main (String[] args)
{
JFrame f1 = new JFrame();
f1. setSize(100, 100);
f1.setLocationRelativeTo(null);
f1.setVisible(true);
JFrame f2 = new JFrame();
f2.setSize(100, 100);
f2.setLocation(f1.getX() + f1.getWidth(), f1.getY());
f2.setVisible(true);
}
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
frame.setLocation(100, 100);
frame.setSize(500, 500);
frame.setVisible(true);
try {
Robot robot = new Robot();
robot.mouseMove(frame.getX() + 250, frame.getY() + 250);
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
代码示例来源:origin: com.harium.propan/propan-jogl
public void setComponent(JFrame frame) {
this.component = frame;
activeWindowGL.setLocation(frame.getX(), frame.getY());
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public void run() {
maskManagerFrame.setLocation(50, 50);
maskViewerFrame.setLocation(maskManagerFrame.getX() + maskManagerFrame.getWidth(), 50);
productManagerFrame.setLocation(maskViewerFrame.getX() + maskViewerFrame.getWidth(), 50);
maskManagerFrame.setVisible(true);
maskViewerFrame.setVisible(true);
productManagerFrame.setVisible(true);
}
});
代码示例来源:origin: bcdev/beam
@Override
public void run() {
maskManagerFrame.setLocation(50, 50);
maskViewerFrame.setLocation(maskManagerFrame.getX() + maskManagerFrame.getWidth(), 50);
productManagerFrame.setLocation(maskViewerFrame.getX() + maskViewerFrame.getWidth(), 50);
maskManagerFrame.setVisible(true);
maskViewerFrame.setVisible(true);
productManagerFrame.setVisible(true);
}
});
代码示例来源:origin: AliView/AliView
public void show(){
dialog.setPreferredSize(this.preferredSize);
dialog.pack();
// center
if(parentFrame != null){
int newX = parentFrame.getX() + parentFrame.getWidth()/2 - dialog.getPreferredSize().width/2;
int newY = parentFrame.getY() + parentFrame.getHeight()/2 - dialog.getPreferredSize().height/2;
dialog.setLocation(newX, newY);
}
dialog.setVisible(true);
}
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
int numCols = tracerTable.getColumnCount();
for (int i = 0; i < numCols; i++)
uiMgr.putInt("studio/tracer_col_width/" + i, tracerTable.getColumnModel().getColumn(i).getWidth());
uiMgr.putInt("studio/tracer_win_pos_x", tracerFrame.getX());
uiMgr.putInt("studio/tracer_win_pos_y", tracerFrame.getY());
uiMgr.putInt("studio/tracer_win_pos_w", tracerFrame.getWidth());
uiMgr.putInt("studio/tracer_win_pos_h", tracerFrame.getHeight());
tracerFrame.dispose();
}
});
代码示例来源:origin: uk.co.caprica/vlcj
@Override
public void componentMoved(ComponentEvent e) {
listFrame.setLocation(mainFrame.getX() + mainFrame.getWidth() + 4, mainFrame.getY());
}
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
int numCols = conflictTable.getColumnCount();
for (int i = 0; i < numCols; i++)
uiMgr.putInt("studio/conflicts_col_width/" + i, conflictTable.getColumnModel().getColumn(i).getWidth());
uiMgr.putInt("studio/conflicts_win_pos_x", conflictsFrame.getX());
uiMgr.putInt("studio/conflicts_win_pos_y", conflictsFrame.getY());
uiMgr.putInt("studio/conflicts_win_pos_w", conflictsFrame.getWidth());
uiMgr.putInt("studio/conflicts_win_pos_h", conflictsFrame.getHeight());
conflictsFrame.dispose();
}
});
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
int numCols = breaksTable.getColumnCount();
for (int i = 0; i < numCols; i++)
uiMgr.putInt("studio/breaks_col_width/" + i, breaksTable.getColumnModel().getColumn(i).getWidth());
uiMgr.putInt("studio/breaks_win_pos_x", breakpointsFrame.getX());
uiMgr.putInt("studio/breaks_win_pos_y", breakpointsFrame.getY());
uiMgr.putInt("studio/breaks_win_pos_w", breakpointsFrame.getWidth());
uiMgr.putInt("studio/breaks_win_pos_h", breakpointsFrame.getHeight());
breakpointsFrame.dispose();
}
});
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
uiMgr.putInt("studio/uicomps_win_pos_x", uiCompsFrame.getX());
uiMgr.putInt("studio/uicomps_win_pos_y", uiCompsFrame.getY());
uiMgr.putInt("studio/uicomps_win_pos_w", uiCompsFrame.getWidth());
uiMgr.putInt("studio/uicomps_win_pos_h", uiCompsFrame.getHeight());
uiCompsFrame.dispose();
}
});
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
uiMgr.putInt("studio/diff_win_pos_x", diffFrame.getX());
uiMgr.putInt("studio/diff_win_pos_y", diffFrame.getY());
uiMgr.putInt("studio/diff_win_pos_w", diffFrame.getWidth());
uiMgr.putInt("studio/diff_win_pos_h", diffFrame.getHeight());
diffFrame.dispose();
}
});
代码示例来源:origin: google/sagetv
public void windowClosing(java.awt.event.WindowEvent evt)
{
// Ensure the debugger isn't paused/stepping
resumeExecution();
uiMgr.putInt("studio_win_pos_x", myFrame.getX());
uiMgr.putInt("studio_win_pos_y", myFrame.getY());
uiMgr.putInt("studio_win_pos_w", myFrame.getWidth());
uiMgr.putInt("studio_win_pos_h", myFrame.getHeight());
myFrame.dispose();
}
});
代码示例来源:origin: uk.co.caprica/vlcj
@Override
public void componentResized(ComponentEvent e) {
listFrame.setLocation(mainFrame.getX() + mainFrame.getWidth() + 4, mainFrame.getY());
listFrame.setSize(listFrame.getWidth(), mainFrame.getHeight());
}
代码示例来源:origin: robward-scisys/sldeditor
/**
* 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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!