Esempio n. 1
1
 public int getTitleHeight(Component c) {
   int th = 21;
   int fh = getBorderInsets(c).top + getBorderInsets(c).bottom;
   if (c instanceof JDialog) {
     JDialog dialog = (JDialog) c;
     th = dialog.getSize().height - dialog.getContentPane().getSize().height - fh - 1;
     if (dialog.getJMenuBar() != null) {
       th -= dialog.getJMenuBar().getSize().height;
     }
   } else if (c instanceof JInternalFrame) {
     JInternalFrame frame = (JInternalFrame) c;
     th = frame.getSize().height - frame.getRootPane().getSize().height - fh - 1;
     if (frame.getJMenuBar() != null) {
       th -= frame.getJMenuBar().getSize().height;
     }
   } else if (c instanceof JRootPane) {
     JRootPane jp = (JRootPane) c;
     if (jp.getParent() instanceof JFrame) {
       JFrame frame = (JFrame) c.getParent();
       th = frame.getSize().height - frame.getContentPane().getSize().height - fh - 1;
       if (frame.getJMenuBar() != null) {
         th -= frame.getJMenuBar().getSize().height;
       }
     } else if (jp.getParent() instanceof JDialog) {
       JDialog dialog = (JDialog) c.getParent();
       th = dialog.getSize().height - dialog.getContentPane().getSize().height - fh - 1;
       if (dialog.getJMenuBar() != null) {
         th -= dialog.getJMenuBar().getSize().height;
       }
     }
   }
   return th;
 }
Esempio n. 2
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();
    }
  }
  private void adjustPositionForLookup(@NotNull Lookup lookup) {
    if (!myHint.isVisible() || myEditor.isDisposed()) {
      Disposer.dispose(this);
      return;
    }

    IdeTooltip tooltip = myHint.getCurrentIdeTooltip();
    if (tooltip != null) {
      JRootPane root = myEditor.getComponent().getRootPane();
      if (root != null) {
        Point p = tooltip.getShowingPoint().getPoint(root.getLayeredPane());
        if (lookup.isPositionedAboveCaret()) {
          if (Position.above == tooltip.getPreferredPosition()) {
            myHint.pack();
            myHint.updatePosition(Position.below);
            myHint.updateLocation(p.x, p.y + tooltip.getPositionChangeY());
          }
        } else {
          if (Position.below == tooltip.getPreferredPosition()) {
            myHint.pack();
            myHint.updatePosition(Position.above);
            myHint.updateLocation(p.x, p.y - tooltip.getPositionChangeY());
          }
        }
      }
    }
  }
  /*
   * Assign ENTER and ESCAPE keystrokes to be equivalent to OK and Cancel buttons, respectively.
   */
  @SuppressWarnings("serial")
  protected void setupKeys() {
    // Get the InputMap and ActionMap of the RootPane of this JDialog.
    JRootPane rootPane = this.getRootPane();
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = rootPane.getActionMap();

    // Setup ENTER key.
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
    actionMap.put(
        "enter",
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            okChosen();
          }
        });

    // Setup ESCAPE key.
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
    actionMap.put(
        "escape",
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            cancelChosen();
          }
        });

    // Stop table_ from consuming the ENTER keystroke and preventing it from being received by this
    // (JDialog).
    table_
        .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none");
  }
Esempio n. 5
0
  /**
   * Sets the dialog for this service to the specified dialog.
   *
   * @param dialog The dialog for this service to maintain.
   */
  protected void setDialog(JDialog dialog) {
    this.dialog = dialog;
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            dispose();
          }
        });
    JRootPane root = dialog.getRootPane();
    root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "closeDialog");
    root.getActionMap()
        .put(
            "closeDialog",
            new AbstractAction() {
              private static final long serialVersionUID = 2759447330549410101L;

              @Override
              public void actionPerformed(ActionEvent e) {
                BaseService.this.dispose();
              }
            });
    root.setDefaultButton(defaultButton);
  }
