congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Window.getX
Code IndexAdd Tabnine to your IDE (free)

How to use
getX
method
in
java.awt.Window

Best Java code snippets using java.awt.Window.getX (Showing top 20 results out of 333)

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 getX() {
  if (isDesktopNotification) {
    return parent.getX();
  }
  else {
    return notifyCanvas.getX();
  }
}
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: UNIVALI-LITE/Portugol-Studio

void setY(final int y) {
  if (isDesktopNotification) {
    parent.setLocation(parent.getX(), y);
  }
  else {
    notifyCanvas.setLocation(notifyCanvas.getX(), y);
  }
}
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: 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());
}
java.awtWindowgetX

Popular methods of Window

  • dispose
    Releases all of the native screen resources used by thisWindow, its subcomponents, and all of its ow
  • setVisible
  • setLocation
  • pack
    Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the wi
  • addWindowListener
    Adds the specified window listener to receive window events from this window. If l is null, no excep
  • getSize
  • getWidth
  • getHeight
  • setSize
  • setBounds
  • getBounds
  • removeWindowListener
    Removes the specified window listener so that it no longer receives window events from this window.
  • getBounds,
  • removeWindowListener,
  • getGraphicsConfiguration,
  • isVisible,
  • addComponentListener,
  • getY,
  • toFront,
  • getLocation,
  • removeComponentListener

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now