private void setHeaderComponent(JComponent c) {
    boolean doRevalidate = false;
    if (myHeaderComponent != null) {
      myHeaderPanel.remove(myHeaderComponent);
      myHeaderPanel.add(myCaption, BorderLayout.NORTH);
      myHeaderComponent = null;
      doRevalidate = true;
    }

    if (c != null) {
      myHeaderPanel.remove(myCaption);
      myHeaderPanel.add(c, BorderLayout.NORTH);
      myHeaderComponent = c;

      final Dimension size = myContent.getSize();
      if (size.height < c.getPreferredSize().height * 2) {
        size.height += c.getPreferredSize().height;
        setSize(size);
      }

      doRevalidate = true;
    }

    if (doRevalidate) myContent.revalidate();
  }
  private static boolean fitsLayeredPane(
      JLayeredPane pane, JComponent component, RelativePoint desiredLocation, HintHint hintHint) {
    if (hintHint.isAwtTooltip()) {
      Dimension size = component.getPreferredSize();
      Dimension paneSize = pane.getSize();

      Point target = desiredLocation.getPointOn(pane).getPoint();
      Balloon.Position pos = hintHint.getPreferredPosition();
      int pointer = BalloonImpl.getPointerLength(pos, false) + BalloonImpl.getNormalInset();
      if (pos == Balloon.Position.above || pos == Balloon.Position.below) {
        boolean heightFit =
            target.y - size.height - pointer > 0
                || target.y + size.height + pointer < paneSize.height;
        return heightFit && size.width + pointer < paneSize.width;
      } else {
        boolean widthFit =
            target.x - size.width - pointer > 0 || target.x + size.width + pointer < paneSize.width;
        return widthFit && size.height + pointer < paneSize.height;
      }
    } else {
      final Rectangle lpRect =
          new Rectangle(
              pane.getLocationOnScreen().x,
              pane.getLocationOnScreen().y,
              pane.getWidth(),
              pane.getHeight());
      Rectangle componentRect =
          new Rectangle(
              desiredLocation.getScreenPoint().x,
              desiredLocation.getScreenPoint().y,
              component.getPreferredSize().width,
              component.getPreferredSize().height);
      return lpRect.contains(componentRect);
    }
  }
 /** Synchronize content and header sizes. */
 private void setMaxWidth(JComponent content, JComponent header) {
   int c_width = content.getPreferredSize().width;
   int h_width = header.getPreferredSize().width;
   if (c_width > h_width) {
     header.setPreferredSize(new Dimension(c_width, header.getPreferredSize().height));
   } else {
     content.setPreferredSize(new Dimension(h_width, content.getPreferredSize().height));
   }
 }
 @Override
 public Insets getBorderInsets(Component c) {
   Dimension size = comp.getPreferredSize();
   Insets insets = border.getBorderInsets(c);
   insets.top = Math.max(insets.top, size.height);
   return insets;
 }
 public static JComponent constrainHeight(JComponent component) {
   int preferredWidth = component.getPreferredSize().width;
   component.setPreferredSize(new Dimension(preferredWidth, s_maxButtonHeight));
   component.setMaximumSize(new Dimension(2048, s_maxButtonHeight));
   component.setMinimumSize(new Dimension(preferredWidth, s_maxButtonHeight));
   return component;
 }
示例#6
0
    /**
     * Instructs the layout manager to perform the layout for the specified container.
     *
     * @param the Container for which this layout manager is being used
     */
    public void layoutContainer(Container parent) {
      JRootPane root = (JRootPane) parent;
      Rectangle b = root.getBounds();
      Insets i = root.getInsets();
      int nextY = 0;
      int w = b.width - i.right - i.left;
      int h = b.height - i.top - i.bottom;

      if (root.getLayeredPane() != null) {
        root.getLayeredPane().setBounds(i.left, i.top, w, h);
      }
      if (root.getGlassPane() != null) {
        root.getGlassPane().setBounds(i.left, i.top, w, h);
      }
      // Note: This is laying out the children in the layeredPane,
      // technically, these are not our children.
      if (root.getWindowDecorationStyle() != JRootPane.NONE
          && (root.getUI() instanceof RootPaneUI)) {
        JComponent titlePane = ((RootPaneUI) root.getUI()).getTitlePane();
        if (titlePane != null) {
          Dimension tpd = titlePane.getPreferredSize();
          if (tpd != null) {
            int tpHeight = tpd.height;
            titlePane.setBounds(0, 0, w, tpHeight);
            nextY += tpHeight;
          }
        }
      }

      if (root.getContentPane() != null) {

        root.getContentPane().setBounds(0, nextY, w, h < nextY ? 0 : h - nextY);
      }
    }