Esempio n. 6
0
  @Override
  protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    // Hide Window on ESC
    Action escapeAction = new AbstractAction("ESCAPE") { // $NON-NLS-1$
          /** */
          private static final long serialVersionUID = -6543764044868772971L;

          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
          }
        };
    // Do search on Enter
    Action enterAction = new AbstractAction("ENTER") { // $NON-NLS-1$

          private static final long serialVersionUID = -3661361497864527363L;

          @Override
          public void actionPerformed(final ActionEvent actionEvent) {
            checkDirtyAndLoad(actionEvent);
          }
        };
    ActionMap actionMap = rootPane.getActionMap();
    actionMap.put(escapeAction.getValue(Action.NAME), escapeAction);
    actionMap.put(enterAction.getValue(Action.NAME), enterAction);
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
    inputMap.put(KeyStrokes.ENTER, enterAction.getValue(Action.NAME));

    return rootPane;
  }
  public WelcomeFrame() {
    JRootPane rootPane = getRootPane();
    final WelcomeScreen screen = createScreen(rootPane);

    final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane);
    setGlassPane(glassPane);
    glassPane.setVisible(false);
    setContentPane(screen.getWelcomePanel());
    setTitle(ApplicationNamesInfo.getInstance().getFullProductName());
    AppUIUtil.updateWindowIcon(this);

    ProjectManager.getInstance()
        .addProjectManagerListener(
            new ProjectManagerAdapter() {
              @Override
              public void projectOpened(Project project) {
                dispose();
              }
            });

    myBalloonLayout = new BalloonLayoutImpl(rootPane.getLayeredPane(), new Insets(8, 8, 8, 8));

    myScreen = screen;
    setupCloseAction();
    new MnemonicHelper().register(this);
    myScreen.setupFrame(this);
  }
 /**
  * Installs the appropriate LayoutManager on the <code>JRootPane</code> to render the window
  * decorations.
  */
 private void installLayout(JRootPane root) {
   if (layoutManager == null) {
     layoutManager = createLayoutManager();
   }
   savedOldLayout = root.getLayout();
   root.setLayout(layoutManager);
 }
Esempio n. 9
0
    /**
     * Returns the minimum amount of space the layout needs.
     *
     * @param the Container for which this layout manager is being used
     * @return a Dimension object containing the layout's minimum size
     */
    public Dimension minimumLayoutSize(Container parent) {
      Dimension cpd;
      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().getMinimumSize();
      } else {
        cpd = root.getSize();
      }
      if (cpd != null) {
        cpWidth = cpd.width;
        cpHeight = cpd.height;
      }

      return new Dimension(
          Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right,
          cpHeight + mbHeight + tpWidth + i.top + i.bottom);
    }
Esempio n. 10
0
 private boolean couldBeInFullScreen() {
   if (myParent instanceof JFrame) {
     JRootPane rootPane = ((JFrame) myParent).getRootPane();
     return rootPane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null;
   }
   return false;
 }
Esempio n. 11
0
 /**
  * Overrides <code>JComponent.removeNotify</code> to check if this button is currently set as the
  * default button on the <code>RootPane</code>, and if so, sets the <code>RootPane</code>'s
  * default button to <code>null</code> to ensure the <code>RootPane</code> doesn't hold onto an
  * invalid button reference.
  */
 public void removeNotify() {
   JRootPane root = SwingUtilities.getRootPane(this);
   if (root != null && root.getDefaultButton() == this) {
     root.setDefaultButton(null);
   }
   super.removeNotify();
 }
Esempio n. 12
0
  /**
   * Invoked when a property changes. <code>MetalRootPaneUI</code> is primarily interested in events
   * originating from the <code>JRootPane</code> it has been installed on identifying the property
   * <code>windowDecorationStyle</code>. If the <code>windowDecorationStyle</code> has changed to a
   * value other than <code>JRootPane.NONE</code>, this will add a <code>Component</code> to the
   * <code>JRootPane</code> to render the window decorations, as well as installing a <code>Border
   * </code> on the <code>JRootPane</code>. On the other hand, if the <code>windowDecorationStyle
   * </code> has changed to <code>JRootPane.NONE</code>, this will remove the <code>Component</code>
   * that has been added to the <code>JRootPane</code> as well resetting the Border to what it was
   * before <code>installUI</code> was invoked.
   *
   * @param e A PropertyChangeEvent object describing the event source and the property that has
   *     changed.
   */
  public void propertyChange(PropertyChangeEvent e) {
    super.propertyChange(e);

    String propertyName = e.getPropertyName();
    if (propertyName == null) {
      return;
    }

    if (propertyName.equals("windowDecorationStyle")) {
      JRootPane root = (JRootPane) e.getSource();
      int style = root.getWindowDecorationStyle();

      // This is potentially more than needs to be done,
      // but it rarely happens and makes the install/uninstall process
      // simpler. MetalTitlePane also assumes it will be recreated if
      // the decoration style changes.
      uninstallClientDecorations(root);
      if (style != JRootPane.NONE) {
        installClientDecorations(root);
      }
    } else if (propertyName.equals("ancestor")) {
      uninstallWindowListeners(root);
      if (((JRootPane) e.getSource()).getWindowDecorationStyle() != JRootPane.NONE) {
        installWindowListeners(root, root.getParent());
      }
    }
    return;
  }
