Пример #1
1
  /** Initializes contained components. */
  private void initComponents() {
    final SimpleDateFormat format = new SimpleDateFormat("mm:ss");
    final Calendar c = Calendar.getInstance();
    final JLabel counter = new JLabel();

    counter.setForeground(Color.red);
    counter.setFont(counter.getFont().deriveFont((float) (counter.getFont().getSize() + 5)));

    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    GridBagConstraints constraints = new GridBagConstraints();

    JLabel messageLabel =
        new JLabel(
            GuiActivator.getResources().getI18NString("service.gui.security.SECURITY_ALERT"));

    messageLabel.setForeground(Color.WHITE);

    constraints.anchor = GridBagConstraints.CENTER;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 0;
    add(messageLabel, constraints);

    constraints.anchor = GridBagConstraints.CENTER;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 1;
    add(counter, constraints);

    ZrtpControl zrtpControl = null;
    if (securityControl instanceof ZrtpControl) zrtpControl = (ZrtpControl) securityControl;

    long initialSeconds = 0;

    if (zrtpControl != null) initialSeconds = zrtpControl.getTimeoutValue();

    c.setTimeInMillis(initialSeconds);

    counter.setText(format.format(c.getTime()));

    if (initialSeconds > 0)
      timer.schedule(
          new TimerTask() {
            @Override
            public void run() {
              if (c.getTimeInMillis() - 1000 > 0) {
                c.add(Calendar.SECOND, -1);
                counter.setText(format.format(c.getTime()));
              }
            }
          },
          1000,
          1000);
  }
Пример #2
0
    public DisplayUserDirectory() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      hmlabel.setForeground(Color.black);
      add(hmlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(hmdir, gbc);
      add(Box.createVerticalStrut(15), gbc);

      gbc.gridwidth = 1;
      vjlabel.setForeground(Color.black);
      add(vjlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(vjdir, gbc);
      add(Box.createVerticalStrut(0), gbc);

      gbc.gridwidth = 1;
      vjlabel2.setForeground(Color.black);
      add(vjlabel2, gbc);
      setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder(" User_Directories "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Пример #3
0
 @Override
 public Component getListCellRendererComponent(
     JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
   label.setText(Objects.toString(value, ""));
   this.list = list;
   this.index = index;
   if (isSelected) {
     setBackground(list.getSelectionBackground());
     label.setForeground(list.getSelectionForeground());
   } else {
     setBackground(index % 2 == 0 ? EVEN_COLOR : list.getBackground());
     label.setForeground(list.getForeground());
   }
   MutableComboBoxModel m = (MutableComboBoxModel) list.getModel();
   if (index < 0 || m.getSize() - 1 <= 0) {
     setOpaque(false);
     deleteButton.setVisible(false);
     label.setForeground(list.getForeground());
   } else {
     boolean f = index == rolloverIndex;
     setOpaque(true);
     deleteButton.setVisible(true);
     deleteButton.getModel().setRollover(f);
     deleteButton.setForeground(f ? Color.WHITE : list.getForeground());
   }
   return this;
 }
Пример #4
0
  /**
   * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as
   * <tt>CallPeer</tt> display name, call duration, security status.
   *
   * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information
   *     such as <tt>CallPeer</tt> display name, call duration, security status
   */
  private Component createStatusBar() {
    // stateLabel
    callStatusLabel.setForeground(Color.WHITE);
    dtmfLabel.setForeground(Color.WHITE);
    callStatusLabel.setText(callPeer.getState().getLocalizedStateString());

    PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridx = 0;
    constraints.gridy = 0;
    statusPanel.add(securityStatusLabel, constraints);
    initSecurityStatusLabel();

    constraints.gridx++;
    statusPanel.add(holdStatusLabel, constraints);

    constraints.gridx++;
    statusPanel.add(muteStatusLabel, constraints);

    constraints.gridx++;
    callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12));
    statusPanel.add(callStatusLabel, constraints);

    constraints.gridx++;
    constraints.weightx = 1f;
    statusPanel.add(dtmfLabel, constraints);

    return statusPanel;
  }
Пример #5
0
  /** PaintComponent to draw everything. */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.WHITE);
    // If using images, use cool dragon background
    if (useImages) g.drawImage(background, 0, 0, 310, 300, null);

    // Use light gray to not overpower the background image
    g.setColor(Color.LIGHT_GRAY);
    for (int y = 1; y < ROWS; ++y)
      g.fillRoundRect(0, cellSize * y - 4, (cellSize * COLS) - 1, 8, 8, 8);
    for (int x = 1; x < COLS; ++x)
      g.fillRoundRect(cellSize * x - 4, 0, 8, (cellSize * ROWS) - 1, 8, 8);

    // Use graphics2d for when not using the images
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    for (int y = 0; y < ROWS; ++y) {
      for (int x = 0; x < COLS; ++x) {
        int x1 = x * cellSize + 16;
        int y1 = y * cellSize + 16;
        if (board[y][x] == Symbol.X) {
          // use image if set to true, otherwise use g2d
          // for thicker, better looking X's and O's
          if (useImages) g.drawImage(imageX, x1, y1, 75, 75, null);
          else {
            g2d.setColor(PURPLE);
            int x2 = (x + 1) * cellSize - 16;
            int y2 = (y + 1) * cellSize - 16;
            g2d.drawLine(x1, y1, x2, y2);
            g2d.drawLine(x2, y1, x1, y2);
          }
        } else if (board[y][x] == Symbol.O) {
          if (useImages) g.drawImage(imageO, x1, y1, 75, 75, null);
          else {
            g2d.setColor(Color.BLUE);
            g2d.drawOval(x1, y1, 70, 70);
          }
        }
      } // end for
    }

    // Set status bar based on gamestate.  If CONTINUE, show whose turn it is
    if (gameStatus == GameStatus.CONTINUE) {
      statusBar.setForeground(Color.BLACK);
      if (currentPlayer == Symbol.X) statusBar.setText("X's Turn");
      else statusBar.setText("O's Turn");
    } else if (gameStatus == GameStatus.DRAW) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("Draw! Click to play again!");
    } else if (gameStatus == GameStatus.X_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("X has won! Click to play again!");
    } else if (gameStatus == GameStatus.O_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("O has won! Click to play again!");
    }
  }