示例#7
0
    /**
     * Returns the amount of space the layout would like to have.
     *
     * @param the Container for which this layout manager is being used
     * @return a Dimension object containing the layout's preferred size
     */
    public Dimension preferredLayoutSize(Container parent) {
      Dimension cpd, tpd;
      int cpWidth = 0;
      int cpHeight = 0;
      int mbWidth = 0;
      int mbHeight = 0;
      int tpWidth = 0;
      Insets i = parent.getInsets();
      JRootPane root = (JRootPane) parent;

      if (root.getContentPane() != null) {
        cpd = root.getContentPane().getPreferredSize();
      } else {
        cpd = root.getSize();
      }
      if (cpd != null) {
        cpWidth = cpd.width;
        cpHeight = cpd.height;
      }

      if (root.getWindowDecorationStyle() != JRootPane.NONE
          && (root.getUI() instanceof RootPaneUI)) {
        JComponent titlePane = ((RootPaneUI) root.getUI()).getTitlePane();
        if (titlePane != null) {
          tpd = titlePane.getPreferredSize();
          if (tpd != null) {
            tpWidth = tpd.width;
          }
        }
      }

      return new Dimension(
          Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right,
          cpHeight + mbHeight + tpWidth + i.top + i.bottom);
    }
示例#8
0
  public void showDialog(JComponent dialog) {
    closeDialog();

    JRootPane rootPane = SwingUtilities.getRootPane(mainPanel);
    if (rootPane == null) {
      log.severe("could not find root pane for viewer to show dialog " + dialog);
    } else {
      JLayeredPane layeredPane = rootPane.getLayeredPane();
      Dimension d = dialog.getPreferredSize();
      if (dialogPanel == null) {
        dialogPanel = new DialogPanel(this, new BorderLayout());
      }
      Insets insets = dialogPanel.getInsets();
      int width = viewerPanel.getWidth() - insets.left - insets.right;
      int height = viewerPanel.getHeight() - insets.top - insets.bottom;
      if (d.width > width) {
        d.width = width;
      }
      if (d.height > height) {
        d.height = height;
      }
      dialogPanel.add(dialog, BorderLayout.CENTER);

      dialogPanel.setBounds(
          ((width - d.width) >> 1) + insets.left,
          ((height - d.height) >> 1) + insets.top,
          d.width + insets.left + insets.right,
          d.height + insets.top + insets.bottom);
      dialog.setVisible(true);
      layeredPane.add(dialogPanel, DIALOG_LAYER);
      currentDialog = dialog;
      mainPanel.repaint();
    }
  }
示例#9
0
  public ListOptionTest() {
    model = new ExampleClass();
    init();

    DependencyNode node1 = new EngineNode<String>(1, "test1");

    OptionPanel p1 = new PanelImpl("Test", OptionPanel.LayoutPolicy.VerticalBlocks, 4);
    p1.add(
        new TextOption("name1", "toolTip1", model, "name", TextOption.ExpectedLength.SHORT, node1));
    p1.add(
        new TextOption("name2", "toolTip2", model, "name", TextOption.ExpectedLength.SHORT, node1));
    p1.add(new ListOption<String>("list1", "toolTip3", model, "list", String.class, node1));
    p1.add(
        new ListOption<String>("list2", "toolTip4", model, "list", String.class, node1) {
          int cosa = 1;

          @Override
          public String chooseElementToAdd() {
            return "Elemento " + (++cosa);
          }
        });

    controller.getModel().addModelListener(p1);
    JComponent internal = p1.getComponent(commandManager);
    System.err.println("Internal size demanded: " + internal.getPreferredSize());
    childPanel.add(internal, BorderLayout.CENTER);
    System.err.println("Total size demanded: " + childPanel.getPreferredSize());
  }
 public Dimension getInnerSize() {
   boolean mustSort = this.mustSort;
   this.mustSort = false;
   Dimension d = scrollEnabled ? componentBox.getPreferredSize() : componentBox.getSize();
   this.mustSort = mustSort;
   return d;
 }
