/**
   * Sets the window title pane -- the JComponent used to provide a plaf a way to override the
   * native operating system's window title pane with one whose look and feel are controlled by the
   * plaf. The plaf creates and sets this value; the default is null, implying a native operating
   * system window title pane.
   *
   * @param content the <code>JComponent</code> to use for the window title pane.
   */
  private void setTitlePane(JRootPane root, JComponent titlePane) {
    JLayeredPane layeredPane = root.getLayeredPane();
    JComponent oldTitlePane = getTitlePane();

    if (oldTitlePane != null) {
      oldTitlePane.setVisible(false);
      layeredPane.remove(oldTitlePane);
    }
    if (titlePane != null) {
      layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
      titlePane.setVisible(true);
    }
    this.titlePane = titlePane;
  }
Exemple #2
0
    public ProgressBarIndicatingComponent() {
      progress.setIndeterminate(true);
      progress.setStringPainted(true);

      component = flowLayout(progress, button("Cancel", this::cancel));
      component.setVisible(false);
    }
Exemple #3
0
 /**
  * Called by the constructor methods to create the default <code>glassPane</code>. By default this
  * method creates a new <code>JComponent</code> with visibility set to false.
  *
  * @return the default <code>glassPane</code>
  */
 protected Component createGlassPane() {
   JComponent c = new JPanel();
   c.setName(this.getName() + ".glassPane");
   c.setVisible(false);
   ((JPanel) c).setOpaque(false);
   return c;
 }
  /** Hides the popup */
  public void hidePopup() {
    // Only hide the popup if the glass pane is
    // visible (i.e. if the popup is being displayed)
    if (glassPane.isVisible() == true) {
      glassPane.setVisible(false);

      firePopupClosedEvent();
    }
  }
Exemple #5
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
 private void setMoreVisibility(boolean b) {
   showingMore = b;
   for (String key : keysInMoreSection) {
     keyKeyComponentMap.get(key).setVisible(b && keysVisible);
     keyValueComponentMap.get(key).setVisible(b);
     for (JComponent c : keyExtraComponentsMap.get(key)) {
       c.setVisible(b);
     }
     // close opened sub components in more if closing more
     if (!b && keyDetailComponentMap.get(key).isVisible()) {
       keyDetailComponentMap.get(key).setVisible(false);
     }
   }
 }
Exemple #7
0
    private void processStateChangeIfNecessary(
        @NotNull Point mouseScreenLocation, boolean mouseEntered) {
      // Don't show 'view quick doc' buttons if docked quick doc control is already active.
      if (myDocumentationManager.hasActiveDockedDocWindow()) {
        return;
      }

      // Skip event triggered when mouse leaves action button area.
      if (!mouseEntered
          && new Rectangle(getLocationOnScreen(), getSize()).contains(mouseScreenLocation)) {
        return;
      }
      for (JComponent button : myButtons) {
        button.setVisible(mouseEntered);
      }
    }