Esempio n. 13
0
  /** Creates new form ClienteUsuarioModifica */
  public DlgClienteNuevo(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();

    InitDialogData();
    setTitle(TDSLanguageUtils.getMessage("client.SS2.Client.NuevoDialog"));
    b_OK.setText(TDSLanguageUtils.getMessage("client.SS2.btnOK"));
    b_Cancel.setText(TDSLanguageUtils.getMessage("client.SS2.btnCancel"));
    l_numeroCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.numclient"));
    l_fechAltaCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.dataalta"));
    l_nifCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.nif"));
    l_nombreCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.nom"));
    l_apellidosCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.cognoms"));
    l_direccionCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.adreca"));
    l_poblacionCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.poblacio"));
    l_codigoPostalCliente.setText(TDSLanguageUtils.getMessage("client.SS2.Client.codipostal"));
    l_error.setText("");
    JRootPane rootPanel = this.getRootPane();
    InputMap iMap = rootPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");

    ActionMap aMap = rootPanel.getActionMap();
    aMap.put(
        "escape",
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          };
        });
  }
  private void initWizard(final String title) {
    setTitle(title);
    myCurrentStep = 0;
    myPreviousButton = new JButton(IdeBundle.message("button.wizard.previous"));
    myNextButton = new JButton(IdeBundle.message("button.wizard.next"));
    myCancelButton = new JButton(CommonBundle.getCancelButtonText());
    myHelpButton = new JButton(CommonBundle.getHelpButtonText());
    myContentPanel = new JPanel(new CardLayout());

    myIcon = new TallImageComponent(null);

    JRootPane rootPane = getRootPane();
    if (rootPane != null) { // it will be null in headless mode, i.e. tests
      rootPane.registerKeyboardAction(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              helpAction();
            }
          },
          KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);

      rootPane.registerKeyboardAction(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              helpAction();
            }
          },
          KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
    }
  }
  /**
   * Sets initial answer (i.e. button that will be preselected by default).
   *
   * <p>Please note that this is not the default answer that will be returned by {@link
   * #getReturnCode()} if user does nothing (i.e. closes the window). It is just the preselectated
   * button.
   *
   * @param initialAnswer {@link #A_OK}, {@link #A_CANCEL}.
   */
  public void setInitialAnswer(final int initialAnswer) {
    // If the inial answer did not actual changed, do nothing
    if (this._initialAnswer == initialAnswer) {
      return;
    }

    //
    // Configure buttons accelerator (KeyStroke) and RootPane's default button
    final JRootPane rootPane = getRootPane();
    final CButton okButton = confirmPanel.getOKButton();
    final AppsAction okAction = (AppsAction) okButton.getAction();
    final CButton cancelButton = confirmPanel.getCancelButton();
    final AppsAction cancelAction = (AppsAction) cancelButton.getAction();
    if (initialAnswer == A_OK) {
      okAction.setDefaultAccelerator();
      cancelAction.setDefaultAccelerator();
      rootPane.setDefaultButton(okButton);
    } else if (initialAnswer == A_CANCEL) {
      // NOTE: we need to set the OK's Accelerator keystroke to null because in most of the cases it
      // is "Enter"
      // and we want to prevent user for hiting ENTER by mistake
      okAction.setAccelerator(null);
      cancelAction.setDefaultAccelerator();
      rootPane.setDefaultButton(cancelButton);
    } else {
      throw new IllegalArgumentException("Unknown inital answer: " + initialAnswer);
    }

    //
    // Finally, set the new inial answer
    this._initialAnswer = initialAnswer;
  }
Esempio n. 16
0
    public void mouseMoved(MouseEvent ev) {
      JRootPane root = getRootPane();

      if (root.getWindowDecorationStyle() == JRootPane.NONE) {
        return;
      }

      Window w = (Window) ev.getSource();

      Frame f = null;
      Dialog d = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else if (w instanceof Dialog) {
        d = (Dialog) w;
      }

      // Update the cursor
      int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY()));

      if (cursor != 0
          && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0))
              || (d != null && d.isResizable()))) {
        w.setCursor(Cursor.getPredefinedCursor(cursor));
      } else {
        w.setCursor(lastCursor);
      }
    }