示例#11
0
    QuickDocInfoPane(
        @NotNull PsiElement documentationAnchor,
        @NotNull PsiElement elementUnderMouse,
        @NotNull JComponent baseDocControl) {
      myBaseDocControl = baseDocControl;

      PresentationFactory presentationFactory = new PresentationFactory();
      for (AbstractDocumentationTooltipAction action : ourTooltipActions) {
        Icon icon = action.getTemplatePresentation().getIcon();
        Dimension minSize = new Dimension(icon.getIconWidth(), icon.getIconHeight());
        myButtons.add(
            new ActionButton(
                action,
                presentationFactory.getPresentation(action),
                IdeTooltipManager.IDE_TOOLTIP_PLACE,
                minSize));
        action.setDocInfo(documentationAnchor, elementUnderMouse);
      }
      Collections.reverse(myButtons);

      setPreferredSize(baseDocControl.getPreferredSize());
      setMaximumSize(baseDocControl.getMaximumSize());
      setMinimumSize(baseDocControl.getMinimumSize());
      setBackground(baseDocControl.getBackground());

      add(baseDocControl, Integer.valueOf(0));
      int minWidth = 0;
      int minHeight = 0;
      int buttonWidth = 0;
      for (JComponent button : myButtons) {
        button.setBorder(null);
        button.setBackground(baseDocControl.getBackground());
        add(button, Integer.valueOf(1));
        button.setVisible(false);
        Dimension preferredSize = button.getPreferredSize();
        minWidth += preferredSize.width;
        minHeight = Math.max(minHeight, preferredSize.height);
        buttonWidth = Math.max(buttonWidth, preferredSize.width);
      }
      myButtonWidth = buttonWidth;

      int margin = 2;
      myMinWidth = minWidth + margin * 2 + (myButtons.size() - 1) * BUTTON_HGAP;
      myMinHeight = minHeight + margin * 2;
    }
示例#12
0
 public static void sizeIt(JComponent c, int width, int height) {
   if (height < 0) {
     height = c.getPreferredSize().height;
   }
   Dimension myDimension = new Dimension(width, height);
   c.setMaximumSize(myDimension);
   c.setMinimumSize(myDimension);
   c.setPreferredSize(myDimension);
 }
  public static Point getCenterOf(final Component aContainer, final JComponent content) {
    final JComponent component = getTargetComponent(aContainer);

    Point containerScreenPoint = component.getVisibleRect().getLocation();
    SwingUtilities.convertPointToScreen(containerScreenPoint, aContainer);

    return UIUtil.getCenterPoint(
        new Rectangle(containerScreenPoint, component.getVisibleRect().getSize()),
        content.getPreferredSize());
  }
 private void addRow(String label, JComponent component) {
   JLabel l = new JLabel(label);
   l.setFont(Theme.SMALL_BOLD_FONT);
   l.setBounds(18, y, 400, 18);
   add(l);
   y += 18;
   int componentHeight = (int) component.getPreferredSize().getHeight();
   component.setBounds(16, y, 400, componentHeight);
   y += componentHeight;
   y += 2; // vertical gap
   add(component);
 }
示例#15
0
  /*
   *  Create a BufferedImage for Swing components.
   *  The entire component will be captured to an image.
   *
   *  @param	 component Swing component to create image from
   *  @param	 fileName name of file to be created or null
   *  @return	image the image for the given region
   *  @exception IOException if an error occurs during writing
   */
  public static BufferedImage createImage(JComponent component, String fileName)
      throws IOException {
    Dimension d = component.getSize();

    if (d.width == 0) {
      d = component.getPreferredSize();
      component.setSize(d);
    }

    Rectangle region = new Rectangle(0, 0, d.width, d.height);
    return ScreenCapture.createImage(component, region, fileName);
  }