Exemple #8
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;
    }
 @Override
 public void setVisible(boolean enabled) {
   super.setVisible(enabled);
 }
  public static void main(String args[]) {
    JComponent ch = new JComponent() {};
    ch.getAccessibleContext();
    ch.isFocusTraversable();
    ch.setEnabled(false);
    ch.setEnabled(true);
    ch.requestFocus();
    ch.requestFocusInWindow();
    ch.getPreferredSize();
    ch.getMaximumSize();
    ch.getMinimumSize();
    ch.contains(1, 2);
    Component c1 = ch.add(new Component() {});
    Component c2 = ch.add(new Component() {});
    Component c3 = ch.add(new Component() {});
    Insets ins = ch.getInsets();
    ch.getAlignmentY();
    ch.getAlignmentX();
    ch.getGraphics();
    ch.setVisible(false);
    ch.setVisible(true);
    ch.setForeground(Color.red);
    ch.setBackground(Color.red);
    for (String font : Toolkit.getDefaultToolkit().getFontList()) {
      for (int j = 8; j < 17; j++) {
        Font f1 = new Font(font, Font.PLAIN, j);
        Font f2 = new Font(font, Font.BOLD, j);
        Font f3 = new Font(font, Font.ITALIC, j);
        Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);

        ch.setFont(f1);
        ch.setFont(f2);
        ch.setFont(f3);
        ch.setFont(f4);

        ch.getFontMetrics(f1);
        ch.getFontMetrics(f2);
        ch.getFontMetrics(f3);
        ch.getFontMetrics(f4);
      }
    }
    ch.enable();
    ch.disable();
    ch.reshape(10, 10, 10, 10);
    ch.getBounds(new Rectangle(1, 1, 1, 1));
    ch.getSize(new Dimension(1, 2));
    ch.getLocation(new Point(1, 2));
    ch.getX();
    ch.getY();
    ch.getWidth();
    ch.getHeight();
    ch.isOpaque();
    ch.isValidateRoot();
    ch.isOptimizedDrawingEnabled();
    ch.isDoubleBuffered();
    ch.getComponentCount();
    ch.countComponents();
    ch.getComponent(1);
    ch.getComponent(2);
    Component[] cs = ch.getComponents();
    ch.getLayout();
    ch.setLayout(new FlowLayout());
    ch.doLayout();
    ch.layout();
    ch.invalidate();
    ch.validate();
    ch.remove(0);
    ch.remove(c2);
    ch.removeAll();
    ch.preferredSize();
    ch.minimumSize();
    ch.getComponentAt(1, 2);
    ch.locate(1, 2);
    ch.getComponentAt(new Point(1, 2));
    ch.isFocusCycleRoot(new Container());
    ch.transferFocusBackward();
    ch.setName("goober");
    ch.getName();
    ch.getParent();
    ch.getGraphicsConfiguration();
    ch.getTreeLock();
    ch.getToolkit();
    ch.isValid();
    ch.isDisplayable();
    ch.isVisible();
    ch.isShowing();
    ch.isEnabled();
    ch.enable(false);
    ch.enable(true);
    ch.enableInputMethods(false);
    ch.enableInputMethods(true);
    ch.show();
    ch.show(false);
    ch.show(true);
    ch.hide();
    ch.getForeground();
    ch.isForegroundSet();
    ch.getBackground();
    ch.isBackgroundSet();
    ch.getFont();
    ch.isFontSet();
    Container c = new Container();
    c.add(ch);
    ch.getLocale();
    for (Locale locale : Locale.getAvailableLocales()) ch.setLocale(locale);

    ch.getColorModel();
    ch.getLocation();

    boolean exceptions = false;
    try {
      ch.getLocationOnScreen();
    } catch (IllegalComponentStateException e) {
      exceptions = true;
    }
    if (!exceptions)
      throw new RuntimeException("IllegalComponentStateException did not occur when expected");

    ch.location();
    ch.setLocation(1, 2);
    ch.move(1, 2);
    ch.setLocation(new Point(1, 2));
    ch.getSize();
    ch.size();
    ch.setSize(1, 32);
    ch.resize(1, 32);
    ch.setSize(new Dimension(1, 32));
    ch.resize(new Dimension(1, 32));
    ch.getBounds();
    ch.bounds();
    ch.setBounds(10, 10, 10, 10);
    ch.setBounds(new Rectangle(10, 10, 10, 10));
    ch.isLightweight();
    ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    ch.getCursor();
    ch.isCursorSet();
    ch.inside(1, 2);
    ch.contains(new Point(1, 2));
    ch.isFocusable();
    ch.setFocusable(true);
    ch.setFocusable(false);
    ch.transferFocus();
    ch.getFocusCycleRootAncestor();
    ch.nextFocus();
    ch.transferFocusUpCycle();
    ch.hasFocus();
    ch.isFocusOwner();
    ch.toString();
    ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
    ch.getComponentOrientation();
  }
 private void updateToolbarVisibility() {
   myToolbar.setVisible(myUISettings.SHOW_MAIN_TOOLBAR && myWelcomeScreen == null);
 }
  /**
   * Causes the popup to be displayed at the specified location.
   *
   * @param component The component whose cooredinate system is to be used.
   * @param x The horizontal location of the popup
   * @param y The vertical location of the popup.
   */
  public void showPopup(JComponent component, int x, int y) {
    // Get the root (JFrame probably)
    Component rootComp = SwingUtilities.getRoot(component);

    // Determine where to place the popup
    // (Left or right, top or bottom of the mouse cursor
    // We want to fit the popup within the top level frame

    int componentMaxX = (int) rootComp.getSize().width;

    int componentMaxY = (int) rootComp.getSize().height;

    int xPosOnRoot = SwingUtilities.convertPoint(component, x, y, rootComp).x;

    int yPosOnRoot = SwingUtilities.convertPoint(component, x, y, rootComp).y;

    // Display to the right of the mouse cursor, unless
    // there is not enough room
    int deltaX = xPosOnRoot + content.getWidth() - componentMaxX;

    if (deltaX > 0) {
      xPosOnRoot -= deltaX;

      if (xPosOnRoot < 0) {
        xPosOnRoot = 0;
      }
    }

    int deltaY = yPosOnRoot + content.getHeight() - componentMaxY;

    if (deltaY > 0) {
      yPosOnRoot -= deltaY;

      if (yPosOnRoot < 0) {
        yPosOnRoot = 0;
      }
    }

    // Convert root pos back to component pos

    int xPos = SwingUtilities.convertPoint(rootComp, xPosOnRoot, yPosOnRoot, component).x;

    int yPos = SwingUtilities.convertPoint(rootComp, xPosOnRoot, yPosOnRoot, component).y;

    JRootPane rootPane = component.getRootPane();

    rootPane.setGlassPane(glassPane);

    // Convert the mouse point from the invoking component coordinate
    // system to the glassPane coordinate system
    Point pt = SwingUtilities.convertPoint(component, xPos, yPos, glassPane);

    // Set the location of the popup in the glass pane
    content.setLocation(pt);

    // Show the glass pane.
    glassPane.setVisible(true);

    // If the popup is set to hide automatically after a specified
    // amount of time, then reset the timer.
    if (HIDE_ON_TIMER == true) {
      timer.stop();

      timer.start();
    }
  }