Esempio n. 17
0
    /**
     * Returns the maximum amount of space the layout can use.
     *
     * @param the Container for which this layout manager is being used
     * @return a Dimension object containing the layout's maximum size
     */
    public Dimension maximumLayoutSize(Container target) {
      Dimension cpd;
      int cpWidth = Integer.MAX_VALUE;
      int cpHeight = Integer.MAX_VALUE;
      int mbWidth = Integer.MAX_VALUE;
      int mbHeight = Integer.MAX_VALUE;
      int tpWidth = Integer.MAX_VALUE;
      int tpHeight = Integer.MAX_VALUE;
      Insets i = target.getInsets();
      JRootPane root = (JRootPane) target;

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

      int maxHeight = Math.max(Math.max(cpHeight, mbHeight), tpHeight);
      // Only overflows if 3 real non-MAX_VALUE heights, sum to > MAX_VALUE
      // Only will happen if sums to more than 2 billion units.  Not likely.
      if (maxHeight != Integer.MAX_VALUE) {
        maxHeight = cpHeight + mbHeight + tpHeight + i.top + i.bottom;
      }

      int maxWidth = Math.max(Math.max(cpWidth, mbWidth), tpWidth);
      // Similar overflow comment as above
      if (maxWidth != Integer.MAX_VALUE) {
        maxWidth += i.left + i.right;
      }

      return new Dimension(maxWidth, maxHeight);
    }
Esempio n. 18
0
 /**
  * Gets the value of the <code>defaultButton</code> property, which if <code>true</code> means
  * that this button is the current default button for its <code>JRootPane</code>. Most look and
  * feels render the default button differently, and may potentially provide bindings to access the
  * default button.
  *
  * @return the value of the <code>defaultButton</code> property
  * @see JRootPane#setDefaultButton
  * @see #isDefaultCapable
  * @beaninfo description: Whether or not this button is the default button
  */
 public boolean isDefaultButton() {
   JRootPane root = SwingUtilities.getRootPane(this);
   if (root != null) {
     return root.getDefaultButton() == this;
   }
   return false;
 }
Esempio n. 19
0
  /**
   * Descripción de Método
   *
   * @param gc
   * @return
   */
  public boolean includeTab(GridController gc) {
    MTab imcludedMTab = gc.getMTab();

    if (m_mTab.getIncluded_Tab_ID() != imcludedMTab.getAD_Tab_ID()) {
      return false;
    }

    //

    vIncludedGC = gc;
    vIncludedGC.switchMultiRow();
    vIncludedGC.setRowSelectionAllowed(false);
    //

    Dimension size = getPreferredSize();

    srPane.setResizeWeight(.75); // top part gets 75%
    srPane.add(vIncludedGC, JSplitPane.BOTTOM);
    srPane.setBottomComponent(vIncludedGC);
    srPane.setDividerSize(5);

    //

    int height = 150;

    vIncludedGC.setPreferredSize(new Dimension(600, height));
    setPreferredSize(new Dimension(size.width, size.height + height));
    srPane.setDividerLocation(size.height);

    //

    imcludedMTab.setIncluded(true);
    imcludedMTab.query(false, 0);

    //

    JRootPane rt = SwingUtilities.getRootPane(this);

    if (rt == null) {
      System.out.println("Root pane null");
    } else {
      // System.out.println( "Root=" + rt );
      rt.addMouseListener(vIncludedGC);

      Component gp = rt.getGlassPane();

      if (gp == null) {
        System.out.println("No Glass Pane");
      } else {
        // System.out.println( "Glass=" + gp );
        gp.addMouseListener(vIncludedGC);
      }
    }

    vIncludedGC.addMouseListener(vIncludedGC);
    vIncludedGC.enableEvents(AWTEvent.HIERARCHY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);

    return true;
  } // IncludeTab
Esempio n. 20
0
 /** Called by the constructor methods to create the default rootPane. */
 protected JRootPane createRootPane() {
   JRootPane rp = new JRootPane();
   // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
   // is NO reason for the RootPane not to be opaque. For painting to
   // work the contentPane must be opaque, therefor the RootPane can
   // also be opaque.
   rp.setOpaque(true);
   return rp;
 }
