public void actionPerformed(ActionEvent event) {
   if (target != null) {
     target.setVisible(false);
   } else if (runnable != null) {
     runnable.run();
   }
 }
 private void hideDropDownButton() {
   for (Component component : this.getComponents()) {
     if (component instanceof AbstractButton && component.isVisible()) {
       component.setVisible(false);
       this.revalidate();
     }
   }
 }
示例#3
0
 private void toggleViewState(final Component component, final boolean visible) {
   final Dimension size = getSize();
   size.height += component.getSize().height * (visible ? -1 : 1);
   component.setVisible(!visible);
   setMinimumSize(size);
   if ((getExtendedState() & Frame.MAXIMIZED_BOTH) != Frame.MAXIMIZED_BOTH) {
     pack();
   }
 }
示例#4
0
 // not used
 public Component add(Component c) {
   // System.out.println("Add " + c);
   if (c instanceof AbstractButton) {
     // System.out.println("Add to button group " + c);
     c.setVisible(true);
     bg.add((AbstractButton) c);
   }
   if (c instanceof Anchorable && ((Anchorable) c).isAnchored()) {
     c.setSize(c.getPreferredSize());
   }
   return super.add(c);
 }
示例#5
0
文件: JSheet.java 项目: karlvr/Quaqua
 protected void hide0() {
   JRootPane rp = null;
   if (getOwner() instanceof JFrame) {
     rp = ((JFrame) getOwner()).getRootPane();
   } else if (getOwner() instanceof JDialog) {
     rp = ((JDialog) getOwner()).getRootPane();
   }
   if (rp != null && !isDocumentModalitySupported() && !isExperimentalSheet()) {
     Component blockingComponent = rp.getGlassPane();
     blockingComponent.setVisible(false);
     if (ownersGlassPane != null) {
       rp.setGlassPane(ownersGlassPane);
       ownersGlassPane = null;
     }
   }
   super.hide();
 }
示例#6
0
    public void layoutContainer(Container parent) {
      Dimension size = parent.getSize();

      Dimension captionSize = caption.getPreferredSize();
      caption.setBounds(PADDING, PADDING, captionSize.width, captionSize.height);

      // make all buttons the same size
      Dimension buttonSize = cancelButton.getPreferredSize();
      buttonSize.width = Math.max(buttonSize.width, prevButton.getPreferredSize().width);
      buttonSize.width = Math.max(buttonSize.width, nextButton.getPreferredSize().width);

      // cancel button goes on far left
      cancelButton.setBounds(
          PADDING, size.height - buttonSize.height - PADDING, buttonSize.width, buttonSize.height);

      // prev and next buttons are on the right
      prevButton.setBounds(
          size.width - buttonSize.width * 2 - 6 - PADDING,
          size.height - buttonSize.height - PADDING,
          buttonSize.width,
          buttonSize.height);

      nextButton.setBounds(
          size.width - buttonSize.width - PADDING,
          size.height - buttonSize.height - PADDING,
          buttonSize.width,
          buttonSize.height);

      // calculate size for current page
      Rectangle currentPageBounds = new Rectangle();
      currentPageBounds.x = PADDING;
      currentPageBounds.y = PADDING * 2 + captionSize.height;
      currentPageBounds.width = size.width - currentPageBounds.x - PADDING;
      currentPageBounds.height =
          size.height - buttonSize.height - currentPageBounds.y - PADDING * 2;

      for (int i = 0; i < pages.length; i++) {
        Component page = pages[i];
        page.setBounds(currentPageBounds);
        page.setVisible(i == currentPage);
      }
    }