Exemple #13
0
  protected void dolayout(String strDir, String strFreq, String strTraynum) {
    // TopBar
    String strTitle = gettitle(strFreq);
    Color color = DisplayOptions.getColor("Heading3");

    // Center Panel
    JPanel panelCenter = new JPanel(new GridBagLayout());
    GridBagConstraints gbc =
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.2,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0);
    ImageIcon icon = getImageIcon();
    // panelCenter.add(new JLabel(icon));
    addComp(panelCenter, new JLabel(icon), gbc, 0, 0);
    strTitle = getSampleName(strDir, strTraynum);
    m_lblSampleName = new JLabel(strTitle);
    if (strTitle == null || !strTitle.trim().equals("")) strTitle = "3";
    Font font = m_lblSampleName.getFont();
    font = DisplayOptions.getFont(font.getName(), Font.BOLD, 300);
    m_lblSampleName.setFont(font);
    m_lblSampleName.setForeground(color);
    // panelCenter.add(m_lblSampleName);
    m_pnlSampleName = new JPanel(new CardLayout());
    m_pnlSampleName.add(m_lblSampleName, OTHER);
    addComp(panelCenter, m_pnlSampleName, gbc, 1, 0);
    m_pnlSampleName.setVisible(false);
    m_pnlTrays = new JPanel(new GridLayout(1, 0));
    // Vast panels
    VBox pnlVast1 = new VBox(m_pnlTrays, "1");
    m_pnlTrays.add(pnlVast1);
    m_pnlVast[0] = pnlVast1;
    VBox pnlVast2 = new VBox(m_pnlTrays, "2");
    m_pnlTrays.add(pnlVast2);
    m_pnlVast[1] = pnlVast2;
    VBox pnlVast3 = new VBox(m_pnlTrays, "3");
    m_pnlTrays.add(pnlVast3);
    m_pnlVast[2] = pnlVast3;
    VBox pnlVast4 = new VBox(m_pnlTrays, "4");
    m_pnlTrays.add(pnlVast4);
    m_pnlVast[3] = pnlVast4;
    VBox pnlVast5 = new VBox(m_pnlTrays, "5");
    m_pnlTrays.add(pnlVast5);
    m_pnlVast[4] = pnlVast5;
    m_pnlSampleName.add(m_pnlTrays, VAST);

    // Login Panel
    JPanel panelThird = new JPanel(new BorderLayout());
    JPanel panelLogin = new JPanel(new GridBagLayout());
    gbc = new GridBagConstraints();
    panelThird.add(panelLogin);
    Object[] aStrUser = getOperators();
    m_cmbUser = new JComboBox(aStrUser);
    BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
    m_cmbUser.setRenderer(renderer);
    m_cmbUser.setEditable(true);
    m_passwordField = new JPasswordField();
    // *Warning, working around a Java problem*
    // When we went to the T3500 running Redhat 5.3, the JPasswordField
    // fields sometimes does not allow ANY entry of characters.  Setting
    // the enableInputMethods() to true fixed this problem.  There are
    // comments that indicate that this could cause the typed characters
    // to be visible.  I have not found that to be a problem.
    // This may not be required in the future, or could cause characters
    // to become visible in the future if Java changes it's code.
    // GRS  8/20/09
    m_passwordField.enableInputMethods(true);

    m_lblLogin = new VLoginLabel(null, "Incorrect username/password \n Please try again ", 0, 0);
    m_lblLogin.setVisible(false);
    okButton.setActionCommand("enter");
    okButton.addActionListener(this);
    cancelButton.setActionCommand("cancel");
    cancelButton.addActionListener(this);
    helpButton.setActionCommand("help");
    helpButton.addActionListener(this);
    m_passwordField.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) enterLogin();
          }
        });

    // These is some wierd problem such that sometimes, the vnmrj command
    // area gets the focus and these items in the login box do not get
    // the focus.  Even clicking in these items does not bring focus to
    // them.  Issuing requestFocus() does not bring focus to them.
    // I can however, determing if either the operator entry box or
    // the password box has focus and if neither does, I can unshow and
    // reshow the panel and that fixes the focus.  So, I have added this
    // to the mouseClicked action.  If neither has focus, it will
    // take focus with setVisible false then true.
    comboTextField = m_cmbUser.getEditor().getEditorComponent();
    m_passwordField.addMouseListener(this);
    comboTextField.addMouseListener(this);

    m_lblUsername = new JLabel(Util.getLabel("_Operator"));
    addComp(panelLogin, m_lblUsername, gbc, 0, 0);
    addComp(panelLogin, m_cmbUser, gbc, 1, 0);
    m_lblPassword = new JLabel(Util.getLabel("_Password"));
    addComp(panelLogin, m_lblPassword, gbc, 0, 1);
    addComp(panelLogin, m_passwordField, gbc, 1, 1);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    addComp(panelLogin, m_lblLogin, gbc, 2, 0);
    setPref();

    Container container = getContentPane();
    JPanel panelLoginBox = new JPanel(new BorderLayout());
    panelLoginBox.add(panelCenter, BorderLayout.CENTER);
    panelLoginBox.add(panelThird, BorderLayout.SOUTH);
    container.add(panelLoginBox, BorderLayout.CENTER);
  }
Exemple #14
0
 @Override
 public void stop() {
   component.setVisible(false);
 }
Exemple #15
0
 @Override
 public void start(String message, Cancellable cancellable) {
   this.cancellable = cancellable;
   progress.setString(message);
   component.setVisible(true);
 }