private void updateCursor(MouseEvent e) {
      Container component = getDisplayerParent();
      Insets insets = component.getInsets();

      boolean valid =
          e.getComponent() == component && e.getY() <= insets.top
              || e.getY() >= component.getHeight() - insets.bottom
              || e.getX() <= insets.left
              || e.getX() >= component.getWidth() - insets.right;

      if (valid) {
        int corner = corner();

        boolean top = e.getY() <= corner;
        boolean left = e.getX() <= corner;
        boolean bottom = e.getY() >= component.getHeight() - corner;
        boolean right = e.getX() >= component.getWidth() - corner;

        if (top && left) {
          setCursor(Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
          position = Position.NW;
        } else if (top && right) {
          setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
          position = Position.NE;
        } else if (bottom && right) {
          setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
          position = Position.SE;
        } else if (bottom && left) {
          setCursor(Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
          position = Position.SW;
        } else if (top) {
          int width = component.getWidth();
          if (getConfiguration().isMoveOnBorder()
              && e.getX() > width / 3
              && e.getX() < width / 3 * 2) {
            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            position = Position.MOVE;
          } else {
            setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
            position = Position.N;
          }
        } else if (bottom) {
          setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
          position = Position.S;
        } else if (left) {
          setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
          position = Position.W;
        } else if (right) {
          setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
          position = Position.E;
        } else {
          setCursor(Cursor.getDefaultCursor());
          position = Position.NOTHING;
        }
      } else {
        setCursor(Cursor.getDefaultCursor());
        position = Position.NOTHING;
      }
      updateBorder();
    }
      @Override
      public void mouseDragged(MouseEvent e) {
        if (!myDragging) return;
        MouseEvent event = SwingUtilities.convertMouseEvent(e.getComponent(), e, MyDivider.this);
        final ToolWindowAnchor anchor = myInfo.getAnchor();
        final Point point = event.getPoint();
        final Container windowPane = InternalDecorator.this.getParent();
        myLastPoint = SwingUtilities.convertPoint(MyDivider.this, point, windowPane);
        myLastPoint.x = Math.min(Math.max(myLastPoint.x, 0), windowPane.getWidth());
        myLastPoint.y = Math.min(Math.max(myLastPoint.y, 0), windowPane.getHeight());

        final Rectangle bounds = InternalDecorator.this.getBounds();
        if (anchor == ToolWindowAnchor.TOP) {
          InternalDecorator.this.setBounds(0, 0, bounds.width, myLastPoint.y);
        } else if (anchor == ToolWindowAnchor.LEFT) {
          InternalDecorator.this.setBounds(0, 0, myLastPoint.x, bounds.height);
        } else if (anchor == ToolWindowAnchor.BOTTOM) {
          InternalDecorator.this.setBounds(
              0, myLastPoint.y, bounds.width, windowPane.getHeight() - myLastPoint.y);
        } else if (anchor == ToolWindowAnchor.RIGHT) {
          InternalDecorator.this.setBounds(
              myLastPoint.x, 0, windowPane.getWidth() - myLastPoint.x, bounds.height);
        }
        InternalDecorator.this.validate();
        e.consume();
      }
Example #3
0
 public void ensureTableFill() {
   Container p = getParent();
   DefaultTableModel dataModel = (DefaultTableModel) dataTable.getModel();
   if (dataTable.getHeight() < p.getHeight()) {
     int newRows = (p.getHeight() - dataTable.getHeight()) / dataTable.getRowHeight();
     dataModel.setRowCount(dataTable.getRowCount() + newRows);
     for (int i = 0; i <= dataTable.getRowCount(); ++i) {
       if (rowHeader.getModel().getElementAt(i) != null)
         ((DefaultListModel) rowHeader.getModel()).add(i, true);
     }
   }
 }
Example #4
0
 public Object display() {
   Container parent = null;
   do {
     parent = this.getParent();
   } while (parent == null);
   return this.display(new Dimension(parent.getWidth(), parent.getHeight()));
 }
Example #5
0
  protected final synchronized void method3570(int var1) {
    Container var2 = this.method3583(685216356);
    if (null != Tile.aCanvas1875) {
      Tile.aCanvas1875.removeFocusListener(this);
      var2.remove(Tile.aCanvas1875);
    }

    Class42.clientWidth = Math.max(var2.getWidth(), Class145.anInt1650 * 2055757083) * -780223189;
    Class116_Sub16.clientHeight =
        Math.max(var2.getHeight(), -1066486805 * PlayerAlias.anInt1758) * 427958731;
    Insets var3;
    if (null != Class116_Sub23_Sub13.aFrame2425) {
      var3 = Class116_Sub23_Sub13.aFrame2425.getInsets();
      Class42.clientWidth -= -780223189 * (var3.left + var3.right);
      Class116_Sub16.clientHeight -= (var3.bottom + var3.top) * 427958731;
    }

    Tile.aCanvas1875 = new Canvas_Sub1(this);
    var2.add(Tile.aCanvas1875);
    Tile.aCanvas1875.setSize(
        -452716157 * Class42.clientWidth, Class116_Sub16.clientHeight * 674167779);
    Tile.aCanvas1875.setVisible(true);
    if (Class116_Sub23_Sub13.aFrame2425 == var2) {
      var3 = Class116_Sub23_Sub13.aFrame2425.getInsets();
      Tile.aCanvas1875.setLocation(
          var3.left + 76231581 * anInt2925, var3.top + anInt2920 * -225353991);
    } else {
      Tile.aCanvas1875.setLocation(76231581 * anInt2925, anInt2920 * -225353991);
    }

    Tile.aCanvas1875.addFocusListener(this);
    Tile.aCanvas1875.requestFocus();
    aBool2921 = true;
    int var4 = -452716157 * Class42.clientWidth;
    int var5 = 674167779 * Class116_Sub16.clientHeight;
    Canvas var6 = Tile.aCanvas1875;

    Object var10;
    try {
      DirectImageProducer var7 = new DirectImageProducer();
      var7.method337(var4, var5, var6, (byte) 1);
      var10 = var7;
    } catch (Throwable var9) {
      RSImageProducer var8 = new RSImageProducer();
      var8.method337(var4, var5, var6, (byte) 1);
      var10 = var8;
    }

    if (Class73.aAbstractRSDrawing_874 != null) {
      Class73.aAbstractRSDrawing_874.method333(
          ((AbstractRSDrawing) var10).finalImage.getGraphics(), 0, 0, -819332484);
    }

    Class73.aAbstractRSDrawing_874 = (AbstractRSDrawing) var10;
    aBool2924 = false;
    aLong2927 = Class116_Sub5.method1929(-1730340736) * -2460302806870968417L;
  }
 @Override
 public void layoutContainer(Container parent) {
   int width = parent.getWidth();
   int height = parent.getHeight();
   Component toolbar = parent.getComponent(0);
   Dimension toolbarSize = toolbar.isVisible() ? toolbar.getPreferredSize() : new Dimension();
   toolbar.setBounds(0, 0, width, toolbarSize.height);
   parent.getComponent(1).setBounds(0, toolbarSize.height, width, height - toolbarSize.height);
 }
    public void layoutContainer(Container parent) {
      final Insets insets = parent.getInsets();
      int x = insets.left;
      int y = insets.top;

      // place the icon
      if (iconLabel != null) {
        Dimension dim = iconLabel.getPreferredSize();
        iconLabel.setBounds(x, y, dim.width, dim.height);
        x += dim.width + 17;
        int leftEdge = x;

        // place the error message
        dummy.setContentType(errorMessage.getContentType());
        dummy.setText(errorMessage.getText());
        dummy.setSize(parent.getWidth() - leftEdge - insets.right, 20);
        dim = dummy.getPreferredSize();
        int spx = x;
        int spy = y;
        Dimension spDim = new Dimension(parent.getWidth() - leftEdge - insets.right, dim.height);
        y += dim.height + 10;
        int rightEdge = parent.getWidth() - insets.right;
        x = rightEdge;
        dim = detailButton.getPreferredSize(); // all buttons should be the same height!
        int buttonY = y + 5;
        if (detailButton.isVisible()) {
          dim = detailButton.getPreferredSize();
          x -= dim.width;
          detailButton.setBounds(x, buttonY, dim.width, dim.height);
        }
        if (detailButton.isVisible()) {
          detailButton.setBounds(x, buttonY, dim.width, dim.height);
        }
        errorScrollPane.setBounds(spx, spy, spDim.width, buttonY - spy);
        if (reportButton.isVisible()) {
          dim = reportButton.getPreferredSize();
          x -= dim.width;
          x -= 5;
          reportButton.setBounds(x, buttonY, dim.width, dim.height);
        }

        dim = closeButton.getPreferredSize();
        x -= dim.width;
        x -= 5;
        closeButton.setBounds(x, buttonY, dim.width, dim.height);

        // if the dialog is expanded...
        if (detailsPanel.isVisible()) {
          // layout the details
          y = buttonY + dim.height + 6;
          x = leftEdge;
          int width = rightEdge - x;
          detailsPanel.setBounds(x, y, width, parent.getHeight() - (y + insets.bottom));
        }
      }
    }
 /** @param parent */
 public void layoutContainer(Container parent) {
   Insets insets = parent.getInsets();
   for (int index = 0; index < parent.getComponentCount(); index++) {
     Component comp = parent.getComponent(index);
     comp.setLocation(insets.left, insets.top);
     comp.setSize(
         parent.getWidth() - insets.left - insets.right,
         parent.getHeight() - insets.top - insets.bottom);
   }
 }
  @Override
  public void layoutContainer(Container parent) {

    if (parent != container) {
      throw new LayoutException(
          "All layout operations must occur upon this manager's parent container");
    }

    paraboxLayout.doLayout(parent.getWidth(), parent.getHeight(), parent.getComponents());
  }
Example #10
0
 public void layoutContainer(Container parent) {
   Insets insets = parent.getInsets();
   if (parent.getComponentOrientation().isLeftToRight()) {
     int x = insets.left;
     for (Component component : parent.getComponents()) {
       Dimension ps = component.getPreferredSize();
       component.setBounds(
           x, insets.top, ps.width, parent.getHeight() - insets.top - insets.bottom);
       x += ps.width - overlap;
     }
   } else {
     int x = parent.getWidth() - insets.right;
     for (Component component : parent.getComponents()) {
       Dimension ps = component.getPreferredSize();
       component.setBounds(
           x - ps.width, insets.top, ps.width, parent.getHeight() - insets.top - insets.bottom);
       x += overlap - ps.width;
     }
   }
 }
Example #11
0
 public int getHeight() {
   float fHeight;
   int height;
   fHeight = scale * nativeGetMaxDepth();
   height = Math.round(fHeight) + (2 * margin);
   if (parentContainer == null) {
     return height;
   } else {
     return FTAUtilities.max(height, parentContainer.getHeight());
   }
 }
    private int corner() {
      Container component = getDisplayerParent();
      Insets insets = component.getInsets();

      int corner =
          Math.max(Math.max(insets.top, insets.bottom), Math.max(insets.left, insets.right)) * 5;
      corner = Math.max(25, Math.min(50, corner));

      corner = Math.min(Math.min(component.getHeight() / 2, component.getWidth() / 3), corner);
      return corner;
    }
Example #13
0
 @Override
 public boolean getScrollableTracksViewportHeight() {
   Container parent = getParent();
   if (parent instanceof JViewport) {
     int height = parent.getHeight();
     Dimension min = getMinimumSize();
     Dimension max = getMaximumSize();
     return height >= min.height && height <= max.height;
   }
   return false;
 }
Example #14
0
  private void posicionaLabel() {

    int x = lastAcessible.getX() + lastAcessible.getWidth() + 3;
    int y = ((int) (lastAcessible.getHeight() + 16) / 2) + lastAcessible.getY() - 16;
    //        label.setLocation(x, control.getY());
    //        label.setLocation(0,0);
    label.setLabelFor(control);
    label.setBounds(x, y, 16, 16);
    //        ((JTextArea) control).setJComponentZOrder(label, 1);
    //            label.setLocation(Integer.parseInt(JOptionPane.showInputDialog("x")),
    // Integer.parseInt(JOptionPane.showInputDialog("y")));
  }
 private static void renderPng(final Container src, final File dst) throws IOException {
   final BufferedImage img =
       new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_ARGB);
   final Graphics g = img.getGraphics();
   try {
     // SwingUtilities.paintComponent(g, src, src.getBounds(), null);
     src.paintAll(g);
   } finally {
     g.dispose();
   }
   ImageIO.write(img, "png", dst);
 }
Example #16
0
  protected Dimension method3584(byte var1) {
    Container var2 = this.method3583(1432588210);
    int var3 = Math.max(var2.getWidth(), 2055757083 * Class145.anInt1650);
    int var5 = Math.max(var2.getHeight(), PlayerAlias.anInt1758 * -1066486805);
    if (Class116_Sub23_Sub13.aFrame2425 != null) {
      Insets var4 = Class116_Sub23_Sub13.aFrame2425.getInsets();
      var3 -= var4.left + var4.right;
      var5 -= var4.bottom + var4.top;
    }

    return new Dimension(var3, var5);
  }
Example #17
0
  /**
   * Lays out the container in the specified container.
   *
   * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
   */
  public void layoutContainer(Container cont) {
    int numComps = cont.getComponentCount();

    if (numComps <= 0) return;

    calcLayoutSize(cont);
    Insets insets = cont.getInsets();

    int x = Math.max(insets.left, (cont.getWidth() - minWidth) / 2);
    for (int i = 0; i < numComps; i++) {
      Component c = cont.getComponent(i);
      Dimension prfDim = c.getPreferredSize();
      Dimension maxDim = c.getMaximumSize();

      int y;
      if (maxDim.getHeight() >= cont.getHeight()) {
        y = 0;
      } else {
        float baseline;
        if (c instanceof FormulaElement) baseline = ((FormulaElement) c).getBaseline();
        else baseline = (float) prfDim.getHeight() * c.getAlignmentY();
        y = Math.round(maxAscend - baseline) + insets.top;
      }

      int w = prfDim.width;
      int h = Math.min(maxDim.height, cont.getHeight());

      c.setBounds(x, y, w, h);
      x += w;

      if (i < numComps - 1) {
        x += hgap;
        Component cNext = cont.getComponent(i + 1);
        if ((c instanceof FormulaElement) && (cNext instanceof FormulaElement))
          x += getSpacing((FormulaElement) c, (FormulaElement) cNext);
      }
    }
  }
Example #18
0
  /** {@inheritDoc} */
  public void layoutContainer(final Container parent) {
    synchronized (parent.getTreeLock()) {
      int width = parent.getWidth();
      int height = parent.getHeight();

      Rectangle bounds = new Rectangle(0, 0, width, height);

      int componentsCount = components.size();

      for (int i = 0; i < componentsCount; i++) {
        Component comp = components.get(i);
        comp.setBounds(bounds);
        parent.setComponentZOrder(comp, componentsCount - i - 1);
      }
    }
  }
Example #19
0
  /*
   * (non-Javadoc)
   *
   * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
   */
  @Override
  public void layoutContainer(final Container c) {
    final Insets in = c.getInsets();
    final int x1 = in.left;
    final int x2 = c.getWidth() - in.right;
    final int y1 = in.top;
    final int y2 = c.getHeight() - in.bottom;
    final Dimension dim = new Dimension(x2 - x1, y2 - y1);

    // System.out.println(dim + " " + c.getWidth() + " " + c.getHeight());
    doRohu(sz, dim, x1, y1);
    doRohu(jz, dim, x1, -y2);
    doRohu(sv, dim, -x2, y1);
    doRohu(jv, dim, -x2, -y2);

    podklad.setBounds(x1, y1, dim.width, dim.height);
  }
Example #20
0
  public void layoutContainer(Container target) {
    Insets insets = target.getInsets();
    int width = (_width > 0 ? _width : target.getWidth()) - insets.left - insets.right;
    int height = target.getHeight() - insets.top - insets.bottom;
    int x = insets.left;
    int y = insets.top;

    PgmPanel[] ps =
        Arrays.copyOf(target.getComponents(), target.getComponentCount(), PgmPanel[].class);
    _descComparator.setOriginDate(System.currentTimeMillis());
    Arrays.sort(ps, _descComparator);
    for (PgmPanel p : ps) {
      p.setWidth(width);
      int h = p.getPreferredSize().height;
      p.setBounds(x, y, width, h);
      y += h + SEPARATOR_THICKNESS;
    }
  }
Example #21
0
  @Override
  public void layoutContainer(Container target) {

    synchronized (target.getTreeLock()) {
      Insets insets = target.getInsets();

      int top = insets.top;

      int bottom = target.getHeight() - insets.bottom;

      int left = insets.left;

      int right = target.getWidth() - insets.right;

      northHeight = getPreferredDimension(north).height;

      southHeight = getPreferredDimension(south).height;

      eastWidth = getPreferredDimension(east).width;

      westWidth = getPreferredDimension(west).width;

      placeComponents(target, north, left, top, right - left, northHeight, TOP);

      top += (northHeight + getVgap());

      placeComponents(target, south, left, bottom - southHeight, right - left, southHeight, BOTTOM);

      bottom -= (southHeight + getVgap());

      placeComponents(target, east, right - eastWidth, top, eastWidth, bottom - top, RIGHT);

      right -= (eastWidth + getHgap());

      placeComponents(target, west, left, top, westWidth, bottom - top, LEFT);

      left += (westWidth + getHgap());

      if (center != null) {

        center.setBounds(left, top, right - left, bottom - top);
      }
    }
  }
    /**
     * The preferred size is: The width of the parent container The height necessary to show the
     * entire message text (as long as said height does not go off the screen) plus the buttons
     *
     * <p>The preferred height changes depending on whether the details are visible, or not.
     */
    public Dimension preferredLayoutSize(Container parent) {
      int prefWidth = parent.getWidth();
      int prefHeight = parent.getHeight();
      final Insets insets = parent.getInsets();
      int pw = detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
      pw += detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
      pw += reportButton.isVisible() ? (5 + reportButton.getPreferredSize().width) : 0;
      pw += closeButton.isVisible() ? (5 + closeButton.getPreferredSize().width) : 0;
      prefWidth = Math.max(prefWidth, pw) + insets.left + insets.right;
      if (errorMessage != null) {
        // set a temp editor to a certain size, just to determine what its
        // pref height is
        dummy.setContentType(errorMessage.getContentType());
        dummy.setEditorKit(errorMessage.getEditorKit());
        dummy.setText(errorMessage.getText());
        dummy.setSize(prefWidth, 20);
        int errorMessagePrefHeight = dummy.getPreferredSize().height;

        prefHeight =
            // the greater of the error message height or the icon height
            Math.max(errorMessagePrefHeight, iconLabel.getPreferredSize().height)
                +
                // the space between the error message and the button
                10
                +
                // the button preferred height
                closeButton.getPreferredSize().height;

        if (detailsPanel.isVisible()) {
          prefHeight += getDetailsHeight();
        }
      }

      if (iconLabel != null && iconLabel.getIcon() != null) {
        prefWidth += iconLabel.getIcon().getIconWidth();
        prefHeight += 10; // top of icon is positioned 10px above the text
      }

      return new Dimension(
          prefWidth + insets.left + insets.right, prefHeight + insets.top + insets.bottom);
    }
Example #23
0
    public void layoutContainer(Container parent) {
      synchronized (parent.getTreeLock()) {
        Insets margin = parent.getInsets();
        int x = margin.left;
        int y = margin.top;
        int w = parent.getWidth() - (margin.left + margin.right);
        int h = parent.getHeight() - (margin.top + margin.bottom);
        Component header = findHeader(parent.getComponents());
        if (header != null && header.isVisible()) {
          Dimension dim = header.getPreferredSize();
          header.setBounds(x, y, w, dim.height);
          y += dim.height;
          h -= dim.height;
        }

        Component body = findBody(parent.getComponents());
        if (body != null && body.isVisible()) {
          body.setBounds(x, y, w, h);
        }
      }
    }
Example #24
0
  /**
   * Lays out the container argument using this border layout.
   *
   * <p>This method actually reshapes the components in the specified container in order to satisfy
   * the constraints of this <code>BorderLayout</code> object. The <code>NORTH</code> and <code>
   * SOUTH</code> components, if any, are placed at the top and bottom of the container,
   * respectively. The <code>WEST</code> and <code>EAST</code> components are then placed on the
   * left and right, respectively. Finally, the <code>CENTER</code> object is placed in any
   * remaining space in the middle.
   *
   * <p>Most applications do not call this method directly. This method is called when a container
   * calls its <code>doLayout</code> method.
   *
   * @param target the container in which to do the layout.
   * @see java.awt.Container
   * @see java.awt.Container#doLayout()
   */
  public void layoutContainer(Container target) {
    synchronized (target.getTreeLock()) {
      Insets insets = target.getInsets();
      int top = insets.top;
      int bottom = target.getHeight() - insets.bottom;
      int left = insets.left;
      int right = target.getWidth() - insets.right;

      boolean ltr = target.getComponentOrientation().isLeftToRight();
      Component c = null;

      if ((c = getChild(NORTH, ltr)) != null) {
        c.setSize(right - left, c.getHeight());
        Dimension d = c.getPreferredSize();
        c.setBounds(left, top, right - left, d.height);
        top += d.height + vgap;
      }
      if ((c = getChild(SOUTH, ltr)) != null) {
        c.setSize(right - left, c.getHeight());
        Dimension d = c.getPreferredSize();
        c.setBounds(left, bottom - d.height, right - left, d.height);
        bottom -= d.height + vgap;
      }
      if ((c = getChild(EAST, ltr)) != null) {
        c.setSize(c.getWidth(), bottom - top);
        Dimension d = c.getPreferredSize();
        c.setBounds(right - d.width, top, d.width, bottom - top);
        right -= d.width + hgap;
      }
      if ((c = getChild(WEST, ltr)) != null) {
        c.setSize(c.getWidth(), bottom - top);
        Dimension d = c.getPreferredSize();
        c.setBounds(left, top, d.width, bottom - top);
        left += d.width + hgap;
      }
      if ((c = getChild(CENTER, ltr)) != null) {
        c.setBounds(left, top, right - left, bottom - top);
      }
    }
  }
Example #25
0
 @Override
 public Dimension getPreferredSize() {
   getUI().getRootView(this).setSize(0, 0);
   Dimension d = super.getPreferredSize();
   Container parent = getParent();
   if (parent instanceof JViewport) {
     Dimension min = getMinimumSize();
     if (!getScrollableTracksViewportWidth()) {
       int width = parent.getWidth();
       if (width < min.width) {
         d.width = min.width;
       }
     }
     if (!getScrollableTracksViewportHeight()) {
       int height = parent.getHeight();
       if (height < min.height) {
         d.height = min.height;
       }
     }
   }
   return d;
 }
  @Override
  public void layoutContainer(java.awt.Container target) {
    synchronized (target.getTreeLock()) {
      java.awt.Insets insets = target.getInsets();
      int top = insets.top;
      int left = insets.left;
      int bottom = target.getHeight() - insets.bottom;
      int right = target.getWidth() - insets.right;

      int width = right - left;
      int bottomHeight;
      if (bottomComponent != null) {
        bottomComponent.setSize(width, bottomComponent.getHeight());
        java.awt.Dimension d = bottomComponent.getPreferredSize();
        bottomHeight = d.height;
      } else {
        bottomHeight = 0;
      }

      if (this.mainComponent != null) {
        this.mainComponent.setSize(width, this.mainComponent.getHeight());
        java.awt.Dimension d = this.mainComponent.getPreferredSize();
        if (this.mainComponent instanceof javax.swing.JScrollPane) {
          javax.swing.JScrollPane jScrollPane = (javax.swing.JScrollPane) this.mainComponent;
          if (d.width > (right - left)) {
            d.height += jScrollPane.getHorizontalScrollBar().getPreferredSize().height;
          }
        }

        d.height = Math.min(d.height, bottom - top - bottomHeight);

        this.mainComponent.setBounds(left, top, width, d.height);
        top += d.height + vGap;
      }
      if (bottomComponent != null) {
        bottomComponent.setBounds(left, top, width, bottomHeight);
      }
    }
  }
Example #27
0
  public void btnChoose_actionPerformed() {
    //            java.awt.Rectangle r = dateField.getBounds();
    //            Point pOnScreen = dateField.getLocationOnScreen();
    java.awt.Rectangle r = Jtext.getBounds();
    Point pOnScreen = Jtext.getLocationOnScreen();

    Point result = new Point(pOnScreen.x, pOnScreen.y + r.height);
    Point powner = owner.getLocation();
    int offsetX = (pOnScreen.x + width) - (powner.x + owner.getWidth());
    int offsetY = (pOnScreen.y + r.height + height) - (powner.y + owner.getHeight());

    if (offsetX > 0) {
      result.x -= offsetX;
    }

    if (offsetY > 0) {
      result.y -= height + r.height;
    }

    javax.swing.JDialog dateFrame = new javax.swing.JDialog();
    dateFrame.setModal(false);
    dateFrame.setUndecorated(true);
    dateFrame.setLocation(result);
    dateFrame.setSize(width, height);

    dateFrame.addWindowListener(
        new WindowAdapter() {
          // 鍦ㄤ换鎰忕殑闈炴棩鏈熼�夋嫨鍖哄崟鍑伙紝鍒欐棩鏈熼�夋嫨缁勪欢灏嗗彉涓洪潪娲诲姩鐘舵�侊紝鑷姩閲婃斁璧勬簮銆�
          public void windowDeactivated(WindowEvent e) {
            javax.swing.JDialog f = (javax.swing.JDialog) e.getSource();
            f.dispose();
          }
        });
    DatePanel datePanel = new DatePanel(dateFrame, parten);
    dateFrame.getContentPane().setLayout(new BorderLayout());
    dateFrame.getContentPane().add(datePanel);
    dateFrame.setVisible(true);
  }
  /**
   * Makes a guess how big the insets of the {@link Dockable} compared to the whole dialog are.
   *
   * @return the insets, only a guess
   */
  public Insets getDockableInsets() {
    Container parent = getDisplayerParent();
    Insets parentInsets = parent.getInsets();
    if (parentInsets == null) parentInsets = new Insets(0, 0, 0, 0);

    Point zero = new Point(0, 0);
    zero = SwingUtilities.convertPoint(parent, zero, window);

    parentInsets.left += zero.x;
    parentInsets.top += zero.y;
    parentInsets.right += window.getWidth() - parent.getWidth() - zero.x;
    parentInsets.bottom += window.getHeight() - parent.getHeight() - zero.y;

    if (displayer == null) return parentInsets;

    Insets insets = displayer.getDockableInsets();
    parentInsets.top += insets.top;
    parentInsets.bottom += insets.bottom;
    parentInsets.left += insets.left;
    parentInsets.right += insets.right;

    return parentInsets;
  }
 public void layoutContainer(Container paramContainer) {
   synchronized (paramContainer.getTreeLock()) {
     checkCache(paramContainer);
     Insets localInsets = paramContainer.getInsets();
     int[] arrayOfInt = {
       localInsets.left,
       localInsets.top,
       paramContainer.getWidth() - localInsets.left - localInsets.right,
       paramContainer.getHeight() - localInsets.top - localInsets.bottom
     };
     if (this.grid.layout(
         arrayOfInt, this.lc.getAlignX(), this.lc.getAlignY(), getDebug(), true)) {
       this.grid = null;
       checkCache(paramContainer);
       this.grid.layout(arrayOfInt, this.lc.getAlignX(), this.lc.getAlignY(), getDebug(), false);
     }
     long l = this.grid.getHeight()[1] + (this.grid.getWidth()[1] << 32);
     if (this.lastSize != l) {
       this.lastSize = l;
       ContainerWrapper localContainerWrapper = checkParent(paramContainer);
       Window localWindow =
           (Window)
               SwingUtilities.getAncestorOfClass(
                   Window.class, (Component) localContainerWrapper.getComponent());
       if (localWindow != null)
         if (localWindow.isVisible())
           SwingUtilities.invokeLater(
               new Runnable(localContainerWrapper) {
                 public void run() {
                   MigLayout.this.adjustWindowSize(this.val$containerWrapper);
                 }
               });
         else adjustWindowSize(localContainerWrapper);
     }
     this.lastInvalidSize = null;
   }
 }
Example #30
0
 // -------------- maxY() ----------------------
 private int maxY() {
   return (int) (_parent.getY() + _parent.getHeight() - this.getHeight());
 }