Esempio n. 21
0
 /** Creates and sets the window and its content's borders. */
 void makeBorders(int increment) {
   JRootPane rootPane = window.getRootPane();
   rootPane.setBorder(BorderFactory.createLineBorder(BORDER_COLOR, BORDER_THICKNESS + increment));
   if (canvas != null) {
     canvas.setBorder(
         BorderFactory.createBevelBorder(
             BevelBorder.LOWERED, INNER_BORDER_HIGHLIGHT, INNER_BORDER_SHADOW));
   }
 }
 private static boolean isHintsAllowed(Window window) {
   if (window instanceof RootPaneContainer) {
     final JRootPane pane = ((RootPaneContainer) window).getRootPane();
     if (pane != null) {
       return Boolean.TRUE.equals(pane.getClientProperty(AbstractPopup.SHOW_HINTS));
     }
   }
   return false;
 }
 @Override
 public void setWindowShadow(Window window, WindowShadowMode mode) {
   if (window instanceof JWindow) {
     JRootPane root = ((JWindow) window).getRootPane();
     root.putClientProperty(
         "Window.shadow", mode == WindowShadowMode.DISABLED ? Boolean.FALSE : Boolean.TRUE);
     root.putClientProperty("Window.style", mode == WindowShadowMode.SMALL ? "small" : null);
   }
 }
Esempio n. 24
0
  /** Installs the appropriate <code>Border</code> onto the <code>JRootPane</code>. */
  void installBorder(JRootPane root) {
    int style = root.getWindowDecorationStyle();

    if (style == JRootPane.NONE) {
      LookAndFeel.uninstallBorder(root);
    } else {
      root.setBorder(new RootPaneBorder());
    }
  }
Esempio n. 25
0
 @Override
 protected JRootPane createRootPane() {
   JRootPane jrootPane = new JRootPane();
   int menuShortcutKey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
   KeyStroke w = KeyStroke.getKeyStroke(KeyEvent.VK_W, menuShortcutKey);
   KeyStroke esc = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
   jrootPane.registerKeyboardAction(this, ACTION_CLOSE, w, JComponent.WHEN_IN_FOCUSED_WINDOW);
   jrootPane.registerKeyboardAction(this, ACTION_CLOSE, esc, JComponent.WHEN_IN_FOCUSED_WINDOW);
   return jrootPane;
 }
Esempio n. 26
0
  public void install(RootPaneContainer rpc) {
    if (getParent() != rpc.getLayeredPane())
      rpc.getLayeredPane().add(this, JLayeredPane.POPUP_LAYER);

    if (rootPaneInUse != null) rootPaneInUse.removeComponentListener(rootPaneComponentListener);

    rootPaneInUse = rpc.getRootPane();
    setBounds(0, 0, rootPaneInUse.getWidth(), rootPaneInUse.getHeight());
    setVisible(true);
    rootPaneInUse.addComponentListener(rootPaneComponentListener);
  }
Esempio n. 27
0
 final void closeDialog() {
   if (currentDialog != null) {
     JRootPane rootPane = SwingUtilities.getRootPane(mainPanel);
     if (rootPane != null) {
       JLayeredPane layeredPane = rootPane.getLayeredPane();
       layeredPane.remove(dialogPanel);
       currentDialog.setVisible(false);
       currentDialog = null;
       mainPanel.repaint();
     }
   }
 }
 private static Window pop(Window owner) {
   JRootPane root = getRootPane(owner);
   if (root != null) {
     synchronized (CACHE) {
       @SuppressWarnings("unchecked")
       ArrayDeque<Window> cache = (ArrayDeque<Window>) root.getClientProperty(CACHE);
       if (cache != null && !cache.isEmpty()) {
         return cache.pop();
       }
     }
   }
   return null;
 }
Esempio n. 29
0
  /**
   * Installs the necessary state onto the JRootPane to render client decorations. This is ONLY
   * invoked if the <code>JRootPane</code> has a decoration style other than <code>JRootPane.NONE
   * </code>.
   */
  private void installClientDecorations(JRootPane root) {
    installBorder(root);

    JComponent titlePane = createTitlePane(root);

    setTitlePane(root, titlePane);
    installWindowListeners(root, root.getParent());
    installLayout(root);
    if (window != null) {
      root.revalidate();
      root.repaint();
    }
  }
Esempio n. 30
0
  /**
   * If inputComponent is non-null, the focus is requested on that, otherwise request focus on the
   * default value
   */
  public void selectInitialValue(JOptionPane op) {
    if (inputComponent != null) inputComponent.requestFocus();
    else {
      if (initialFocusComponent != null) initialFocusComponent.requestFocus();

      if (initialFocusComponent instanceof JButton) {
        JRootPane root = SwingUtilities.getRootPane(initialFocusComponent);
        if (root != null) {
          root.setDefaultButton((JButton) initialFocusComponent);
        }
      }
    }
  }