Пример #6
0
 /** Formats and displays today's date. */
 public void reformat() {
   Date today = new Date();
   SimpleDateFormat formatter = new SimpleDateFormat(currentPattern);
   try {
     String dateString = formatter.format(today);
     result.setForeground(Color.black);
     result.setText(dateString);
   } catch (IllegalArgumentException iae) {
     result.setForeground(Color.red);
     result.setText("Error: " + iae.getMessage());
   }
 }
Пример #7
0
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      JLabel label = null;

      // i18n
      // label = new JLabel( "File names can be constructed from a template. The LABEL field is " );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_"));
      label.setForeground(Color.black);
      // m_gbc.weightx = 0.5;
      showInstruction(m_gbl, m_gbc, 0, 0, 7, label);

      // i18n
      // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up."));
      showInstruction(m_gbl, m_gbc, 0, 1, 7, label);
      showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel(""));

      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 0; // reset to default
      m_gbc.gridwidth = 5;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE")));

      m_nRow = 3;
      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Пример #8
0
 private void updateMemDisplay() {
   if (product != null) {
     long storageMem = product.getRawStorageSize(productSubsetDef);
     double factor = 1.0 / (1024 * 1024);
     double megas = MathUtils.round(factor * storageMem, 10);
     if (megas > memWarnLimit) {
       memLabel.setForeground(MEM_LABEL_WARN_COLOR);
     } else {
       memLabel.setForeground(MEM_LABEL_NORM_COLOR);
     }
     memLabel.setText(MEM_LABEL_TEXT + megas + "M");
   } else {
     memLabel.setText(" ");
   }
 }