示例#16
0
    @Override
    public void doLayout() {
      Rectangle bounds = getBounds();
      myBaseDocControl.setBounds(new Rectangle(0, 0, bounds.width, bounds.height));

      int x = bounds.width;
      for (JComponent button : myButtons) {
        Dimension buttonSize = button.getPreferredSize();
        x -= buttonSize.width;
        button.setBounds(x, 0, buttonSize.width, buttonSize.height);
        x -= BUTTON_HGAP;
      }
    }
 /**
  * Creates a component titled border with the specified component painted on top of the specified
  * border underneath.
  *
  * @param comp the component to be displayed
  * @param container the enclosed container
  * @param border the underlying border
  */
 public ComponentTitledBorder(JComponent comp, JComponent container, Border border) {
   this.comp = comp;
   this.comp.setOpaque(false);
   this.comp.setFont(UIManager.getFont("TitledBorder.font"));
   this.comp.setForeground(UIManager.getColor("TitledBorder.titleColor"));
   this.comp.setBorder(new EmptyBorder(0, 1, 0, 1));
   Dimension size = comp.getPreferredSize();
   this.rect = new Rectangle(offset, 1, size.width, size.height);
   this.container = container;
   this.border = border;
   this.intermediate = new JPanel();
   container.addMouseListener(this);
   container.addMouseMotionListener(this);
 }
示例#18
0
 public Rectangle getComponentRect(Rectangle rect, Insets borderInsets) {
   Dimension compD = component.getPreferredSize();
   Rectangle compR = new Rectangle(0, 0, compD.width, compD.height);
   switch (titlePosition) {
     case ABOVE_TOP:
       compR.y = EDGE_SPACING;
       break;
     case TOP:
     case DEFAULT_POSITION:
       if (titleComponent instanceof JButton) {
         compR.y =
             EDGE_SPACING + (borderInsets.top - EDGE_SPACING - TEXT_SPACING - compD.height) / 2;
       } else if (titleComponent instanceof JRadioButton) {
         compR.y = (borderInsets.top - EDGE_SPACING - TEXT_SPACING - compD.height) / 2;
       }
       break;
     case BELOW_TOP:
       compR.y = borderInsets.top - compD.height - TEXT_SPACING;
       break;
     case ABOVE_BOTTOM:
       compR.y = rect.height - borderInsets.bottom + TEXT_SPACING;
       break;
     case BOTTOM:
       compR.y =
           rect.height
               - borderInsets.bottom
               + TEXT_SPACING
               + (borderInsets.bottom - EDGE_SPACING - TEXT_SPACING - compD.height) / 2;
       break;
     case BELOW_BOTTOM:
       compR.y = rect.height - compD.height - EDGE_SPACING;
       break;
   }
   switch (titleJustification) {
     case LEFT:
     case DEFAULT_JUSTIFICATION:
       // compR.x = TEXT_INSET_H + borderInsets.left;
       compR.x = TEXT_INSET_H + borderInsets.left - EDGE_SPACING;
       break;
     case RIGHT:
       compR.x = rect.width - borderInsets.right - TEXT_INSET_H - compR.width;
       break;
     case CENTER:
       compR.x = (rect.width - compR.width) / 2;
       break;
   }
   return compR;
 }
示例#19
0
  /**
   * Displays a dialog that lets you change a color. Locks up the application until a choice is
   * made, returning the chosen color, or null if nothing was chosen.
   *
   * @param component the source component.
   * @param title the String title for the window.
   * @param startingColor the initial color.
   */
  public static Color showDialog(Component component, String title, Color startingColor) {
    Color initColor = startingColor != null ? startingColor : Color.white;

    final JColorChooser jcc = new JColorChooser(initColor);
    ColorTracker ok = new ColorTracker(jcc);

    jcc.getSelectionModel().addChangeListener(ok);
    /* WORKAROUND for Java bug #5029286 and #6199676 */
    //        jcc.setPreviewPanel(ok.getTransparancyAdjustment(initColor.getAlpha()));
    JComponent previewPanel = ok.getTransparancyAdjustment(initColor.getAlpha());
    previewPanel.setSize(previewPanel.getPreferredSize());
    previewPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));
    jcc.setPreviewPanel(previewPanel);

    JDialog colorDialog = JColorChooser.createDialog(component, title, true, jcc, ok, null);
    colorDialog.setVisible(true);
    return ok.getColor();
  }
  private void doHandleSelectionChange(@NotNull KeyType selected, boolean processIfUnfocused) {
    if (!isHandleSelectionEnabled(selected, processIfUnfocused)) {
      hideHint();
      return;
    }

    myKey = selected;

    Point location = createToolTipImage(myKey);

    if (location == null) {
      hideHint();
    } else {
      Rectangle bounds = new Rectangle(location, myTipComponent.getPreferredSize());
      myPopup.setBounds(bounds);
      myPopup.setVisible(noIntersections(bounds));
      repaintKeyItem();
    }
  }
