本文整理了Java中javax.swing.JFrame.getLocation()
方法的一些代码示例,展示了JFrame.getLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getLocation()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getLocation
暂无
代码示例来源:origin: groovy/groovy-core
public void testListCoercionPropertyOnJFrame() throws Exception {
if (HeadlessTestSupport.isHeadless()) return;
try {
JFrame bean = new JFrame();
List list = new ArrayList();
list.add(new Integer(10));
list.add(new Integer(20));
InvokerHelper.setProperty(bean, "location", list);
assertEquals("Should have set a point", new Point(10, 20), bean.getLocation());
}
catch (MissingMethodException e) {
System.out.println("Failed with cause: " + e);
e.printStackTrace();
fail("Should not have throw: " + e);
}
}
代码示例来源:origin: RaiMan/SikuliX2
public Element whereShowing() {
return new Element(frame.getLocation().x, frame.getLocation().y, frame.getWidth(), frame.getHeight());
}
//</editor-fold>
代码示例来源:origin: sc.fiji/TrakEM2_
public Point getLocation() {
return frame.getLocation();
}
代码示例来源:origin: stackoverflow.com
JFrame frame; //your frame
int xAbs = frame.getLocation().x + xRel;
int yAbs = frame.getLocation().y + yRel;
代码示例来源:origin: MarginallyClever/Makelangelo-software
/**
* save window position and size
*/
private void saveWindowRealEstate() {
Dimension size = this.mainFrame.getSize();
preferences.putInt("Default window width", size.width);
preferences.putInt("Default window height", size.height);
Point location = this.mainFrame.getLocation();
preferences.putInt("Default window location x", location.x);
preferences.putInt("Default window location y", location.y);
}
代码示例来源:origin: com.thelastcheck.commons/tlc-commons-base
public static Point centerPoint(int width, int height, JFrame frame) {
Point point = null;
Dimension frameSize = frame.getSize();
Point framePoint = frame.getLocation();
point = new Point(framePoint.x + (frameSize.width / 2) - (width / 2),
framePoint.y + (frameSize.height / 2) - (height / 2));
return point;
}
代码示例来源:origin: antlr/antlrworks
public Point getLocation() {
if(useDesktop) {
return jInternalFrame.getLocation();
} else {
return jFrame.getLocation();
}
}
代码示例来源:origin: cpesch/RouteConverter
private void putPreferencesLocation() {
int x = frame.getLocation().x;
int y = frame.getLocation().y;
if(getPreferencesX() == x && getPreferencesY() == y)
return;
preferences.putInt(X_PREFERENCE, x);
preferences.putInt(Y_PREFERENCE, y);
log.info("Storing frame location as " + frame.getLocation());
String deviceId = frame.getGraphicsConfiguration().getDevice().getIDstring();
preferences.put(DEVICE_PREFERENCE, deviceId);
log.info("Storing graphics device as " + deviceId);
}
代码示例来源:origin: org.everit.osgi.dev/org.everit.osgi.dev.richconsole
@Override
public void mousePressed(final MouseEvent e) {
Point location = smallFrame.getLocation();
point.x = e.getXOnScreen() - (int) location.getX();
point.y = e.getYOnScreen() - (int) location.getY();
}
});
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@Override
public void mouseDragged(MouseEvent me) {
SwingUtilities.invokeLater(() -> {
if(!Lancador.getInstance().isMaximazed()){
JFrame frame = Lancador.getInstance().getJFrame();
frame.setLocation(frame.getLocation().x + me.getX() - pX,frame.getLocation().y + me.getY() - pY);
}
});
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("Test");
frame.setLocation(100, 100);
frame.setSize(500, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
// 'Invisible' fake component for positioning
JWindow c = new JWindow();
c.setSize(0, 0);
c.setVisible(true);
Point location = frame.getLocation();
location.translate(200, 100);
c.setLocation(location);
JOptionPane.showInputDialog(c,"Foo");
代码示例来源:origin: eu.mihosoft.vrl/vrl
/**
* @param parentFrame the parentFrame to set
*/
public void centerDialog(JFrame parentFrame) {
this.setLocation(
parentFrame.getLocation().x +
parentFrame.getWidth() / 2 - this.getWidth() / 2,
parentFrame.getLocation().y +
parentFrame.getHeight() / 2 - this.getHeight() / 2);
}
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@Override
public void mouseDragged(MouseEvent me) {
SwingUtilities.invokeLater(() -> {
if(!Lancador.getInstance().isMaximazed()){
JFrame frame = Lancador.getInstance().getJFrame();
frame.setLocation(frame.getLocation().x + me.getX() - PortugolStudio.getInstancia().getTelaPrincipal().pX,frame.getLocation().y + me.getY() - PortugolStudio.getInstancia().getTelaPrincipal().pY);
}
});
}
@Override
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@Override
public void mouseDragged(MouseEvent me) {
SwingUtilities.invokeLater(() -> {
if(!Lancador.getInstance().isMaximazed()){
JFrame frame = Lancador.getInstance().getJFrame();
frame.setLocation(frame.getLocation().x + me.getX() - pX,frame.getLocation().y + me.getY() - pY);
if(Lancador.getInstance().getQtdMonitores() == 1) {
Lancador.getInstance().snapToEdge(me);
}
}
});
}
});
代码示例来源:origin: GoldenGnu/jeveassets
private void setValuesFromSettings() {
jWidth.setText(String.valueOf(program.getMainWindow().getFrame().getSize().width));
jHeight.setText(String.valueOf(program.getMainWindow().getFrame().getSize().height));
jX.setText(String.valueOf(fixValue(program.getMainWindow().getFrame().getLocation().x)));
jY.setText(String.valueOf(fixValue(program.getMainWindow().getFrame().getLocation().y)));
jMaximized.setSelected(program.getMainWindow().getFrame().getState() == JFrame.MAXIMIZED_BOTH);
}
代码示例来源:origin: antlr/antlrworks
private static void saveDesktopBounds() {
Point pos = desktopFrame.getLocation();
Dimension s = desktopFrame.getSize();
Rectangle r = new Rectangle(pos.x, pos.y, s.width, s.height);
XJPreferences prefs = XJApplication.shared().getPreferences();
prefs.setObject(PREF_DESKTOP_BOUNDS, r);
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@Override
public void mouseDragged(MouseEvent me) {
SwingUtilities.invokeLater(() -> {
if(!Lancador.getInstance().isMaximazed()){
JFrame frame = Lancador.getInstance().getJFrame();
frame.setLocation(frame.getLocation().x + me.getX() - PortugolStudio.getInstancia().getTelaPrincipal().pX,frame.getLocation().y + me.getY() - PortugolStudio.getInstancia().getTelaPrincipal().pY);
if(Lancador.getInstance().getQtdMonitores() == 1) {
Lancador.getInstance().snapToEdge(me);
}
}
});
}
});
代码示例来源:origin: MegaMek/megamek
/**
* Saves the current settings to the cfg file.
*/
void saveSettings() {
// save frame location
GUIPreferences.getInstance().setWindowPosX(frame.getLocation().x);
GUIPreferences.getInstance().setWindowPosY(frame.getLocation().y);
GUIPreferences.getInstance().setWindowSizeWidth(frame.getSize().width);
GUIPreferences.getInstance().setWindowSizeHeight(frame.getSize().height);
}
代码示例来源:origin: org.rescarta.rc-cmgr/rc-cmgr
/**
* Writes the current configuration to disk.
*/
protected void writeConfig() {
try {
this.config.setRcCollectionsManagerJFrameSize(this.getJFrame().getSize());
this.config.setRcCollectionsManagerJFrameLocation(this.getJFrame().getLocation());
File configFile = RcFileUtils.getConfigFile(RcCollectionsManagerJPanel.CONFIG_FILE);
config.writeConfiguration(configFile);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: GoldenGnu/jeveassets
public void updateSettings() {
if (Settings.get().isWindowAutoSave()) {
Settings.get().setWindowMaximized(isMaximized());
if (!isMaximized()) {
Settings.get().setWindowSize(jFrame.getSize());
Settings.get().setWindowLocation(jFrame.getLocation());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!