Пример #9
0
 public Component getTreeCellRendererComponent(
     JTree tree,
     Object value,
     boolean sel,
     boolean expanded,
     boolean leaf,
     int row,
     boolean hasFocus) {
   renderer.setForeground(Color.BLACK);
   renderer.setText(value.toString());
   if (sel) {
     renderer.setOpaque(true);
   } else {
     renderer.setOpaque(false);
   }
   if (leaf) {
     return (makeComponent((JIDStatus) value));
   }
   if (value instanceof PrimaryJIDStatus) {
     PrimaryJIDStatus ps = (PrimaryJIDStatus) value;
     JIDStatus jidsStatus = ps.getJIDPrimaryStatus();
     if (ps.hasMultiple()) {
       if (onlineTree) {
         if (ps.multipleJIDstatusOnline()) {
           renderer.setForeground(new Color(0, 0, 190));
         }
         return makeComponent(jidsStatus);
       }
       if (ps.isAJIDstatusOffline()) { // if offline tree and a jidStatus in primary is offline
         // show
         renderer.setIcon(StatusIcons.getImageIcon("multiple"));
       }
       return renderer;
     }
     return makeComponent(jidsStatus);
   } else if (value instanceof JIDStatusGroup) {
     JIDStatusGroup group = (JIDStatusGroup) value;
     if (onlineTree) {
       renderer.setText(group.toString() + " (" + group.getOnlines() + ")");
     }
     if (expanded) {
       renderer.setIcon(StatusIcons.getImageIcon("arrowDown"));
     } else {
       renderer.setIcon(StatusIcons.getImageIcon("arrowUp"));
     }
   }
   return renderer;
 }
Пример #10
0
    public DisplayResults() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      text.setForeground(Color.black);
      add(text, gbc);
      gbc.gridy = 0;
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(emptyLabel, gbc);
      add(Box.createVerticalStrut(0), gbc);
      add(emptyLabel, gbc);

      /*	 gbc.gridy = 1;
      VTextMsg result = new VTextMsg(sshare, vnmrif, null);
      result.setPreferredSize(new Dimension(300, 30));
      result.setForeground(Color.black);
      add( result, gbc );
      */
      setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder("  Results  "),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Пример #11
0
 public MacRenderer() {
   renderer = new JLabel();
   renderer.setOpaque(Preferences.getBoolean("jeti", "bmw", true));
   renderer.setBackground(UIManager.getColor("Tree.selectionBackground"));
   renderer.setForeground(UIManager.getColor("Tree.textForeground"));
   renderer.setFont(UIManager.getFont("Tree.font"));
 }
        @NotNull
        @Override
        public Component getTreeCellRendererComponent(
            @NotNull JTree tree,
            Object value,
            boolean selected,
            boolean expanded,
            boolean leaf,
            int row,
            boolean hasFocus) {
          if (value instanceof MyTreeNode) {
            MyTreeNode node = (MyTreeNode) value;
            myLabel.setText(getRenamedTitle(node.getKey().field.getName(), node.getText()));
            myLabel.setFont(
                myLabel
                    .getFont()
                    .deriveFont(node.getKey().groupName == null ? Font.BOLD : Font.PLAIN));
            myLabel.setEnabled(node.isEnabled());
          } else {
            myLabel.setText(getRenamedTitle(value.toString(), value.toString()));
            myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
            myLabel.setEnabled(true);
          }

          Color foreground =
              selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();
          myLabel.setForeground(foreground);

          return myLabel;
        }
 public void setColor(Color _color) {
   myColor = _color;
   tabbedPanel.setForeground(_color);
   firstButton.setForeground(_color);
   for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); )
     e.nextElement().setColor(_color);
 }
Пример #14
0
 /** To highlight a message, call #warnUser. */
 private void setStatusBarTextHighlighted(boolean highlighted, Color color) {
   // Use #coordinateLabel rather than (unattached) dummy label because
   // dummy label's background does not change when L&F changes. [Jon
   // Aquino]
   messageLabel.setForeground(highlighted ? Color.black : coordinateLabel.getForeground());
   messageLabel.setBackground(highlighted ? color : coordinateLabel.getBackground());
 }
Пример #15
0
 public void setForeground(Color fg) {
   super.setForeground(fg);
   if (label != null) {
     label.setForeground(fg);
     draw.setForeground(fg);
   }
 }
Пример #16
0
 public static void writeTopString(String s) {
   if (s == null) {
     return;
   }
   statusLabel.setForeground(Color.black);
   statusLabel.setText("  " + s);
 }