示例#21
0
  /**
   * Create the GUI and show it. For thread safety, this method should be invoked from the
   * event-dispatching thread.
   */
  private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("ListDataEventDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    JComponent newContentPane = new ListDataEventDemo();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Don't let the content pane get too small.
    // (Works if the Java look and feel provides
    // the window decorations.)
    newContentPane.setMinimumSize(new Dimension(newContentPane.getPreferredSize().width, 100));

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
示例#22
0
  /**
   * Adds this bean to the global list of beans and to the supplied container. The constructor calls
   * this method, so a client should not need to unless they have called removeBean and then wish to
   * have it added again.
   *
   * @param container the Component on which this BeanInstance will be displayed
   */
  public void addBean(JComponent container, Integer... tab) {

    int index = 0;
    if (tab.length > 0) {
      index = tab[0].intValue();
    }

    Vector<Object> components = null;
    if (TABBED_COMPONENTS.size() > 0 && index < TABBED_COMPONENTS.size()) {
      components = TABBED_COMPONENTS.get(index);
    }

    // do nothing if we are already in the list
    if (components.contains(this)) {
      return;
    }

    // Ignore invisible components
    if (!Beans.isInstanceOf(m_bean, JComponent.class)) {
      System.out.println("Component is invisible!");
      return;
    }

    components.addElement(this);

    // Position and layout the component
    JComponent c = (JComponent) m_bean;
    Dimension d = c.getPreferredSize();
    int dx = (int) (d.getWidth() / 2);
    int dy = (int) (d.getHeight() / 2);
    m_x -= dx;
    m_y -= dy;
    c.setLocation(m_x, m_y);
    // c.doLayout();
    c.validate();
    // bp.addBean(c);
    // c.repaint();
    if (container != null) {
      container.add(c);
      container.revalidate();
    }
  }
示例#23
0
  void test(JComponent c) {
    c.setEnabled(false);
    c.setOpaque(true);
    c.setBackground(TEST_COLOR);
    c.setBorder(null);
    Dimension size = c.getPreferredSize();
    c.setBounds(0, 0, size.width, size.height);

    BufferedImage image = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
    c.paint(image.getGraphics());

    int rgb = TEST_COLOR.getRGB();
    for (int i = 0; i < size.height; i++) {
      for (int j = 0; j < size.width; j++) {
        if (image.getRGB(j, i) != rgb) {
          throw new RuntimeException(String.format("Color mismatch at [%d, %d]", j, i));
        }
      }
    }
  }
  private void checkResult(@TestDataFile String expectedResultFileName) throws IOException {
    myEditor.getSettings().setAdditionalLinesCount(0);
    myEditor.getSettings().setAdditionalColumnsCount(1);
    JComponent editorComponent = myEditor.getContentComponent();
    Dimension size = editorComponent.getPreferredSize();
    editorComponent.setSize(size);
    //noinspection UndesirableClassUsage
    BufferedImage image = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
    BitmapFont bitmapFont = BitmapFont.loadFromFile(getFontFile());
    MyGraphics graphics = new MyGraphics(image.createGraphics(), bitmapFont);
    try {
      editorComponent.paint(graphics);
    } finally {
      graphics.dispose();
    }

    File fileWithExpectedResult = getTestDataFile(expectedResultFileName);
    if (OVERWRITE_TESTDATA) {
      ImageIO.write(image, "png", fileWithExpectedResult);
      System.out.println("File " + fileWithExpectedResult.getPath() + " created.");
    }
    if (fileWithExpectedResult.exists()) {
      BufferedImage expectedResult = ImageIO.read(fileWithExpectedResult);
      if (expectedResult.getWidth() != image.getWidth()) {
        fail("Unexpected image width", fileWithExpectedResult, image);
      }
      if (expectedResult.getHeight() != image.getHeight()) {
        fail("Unexpected image height", fileWithExpectedResult, image);
      }
      for (int i = 0; i < expectedResult.getWidth(); i++) {
        for (int j = 0; j < expectedResult.getHeight(); j++) {
          if (expectedResult.getRGB(i, j) != image.getRGB(i, j)) {
            fail("Unexpected image contents", fileWithExpectedResult, image);
          }
        }
      }
    } else {
      ImageIO.write(image, "png", fileWithExpectedResult);
      fail("Missing test data created: " + fileWithExpectedResult.getPath());
    }
  }
示例#25
0
    public Insets getBorderInsets(Component c, Insets insets) {
      Insets borderInsets;
      if (border != null) {
        borderInsets = border.getBorderInsets(c);
      } else {
        borderInsets = new Insets(0, 0, 0, 0);
      }
      insets.top = EDGE_SPACING + TEXT_SPACING + borderInsets.top;
      insets.right = EDGE_SPACING + TEXT_SPACING + borderInsets.right;
      insets.bottom = EDGE_SPACING + TEXT_SPACING + borderInsets.bottom;
      insets.left = EDGE_SPACING + TEXT_SPACING + borderInsets.left;

      if (c == null || component == null) {
        return insets;
      }

      int compHeight = component.getPreferredSize().height;

      switch (titlePosition) {
        case ABOVE_TOP:
          insets.top += compHeight + TEXT_SPACING;
          break;
        case TOP:
        case DEFAULT_POSITION:
          insets.top += Math.max(compHeight, borderInsets.top) - borderInsets.top;
          break;
        case BELOW_TOP:
          insets.top += compHeight + TEXT_SPACING;
          break;
        case ABOVE_BOTTOM:
          insets.bottom += compHeight + TEXT_SPACING;
          break;
        case BOTTOM:
          insets.bottom += Math.max(compHeight, borderInsets.bottom) - borderInsets.bottom;
          break;
        case BELOW_BOTTOM:
          insets.bottom += compHeight + TEXT_SPACING;
          break;
      }
      return insets;
    }
示例#26
0
  /**
   * Creates preview for the (video) device in the video container.
   *
   * @param device the device
   * @param videoContainer the video container
   * @throws IOException a problem accessing the device
   * @throws MediaException a problem getting preview
   */
  private static void createVideoPreview(CaptureDeviceInfo device, JComponent videoContainer)
      throws IOException, MediaException {
    videoContainer.removeAll();

    videoContainer.revalidate();
    videoContainer.repaint();

    if (device == null) return;

    for (MediaDevice mediaDevice : mediaService.getDevices(MediaType.VIDEO, MediaUseCase.ANY)) {
      if (((MediaDeviceImpl) mediaDevice).getCaptureDeviceInfo().equals(device)) {
        Dimension videoContainerSize = videoContainer.getPreferredSize();
        Component preview =
            (Component)
                mediaService.getVideoPreviewComponent(
                    mediaDevice, videoContainerSize.width, videoContainerSize.height);

        if (preview != null) videoContainer.add(preview);
        break;
      }
    }
  }
  private void fixActualPoint(Point actualPoint) {
    if (!isAwtTooltip()) return;
    if (!myIsRealPopup) return;

    Dimension size = myComponent.getPreferredSize();
    Balloon.Position position = myHintHint.getPreferredPosition();
    int shift = BalloonImpl.getPointerLength(position, false);
    switch (position) {
      case below:
        actualPoint.y += shift;
        break;
      case above:
        actualPoint.y -= (shift + size.height);
        break;
      case atLeft:
        actualPoint.x -= (shift + size.width);
        break;
      case atRight:
        actualPoint.y += shift;
        break;
    }
  }
示例#28
0
 private void setMaxHeightToPreferredHeight(JComponent component) {
   component.setMaximumSize(
       new Dimension(
           (int) component.getMaximumSize().getWidth(),
           (int) component.getPreferredSize().getHeight()));
 }
示例#29
0
 @Override
 public Dimension getPreferredSize() {
   return expandIfNecessary(myBaseDocControl.getPreferredSize());
 }
 @Override
 public void updateBounds(int x, int y) {
   setSize(myComponent.getPreferredSize());
   updateLocation(x, y);
 }