public void doLayout() {
   if (view != null) {
     view.setSize(view.getPreferredSize());
     visibleRect = getVisibleRect();
     view.setLocation(visibleRect.x, visibleRect.y);
   }
   glassPane.setLocation(0, 0);
   glassPane.setSize(getWidth(), getHeight());
 }
 public static void setRelativeBounds(
     @NotNull Component parent,
     @NotNull Rectangle bounds,
     @NotNull Component child,
     @NotNull Container validationParent) {
   validationParent.add(parent);
   parent.setBounds(bounds);
   parent.validate();
   child.setLocation(SwingUtilities.convertPoint(child, 0, 0, parent));
   validationParent.remove(parent);
 }
Esempio n. 3
0
 private static void locateOnScreen(Component component) {
   Dimension paneSize = component.getSize();
   Dimension screenSize = component.getToolkit().getScreenSize();
   component.setLocation(
       (screenSize.width - paneSize.width) / 2, (screenSize.height - paneSize.height) / 2);
 }