Пример #17
0
  protected JLabel createActionLabel(
      final AnAction anAction,
      final String anActionName,
      final Color fg,
      final Color bg,
      final Icon icon) {
    final LayeredIcon layeredIcon = new LayeredIcon(2);
    layeredIcon.setIcon(EMPTY_ICON, 0);
    if (icon != null
        && icon.getIconWidth() <= EMPTY_ICON.getIconWidth()
        && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
      layeredIcon.setIcon(
          icon,
          1,
          (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2,
          (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
    }

    final Shortcut[] shortcutSet =
        KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction));
    final String actionName =
        anActionName
            + (shortcutSet != null && shortcutSet.length > 0
                ? " (" + KeymapUtil.getShortcutText(shortcutSet[0]) + ")"
                : "");
    final JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT);
    actionLabel.setBackground(bg);
    actionLabel.setForeground(fg);
    return actionLabel;
  }
  public InjectionsSettingsUI(final Project project, final Configuration configuration) {
    myProject = project;
    myConfiguration = configuration;

    final CfgInfo currentInfo = new CfgInfo(configuration, "Project");
    myInfos =
        configuration instanceof Configuration.Prj
            ? new CfgInfo[] {
              new CfgInfo(((Configuration.Prj) configuration).getParentConfiguration(), "IDE"),
              currentInfo
            }
            : new CfgInfo[] {currentInfo};

    myRoot = new JPanel(new BorderLayout());

    myInjectionsTable = new InjectionsTable(getInjInfoList(myInfos));
    myInjectionsTable.getEmptyText().setText("No injections configured");

    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myInjectionsTable);
    createActions(decorator);

    // myRoot.add(new TitledSeparator("Languages injection places"), BorderLayout.NORTH);
    myRoot.add(decorator.createPanel(), BorderLayout.CENTER);
    myCountLabel = new JLabel();
    myCountLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    myCountLabel.setForeground(SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES.getFgColor());
    myRoot.add(myCountLabel, BorderLayout.SOUTH);
    updateCountLabel();
  }
  private void addLabelOnPanel(int i, String str, boolean listenerSign) {
    final JLabel label = new JLabel(str);
    label.setBackground(Color.WHITE);
    label.setBounds(startPoint_x, startPoint_y, 20, 20);
    startPoint_x += 40;
    if (i == 6) {
      startPoint_x = 20;
      startPoint_y += 35;
    }
    panel.add(label);
    if (listenerSign) {
      //// ????????????????????????????
      if (getNum(7 - i) == 1) {
        int selected = Integer.parseInt(str);
        if (cal.get(Calendar.DAY_OF_MONTH) == selected) {
          lastLabel = label;
          lastLabel.setForeground(Color.RED);
        }
        label.addMouseListener(
            new MouseAdapter() {

              @Override
              public void mouseClicked(MouseEvent e) {
                lastLabel.setForeground(Color.BLACK);
                label.setForeground(Color.RED);
                lastLabel = label;
              }
            });
      } else {
        int selected = Integer.parseInt(str);
        if (cal.get(Calendar.DAY_OF_MONTH) == selected) {
          lastLabel = label;
          lastLabel.setForeground(Color.BLUE);
        }
        label.addMouseListener(
            new MouseAdapter() {

              @Override
              public void mouseClicked(MouseEvent e) {
                lastLabel.setForeground(Color.BLACK);
                label.setForeground(Color.BLUE);
                lastLabel = label;
              }
            });
      }
    }
  }
 // Initializes this component
 private void jbInit() {
   partNameLbl.setFont(Utilities.bigLabelsFont);
   partNameLbl.setHorizontalAlignment(SwingConstants.CENTER);
   partNameLbl.setText("keyboard");
   partNameLbl.setForeground(Color.black);
   partNameLbl.setBounds(new Rectangle(62, 10, 102, 21));
   this.add(partNameLbl, null);
 }
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      XmlElementDescriptor descriptor = (XmlElementDescriptor) value;
      Color backgroundColor = isSelected ? list.getSelectionBackground() : list.getBackground();

      myNameLabel.setText(descriptor.getName());
      myNameLabel.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
      myPanel.setBackground(backgroundColor);

      myNSLabel.setText(getNamespace(descriptor));
      myNSLabel.setForeground(LookupCellRenderer.getGrayedForeground(isSelected));
      myNSLabel.setBackground(backgroundColor);

      return myPanel;
    }
Пример #22
0
 public static void writePrompt(String s) {
   if (s == null) {
     return;
   }
   outputLabel.setForeground(Color.black);
   outputLabel.setText("  " + s);
   hasEntered = false;
 }
