本文整理了Java中java.awt.Window.getY()
方法的一些代码示例,展示了Window.getY()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.getY()
方法的具体详情如下:
包路径:java.awt.Window
类名称:Window
方法名:getY
暂无
代码示例来源:origin: skylot/jadx
public void saveWindowPos(Window window) {
WindowLocation pos = new WindowLocation(window.getClass().getSimpleName(),
window.getX(), window.getY(),
window.getWidth(), window.getHeight()
);
windowPos.put(pos.getWindowId(), pos);
partialSync(settings -> settings.windowPos = windowPos);
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
@Override
public void mouseDragged(MouseEvent e) {
Point newPos = e.getPoint();
SwingUtilities.convertPointToScreen(newPos, SizeGrip.this);
int xDelta = newPos.x - origPos.x;
int yDelta = newPos.y - origPos.y;
Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this);
if (wind!=null) { // Should always be true
if (getComponentOrientation().isLeftToRight()) {
int w = wind.getWidth();
if (newPos.x>=wind.getX()) {
w += xDelta;
}
int h = wind.getHeight();
if (newPos.y>=wind.getY()) {
h += yDelta;
}
wind.setSize(w,h);
}
else { // RTL
int newW = Math.max(1, wind.getWidth()-xDelta);
int newH = Math.max(1, wind.getHeight()+yDelta);
wind.setBounds(newPos.x, wind.getY(), newW, newH);
}
// invalidate()/validate() needed pre-1.6.
wind.invalidate();
wind.validate();
}
origPos.setLocation(newPos);
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
@Override
public void componentMoved(ComponentEvent e) {
setX(window.getX());
setY(window.getY());
}
});
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
int getY() {
if (isDesktopNotification) {
return parent.getY();
}
else {
return notifyCanvas.getY();
}
}
代码示例来源:origin: khuxtable/seaglass
@Override
public void mousePressed(MouseEvent e) {
Point clickPoint = new Point(e.getPoint());
SwingUtilities.convertPointToScreen(clickPoint, fComponent);
dX = clickPoint.x - fWindow.getX();
dY = clickPoint.y - fWindow.getY();
}
};
代码示例来源:origin: lbalazscs/Pixelitor
private static void saveFramePosition(Window window) {
int x = window.getX();
int y = window.getY();
int width = window.getWidth();
int height = window.getHeight();
mainNode.putInt(FRAME_X_KEY, x);
mainNode.putInt(FRAME_Y_KEY, y);
mainNode.putInt(FRAME_WIDTH_KEY, width);
mainNode.putInt(FRAME_HEIGHT_KEY, height);
}
代码示例来源:origin: org.jrobin/jrobin
static void placeWindow(Window window) {
int count = windows.size();
if (count == 0) {
centerOnScreen(window);
}
else {
Window last = windows.get(count - 1);
int x = last.getX() + WINDOW_POSITION_SHIFT;
int y = last.getY() + WINDOW_POSITION_SHIFT;
window.setLocation(x, y);
}
windows.add(window);
}
代码示例来源:origin: org.fusesource.rrd4j/rrd4j
static void placeWindow(Window window) {
int count = windows.size();
if (count == 0) {
centerOnScreen(window);
}
else {
Window last = windows.get(count - 1);
int x = last.getX() + WINDOW_POSITION_SHIFT;
int y = last.getY() + WINDOW_POSITION_SHIFT;
window.setLocation(x, y);
}
windows.add(window);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
public static void ensureWindowIsVisible( Window w )
{
int width = w.getWidth();
int height = w.getHeight();
Toolkit toolkit = Toolkit.getDefaultToolkit();
GraphicsConfiguration gc = w.getGraphicsConfiguration();
Insets screenInsets = toolkit.getScreenInsets( gc );
Rectangle screenSize = gc.getBounds();
w.setLocation( Math.max( screenInsets.left, Math.min( w.getX(), screenSize.width - screenInsets.right - width ) ),
Math.max( screenInsets.top, Math.min( w.getY(), screenSize.height - screenInsets.bottom - height ) ) );
}
代码示例来源:origin: sc.fiji/MTrackJ_
public void windowClosed(final WindowEvent e) {
if (lastpos == null) lastpos = new Point();
lastpos.x = e.getWindow().getX();
lastpos.y = e.getWindow().getY();
}
代码示例来源:origin: stackoverflow.com
Window currentWindow = ... ;
Point2D windowCenter = new Point2D(currentWindow.getX() + currentWindow.getWidth()/2,
currentWindow.getY() + currentWindow.getHeight()/2);
Screen currentScreen = Screen.getScreens().stream()
.filter(screen -> screen.getBounds().contains(windowCenter))
.findAny().get();
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInCurrentThread
static @Nonnull Point absoluteCenterOf(@Nonnull Window window) {
Insets insets = window.getInsets();
int w = window.getWidth() - (insets.left + insets.right);
int h = window.getHeight() - (insets.top + insets.bottom);
int x = window.getX() + insets.left;
int y = window.getY() + insets.top;
return new Point(x + (w / 2), y + (h / 2));
}
代码示例来源:origin: org.seamless/seamless-swing
public static Window center(Window w, Window reference) {
double refCenterX = reference.getX() + (reference.getSize().getWidth()/2);
double refCenterY = reference.getY() + (reference.getSize().getHeight()/2);
int newX = (int) (refCenterX - (w.getSize().getWidth()/2));
int newY = (int) (refCenterY - (w.getSize().getHeight()/2));
w.setLocation(newX, newY);
return w;
}
代码示例来源:origin: sc.fiji/TransformJ_
public void windowClosed(final WindowEvent e) {
position.x = e.getWindow().getX();
position.y = e.getWindow().getY();
}
代码示例来源:origin: sc.fiji/RandomJ_
public void windowClosed(final WindowEvent e) {
pos.x = e.getWindow().getX();
pos.y = e.getWindow().getY();
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public void windowClosing(WindowEvent e) {
filterWindowPrefs.putInt("x", e.getWindow().getX());
filterWindowPrefs.putInt("y", e.getWindow().getY());
filterWindowPrefs.putInt("width", e.getWindow().getWidth());
filterWindowPrefs.putInt("height", e.getWindow().getHeight());
}
});
代码示例来源:origin: bcdev/beam
@Override
public void windowClosing(WindowEvent e) {
preferences.putInt("x", e.getWindow().getX());
preferences.putInt("y", e.getWindow().getY());
preferences.putInt("width", e.getWindow().getWidth());
preferences.putInt("height", e.getWindow().getHeight());
}
});
代码示例来源:origin: sc.fiji/RandomJ_
public void windowClosed(final WindowEvent e) {
position.x = e.getWindow().getX();
position.y = e.getWindow().getY();
}
代码示例来源:origin: abbot/abbot
/** Returns whether one of the upper corners of the given window is
* accessible.
*/
public static boolean onScreen(Window w) {
return onScreen(w.getLocation())
|| onScreen(new Point(w.getX() + w.getWidth()-1, w.getY()));
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
/**
Each time this method is invoked, the position/size of the window which is
closing will be written to the FollowAppAttributes object.
*/
public void windowClosing (final WindowEvent e) {
final Window window = (Window)e.getSource();
attributes_.setWidth(window.getWidth());
attributes_.setHeight(window.getHeight());
attributes_.setX(window.getX());
attributes_.setY(window.getY());
}
内容来源于网络,如有侵权,请联系作者删除!