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

How to use
getHeight
method
in
java.awt.Window

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

origin: stackoverflow.com

 public static void centreWindow(Window frame) {
  Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
  int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
  int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
  frame.setLocation(x, y);
}
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: chewiebug/GCViewer

public void setVisible(boolean visible) {
  if (visible) {
    int x = (int) getOwner().getLocation().getX() + (getOwner().getWidth() / 2) - (getWidth() / 2);
    int y = (int) getOwner().getLocation().getY() + (getOwner().getHeight() / 2) - (getHeight() / 2);
    setLocation(adjustX(x), adjustY(y));
  }
  
  super.setVisible(visible);
}
origin: nodebox/nodebox

public static void centerOnScreen(Window w, Window parent) {
  Rectangle r = new Rectangle();
  if (parent == null) {
    r.setSize(Toolkit.getDefaultToolkit().getScreenSize());
  } else {
    r.setLocation(parent.getLocation());
    r.setSize(parent.getSize());
  }
  // Determine the new location of the alert
  int x = r.x + (r.width - w.getWidth()) / 2;
  int y = r.y + (r.height - w.getHeight()) / 2;
  // Move the alert
  w.setLocation(x, y);
}
origin: bobbylight/RSyntaxTextArea

/**
 * Updates the font metrics the first time we're displayed.
 */
@Override
public void addNotify() {
  super.addNotify();
  // Some LookAndFeels (e.g. WebLaF) for some reason have a 0x0 parent
  // window initially (perhaps something to do with them fading in?),
  // which will cause an exception from getGraphics(), so we must be
  // careful here.
  if (metricsNeverRefreshed) {
    Window parent = SwingUtilities.getWindowAncestor(this);
    if (parent!=null && parent.getWidth()>0 && parent.getHeight()>0) {
      refreshFontMetrics(getGraphics2D(getGraphics()));
      metricsNeverRefreshed = false;
    }
  }
  // Re-start parsing if we were removed from one container and added
  // to another
  if (parserManager!=null) {
    parserManager.restartParsing();
  }
}
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: apache/pdfbox

  @Override
  public void mouseClicked(MouseEvent e)
  {
    Window viewer = LogDialog.instance().getOwner();
    
    // show the log window
    LogDialog.instance().setSize(800, 400);
    LogDialog.instance().setVisible(true);
    LogDialog.instance().setLocation(viewer.getLocationOnScreen().x + viewer.getWidth() / 2,
                     viewer.getLocationOnScreen().y + viewer.getHeight() / 2);
  }
});
origin: org.bitbucket.goalhub.simpleide/jedit

private static Point fitInScreen(Point p, Window w, int lineHeight)
{
  Rectangle screenSize = w.getGraphicsConfiguration().getBounds();
  if(p.y + w.getHeight() >= screenSize.height)
    p.y = p.y - w.getHeight() - lineHeight;
  return p;
} //}}}
origin: net.java.abeille/abeille

/**
 * This method centers a window window and changes the width on the screen.
 * The caller must pass the x percentages of screen width. The height
 * remains unchanged
 */
public static void centerWindowChangeWidth(Window frame, float xpctWidth) {
  float height = (float) frame.getHeight();
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  float pctheight = height / (float) screenSize.getHeight();
  centerFrame(frame, xpctWidth, pctheight);
}
origin: org.apache.cayenne.modeler/cayenne-modeler

  @Override
  public void componentResized(ComponentEvent e) {
    setWidth(window.getWidth());
    setHeight(window.getHeight());
  }
});
origin: org.apache.cayenne.modeler/cayenne-modeler

@Override
public void componentResized(ComponentEvent e) {
  setWidth(window.getWidth());
  setHeight(window.getHeight());
}
origin: h3xstream/http-script-generator

private void centerWindow(Window frame) {
  Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
  int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
  int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
  frame.setLocation(x, y);
}
origin: jdfekete/geneaquilt

/**
 * Centers a window on the primary display
 */
public static void centerOnPrimaryScreen(Window toplevel) {
  Dimension screenRes = Toolkit.getDefaultToolkit().getScreenSize();
  toplevel.setLocation((screenRes.width - toplevel.getWidth()) / 2,
      (screenRes.height - toplevel.getHeight()) / 2);
}
origin: xyz.cofe/gui.swing

  @Override
  public void recive(Window wnd) {
    if( wnd==null )return;
    int cw = wnd.getWidth();
    int ch = wnd.getHeight();
    if( cw<w || ch<h ){
      int tw = Math.max(cw, w);
      int th = Math.max(ch, h);
      wnd.setSize(tw, th);
    }
  }
};
origin: stackoverflow.com

 public static void centreWindow(Window frame) {
  Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
  int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
  int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
  frame.setLocation(x, y);
}
origin: abbot/abbot

  /** We can't get any motion events on an empty frame. */
  private boolean isEmptyFrame(Window w) {
    Insets insets = AWT.getInsets(w);
    return insets.top + insets.bottom == w.getHeight()
      || insets.left + insets.right == w.getWidth();
  }
}
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: 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: robo-code/robocode

/**
 * Packs, centers, and shows the specified window on the screen.
 * @param window the window to pack, center, and show
 * @param center {@code true} if the window must be centered; {@code false} otherwise
 */
private void packCenterShow(Window window, boolean center) {
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  window.pack();
  if (center) {
    window.setLocation((screenSize.width - window.getWidth()) / 2, (screenSize.height - window.getHeight()) / 2);
  }
  window.setVisible(true);
}
origin: org.nuiton.jaxx/jaxx-widgets-about

public void display() {
  setSize((int)(getOwner().getWidth() * 0.7), (int)(getOwner().getHeight() * 0.7));
  SwingUtil.center(getOwner(), this);
  setVisible(true);
}
java.awtWindowgetHeight

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
  • setSize
  • setBounds
  • getBounds
  • removeWindowListener
    Removes the specified window listener so that it no longer receives window events from this window.
  • getGraphicsConfiguration
    This method returns the GraphicsConfiguration used by this Window.
  • removeWindowListener,
  • getGraphicsConfiguration,
  • isVisible,
  • addComponentListener,
  • getX,
  • 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
  • Github Copilot alternatives
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