Пример #23
0
  public ComboBoxDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    String[] patternExamples = {
      "dd MMMMM yyyy",
      "dd.MM.yy",
      "MM/dd/yy",
      "yyyy.MM.dd G 'at' hh:mm:ss z",
      "EEE, MMM d, ''yy",
      "h:mm a",
      "H:mm:ss:SSS",
      "K:mm a,z",
      "yyyy.MMMMM.dd GGG hh:mm aaa"
    };

    currentPattern = patternExamples[0];

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setEditable(true);
    patternList.addActionListener(this);

    // Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    reformat();
  } // constructor
Пример #24
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);
 }
Пример #25
0
 @Override
 public Component getListCellRendererComponent(
     JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   JLabel label =
       (JLabel)
           (super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus));
   if (value instanceof TypeColorEntry) {
     TypeColorEntry entry = (TypeColorEntry) value;
     Token.Type type = entry.getType();
     Color color = entry.getColor();
     label.setText(Utilities.normalize(type.toString()));
     if ((type == Token.Type.MATCHED_BRACKET) || (type == Token.Type.UNMATCHED_BRACKET)) {
       label.setBackground(color);
       label.setForeground(Color.BLACK);
     } else {
       label.setForeground(color);
     }
   }
   return label;
 }
Пример #26
0
  protected void setPref() {
    Color color = DisplayOptions.getColor("PlainText");
    Font font = DisplayOptions.getFont("PlainText");
    m_lblUsername.setForeground(color);
    m_lblUsername.setFont(font);
    m_lblPassword.setForeground(color);
    m_lblPassword.setFont(font);
    m_cmbUser.getEditor().getEditorComponent().setForeground(color);
    m_cmbUser.getEditor().getEditorComponent().setFont(font);
    m_passwordField.setForeground(color);
    m_passwordField.setFont(font);

    color = DisplayOptions.getColor("Heading3");
    font = DisplayOptions.getFont("Heading3");
    m_lblSampleName.setForeground(color);
    m_pnlTrays.setBorder(
        BorderDeli.createBorder("Empty", "Sample Trays", "Bottom", "Center", color, font));
    VBox.setforeground(color);
    VBox.setfont(font);
  }
Пример #27
0
 /**
  * Checks the passwords of the user
  *
  * @param e The ActionEvent for this action.
  */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   // checks if the user has a unix password, if it matches, then logs the user
   // in the interface, otherwise checks for the vnmrj password,
   // if neither password matches, then the user is not logged in the interface
   if (cmd.equalsIgnoreCase("enter")) enterLogin();
   else if (cmd.equalsIgnoreCase("cancel")) {
     m_passwordField.setText("");
     m_lblLogin.setForeground(getBackground());
     // setVisible(false);
   } else if (cmd.equalsIgnoreCase("help")) displayHelp();
 }
Пример #28
0
 /**
  * This function re-computes the total number of hours for the selected period. It is ran every
  * time the user edits a text field specifying the number of hours for a particular top-level
  * project. Percentage labels are also updated.
  */
 private void recomputeTotal() {
   double total = 0;
   for (Row row : rows.values()) {
     try {
       row.hours = Double.parseDouble(row.hoursTF.getText());
       total += row.hours;
       row.hoursTF.setForeground(normalColour);
     } catch (NumberFormatException e) {
       row.hoursTF.setForeground(errorColour);
       totalLabel.setText("ERROR");
       totalLabel.setForeground(errorColour);
       return;
     }
   }
   totalLabel.setText(decimalFormat.format(total));
   totalLabel.setForeground(normalColour);
   for (Row row : rows.values()) {
     String percentS = decimalFormat.format(total == 0 ? 0 : 100 * row.hours / total);
     row.percentL.setText("(" + percentS + "%)");
   }
   pack();
 }
Пример #29
0
 private void showInstruction(
     GridBagLayout gbl,
     GridBagConstraints gbc,
     int gridx,
     int gridy,
     int gridwidth,
     JLabel instruction) {
   gbc.gridwidth = gridwidth;
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(instruction, gbc);
   instruction.setForeground(Color.black);
   m_pnlDisplay.add(instruction);
 }
Пример #30
0
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }