public void updatePageCounterField(int n) {
   if (pageCounterField == null) return;
   if (n == 0) {
     pageCounterField.setBackground(pageCounterFieldDefaultColor);
     pageCounterField.setForeground(Color.BLACK);
     pageCounterButton.setForeground(pageCounterButtonDefaultForeground);
   } else {
     pageCounterField.setBackground(pageCounterFieldColor);
     pageCounterField.setForeground(Color.WHITE);
     pageCounterButton.setForeground(pageCounterFieldColor);
   }
   pageCounterField.setText("" + n);
 }
 @Override
 public Component getTreeCellRendererComponent(
     final JTree tree,
     final Object value,
     final boolean isSelected,
     final boolean expanded,
     final boolean leaf,
     final int row,
     final boolean hasFocus) {
   final JComponent c =
       (JComponent)
           renderer.getTreeCellRendererComponent(
               tree, value, isSelected, expanded, leaf, row, hasFocus);
   HighLightableWraps.clear();
   HighLightableWraps.addAll(HighLightWraps);
   if (value instanceof RSInterfaceWrap) {
     for (int i = 0; i < HighLightableWraps.size(); i++) {
       NextInterface = HighLightableWraps.get(i);
       if (NextInterface.getComp() == null) {
         if (NextInterface.getChild().getInterface().getIndex()
             == ((RSInterfaceWrap) value).wrapped.getIndex()) {
           c.setForeground(Color.blue);
         }
       }
     }
   }
   if (value instanceof RSComponentWrap) {
     for (int i = 0; i < HighLightableWraps.size(); i++) {
       NextInterface = HighLightableWraps.get(i);
       if (NextInterface.getComp() == null) {
         if (NextInterface.getChild().getInterface().getIndex()
             == ((RSComponentWrap) value).wrapped.getInterface().getIndex()) {
           if (NextInterface.getChild().getIndex()
               == ((RSComponentWrap) value).wrapped.getIndex()) {
             c.setForeground(Color.blue);
           }
         }
       } else {
         if (NextInterface.getChild().getIndex()
                 == ((RSComponentWrap) value).wrapped.getParent().getIndex()
             && NextInterface.getParent().getIndex()
                 == ((RSComponentWrap) value).wrapped.getParent().getInterface().getIndex()) {
           c.setForeground(Color.blue);
         }
       }
     }
   }
   return c;
 }
Exemplo n.º 3
0
  public boolean verify(JComponent input) {

    String text =
        input instanceof JTextField
            ? ((JTextField) input).getText()
            : ((JTextArea) input).getText();
    byte[] b = Util.stringToByteArray(text);
    if (!ignore && (b == null || (len != 0 && b.length != len))) {
      input.setForeground(Color.RED);
      return false;
    } else {
      input.setForeground(Color.BLACK);
      return true;
    }
  }
Exemplo n.º 4
0
    public void paint(Graphics g, JComponent comp) {
        // paint to the buffered image
        comp.setBackground(UIHelper.LIGHT_GREEN_COLOR);
        comp.setForeground(UIHelper.BG_COLOR);

        super.paint(g, comp);
    }
 @Override
 public void setForeground(Color fg) {
   super.setForeground(fg);
   if (rendererComponent != null) {
     rendererComponent.setForeground(fg);
   }
 }
Exemplo n.º 6
0
  public void installUI(JComponent c) {
    super.installUI(c);
    c.setFocusable(false);
    AlgebraTheme theme = AlgebraTheme.getInstance();

    c.setBackground(theme.getHighlightPaper());
    c.setForeground(theme.getHighlightInk());
  }
Exemplo n.º 7
0
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   final JComponent rendererComponent =
       (JComponent)
           myBaseRenderer.getTableCellRendererComponent(
               table, value, isSelected, hasFocus, row, column);
   if (isSelected) {
     rendererComponent.setBackground(table.getSelectionBackground());
     rendererComponent.setForeground(table.getSelectionForeground());
   } else {
     final Color bg = table.getBackground();
     rendererComponent.setBackground(bg);
     rendererComponent.setForeground(table.getForeground());
   }
   rendererComponent.setOpaque(isSelected);
   return rendererComponent;
 }
Exemplo n.º 8
0
  public void paint(Graphics g, JComponent comp) {
    // paint to the buffered image
    comp.setForeground(UIHelper.DARK_GREEN_COLOR);
    comp.setBackground(UIHelper.BG_COLOR);
    comp.setFont(UIHelper.VER_12_BOLD);

    super.paint(g, comp);
    // do an alpha composite

  }
Exemplo n.º 9
0
 /**
  * {@inheritDoc}
  *
  * <p>Overridden to set the foreground of the delegate and icon label as well.
  */
 @Override
 public void setForeground(Color bg) {
   super.setForeground(bg);
   if (iconLabel != null) {
     iconLabel.setForeground(bg);
   }
   if (delegate != null) {
     delegate.setForeground(bg);
   }
 }
Exemplo n.º 10
0
    /**
     * Creates a LabeledBorder instance with the specified border and label.
     *
     * @param border the border
     * @param label the label the border should display
     */
    public LabeledBorder(Border border, JComponent label) {
      super(border);

      this.label = label;

      if (label instanceof JLabel && label.getForeground() instanceof ColorUIResource) {

        label.setForeground(getTitleColor());
      }
    }
  /**
   * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
   *     java.lang.Object, boolean, boolean, int, int)
   */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
    this.spinner.setComponentOrientation(table.getComponentOrientation());
    this.spinner.setFont(table.getFont());
    this.spinner.setEnabled(table.isEnabled());

    JComponent editor = this.editor();
    editor.setForeground(this.foregroundColor(table, value, selected, hasFocus, row, column));
    editor.setBackground(this.backgroundColor(table, value, selected, hasFocus, row, column));
    this.spinner.setBorder(this.border(table, value, selected, hasFocus, row, column));

    this.setValue(value);
    return this.spinner;
  }
Exemplo n.º 12
0
    private JPanel makeEntry(TagSet tagSet) {
      JPanel entry = new JPanel();
      entry.setOpaque(false);
      entry.setLayout(new BoxLayout(entry, BoxLayout.LINE_AXIS));

      entry.add(new JLabel(new LegendIcon(tagSet)));
      for (TagCapability tag : tagSet.tags) {
        JComponent view = LabelView.VIEW_INFO.createView(tag.getComponentRepresentation());
        view.setForeground(Color.LIGHT_GRAY);
        entry.add(view);
      }
      if (tagSet.tags.isEmpty()) {
        JLabel label = new JLabel(tagSet.toString());
        label.setForeground(Color.LIGHT_GRAY);
        entry.add(label);
      }
      entry.setAlignmentX(LEFT_ALIGNMENT);
      entry.addMouseListener(new Highlighter(tagSet));
      return entry;
    }
Exemplo n.º 13
0
  protected void layoutComponent(String name, JComponent c) {
    Color col = getConfigColor(name, "foreground");
    if (col != null) {
      c.setForeground(col);
    }
    col = getConfigColor(name, "background");
    if (col != null) {
      c.setBackground(col);
    }
    String opaque = getConfigProperty(name + ".opaque");
    if (opaque != null) {
      c.setOpaque("true".equalsIgnoreCase(opaque));
    }

    if (getLayout() == null) {
      Rectangle bounds = getConfigBounds(name);
      if (bounds == null) {
        // No bounds for this component => use layout manager
        log.warning(
            "no bounds for "
                + roleName
                + '.'
                + getName()
                + '.'
                + name
                + ": reverting to layout manager");
        BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS);
        setLayout(layout);
      } else {
        c.setBounds(bounds);
        if ((bounds.x + bounds.width) > minWidth) {
          minWidth = bounds.x + bounds.width;
        }
        if (bounds.y + bounds.height > minHeight) {
          minHeight = bounds.y + bounds.height;
        }
      }
    }
    add(c);
  }
Exemplo n.º 14
0
 private void setOriginalColors(JComponent c) {
   c.setBackground(originalBackground);
   c.setForeground(originalForeground);
 }
Exemplo n.º 15
0
 private LinkAdapter(JComponent comp, URI uri) {
   comp.setToolTipText(uri.toString());
   comp.setForeground(Color.BLUE);
   comp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   this.uri = uri;
 }
 /** Change l'affichage du composant d'édition en fonction de la validité de sa valeur */
 private void setValidite(final boolean valide) {
   if (comp == null) LOG.error("AffichageFormulaire.setValidite : pas de champ ?");
   if (valide) comp.setForeground(null);
   else comp.setForeground(couleurErreur);
 }
Exemplo n.º 17
0
  /**
   * Builds the panel hosting the user's details.
   *
   * @return See above.
   */
  private JPanel buildContentPanel() {
    ExperimenterData user = (ExperimenterData) model.getRefObject();
    boolean editable = model.isUserOwner(user);
    if (!editable) editable = model.isGroupLeader() || MetadataViewerAgent.isAdministrator();
    details = EditorUtil.convertExperimenter(user);
    JPanel content = new JPanel();
    content.setBorder(BorderFactory.createTitledBorder("Profile"));
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    Entry entry;
    Iterator i = details.entrySet().iterator();
    JComponent label;
    JTextField area;
    String key, value;
    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    // Add log in name but cannot edit.
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    content.add(userPicture, c);
    c.gridy++;
    c.gridx = 0;
    label = EditorUtil.getLabel(EditorUtil.DISPLAY_NAME, true);
    label.setBackground(UIUtilities.BACKGROUND_COLOR);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    loginArea.setText(user.getUserName());
    loginArea.getDocument().addDocumentListener(this);
    content.add(loginArea, c);
    while (i.hasNext()) {
      ++c.gridy;
      c.gridx = 0;
      entry = (Entry) i.next();
      key = (String) entry.getKey();
      value = (String) entry.getValue();
      label = EditorUtil.getLabel(key, false);
      area = new JTextField(value);
      area.setBackground(UIUtilities.BACKGROUND_COLOR);
      area.setEditable(editable);
      area.setEnabled(editable);
      if (editable) area.getDocument().addDocumentListener(this);
      items.put(key, area);
      label.setBackground(UIUtilities.BACKGROUND_COLOR);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(area, c);
    }
    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.DEFAULT_GROUP, false);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(groupLabel, c);
    c.gridy++;
    content.add(permissionsPane, c);

    // content.add(groups, c);

    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.GROUP_OWNER, false);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(ownerBox, c);
    if (activeBox.isVisible()) {
      c.gridx = 0;
      c.gridy++;
      label = EditorUtil.getLabel(EditorUtil.ACTIVE, false);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(activeBox, c);
    }
    if (adminBox.isVisible()) {
      c.gridx = 0;
      c.gridy++;
      label = EditorUtil.getLabel(EditorUtil.ADMINISTRATOR, false);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(adminBox, c);
    }
    c.gridx = 0;
    c.gridy++;
    content.add(Box.createHorizontalStrut(10), c);
    c.gridy++;
    label = UIUtilities.setTextFont(EditorUtil.MANDATORY_DESCRIPTION, Font.ITALIC);
    label.setForeground(UIUtilities.REQUIRED_FIELDS_COLOR);
    c.weightx = 0.0;
    content.add(label, c);
    return content;
  }
Exemplo n.º 18
0
 @Override
 public void setForeground(Color fg) {
   super.setForeground(fg);
   label.setForeground(fg);
   field.setForeground(fg);
 }
Exemplo n.º 19
0
// ----------------------------------------------------------------------------
 public static void setScheme(JComponent parComponent, Scheme parScheme) {
   parComponent.setBackground(parScheme.COMPONENT_BACKGROUND_COLOR);
   parComponent.setForeground(parScheme.FOREGROUND_COLOR);
   parComponent.setFont(parScheme.FONT);
 }
 public static void setColors(JComponent pane) {
   pane.setForeground(Color.black);
   pane.setBackground(HintUtil.INFORMATION_COLOR);
   pane.setOpaque(true);
 }
Exemplo n.º 22
0
  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();
  }
Exemplo n.º 23
0
 private void setRolloverColors(JComponent c) {
   AlgebraTheme theme = AlgebraTheme.getInstance();
   c.setBackground(theme.getRolloverPaper());
   c.setForeground(theme.getRolloverInk());
 }
Exemplo n.º 24
0
 /** Apply the tooltip style (e.g. colors) to the given component. */
 public static void applyToolTipStyle(JComponent c) {
   c.setForeground((Color) UIManager.get("ToolTip.foreground"));
   c.setBackground((Color) UIManager.get("ToolTip.background"));
   c.setFont((Font) UIManager.get("ToolTip.font"));
 }
  /** Loads the configuration form obtained from the chat room. */
  protected void loadConfigurationForm() {
    Iterator<ChatRoomConfigurationFormField> configurationSet = configForm.getConfigurationSet();

    while (configurationSet.hasNext()) {
      ChatRoomConfigurationFormField formField = configurationSet.next();

      Iterator<?> values = formField.getValues();
      Iterator<String> options = formField.getOptions();

      JComponent field;
      JLabel label = new JLabel("", JLabel.RIGHT);

      if (formField.getLabel() != null) label.setText(formField.getLabel() + ": ");

      String fieldType = formField.getType();

      if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_BOOLEAN)) {
        // Create a check box when the field is of type boolean.
        field = new SIPCommCheckBox(formField.getLabel());
        label.setText("");

        if (values.hasNext()) {
          ((JCheckBox) field).setSelected((Boolean) values.next());
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_TEXT_FIXED)) {
        field = new JLabel();

        if (values.hasNext()) {
          String value = values.next().toString();

          ((JLabel) field).setText(value);
          field.setFont(new Font(null, Font.ITALIC, 10));
          field.setForeground(Color.GRAY);
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_LIST_MULTI)) {
        field = new TransparentPanel(new GridLayout(0, 1));

        field.setBorder(BorderFactory.createLineBorder(Color.GRAY));

        Hashtable<Object, JCheckBox> optionCheckBoxes = new Hashtable<Object, JCheckBox>();

        while (options.hasNext()) {
          Object option = options.next();
          JCheckBox checkBox = new SIPCommCheckBox(option.toString());

          field.add(checkBox);
          optionCheckBoxes.put(option, checkBox);
        }

        while (values.hasNext()) {
          Object value = values.next();

          (optionCheckBoxes.get(value)).setSelected(true);
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_LIST_SINGLE)) {
        field = new JComboBox();

        while (options.hasNext()) {
          ((JComboBox) field).addItem(options.next());
        }

        if (values.hasNext()) {
          ((JComboBox) field).setSelectedItem(values.next());
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_TEXT_MULTI)) {
        field = new JEditorPane();

        if (values.hasNext()) {
          String value = values.next().toString();

          ((JEditorPane) field).setText(value);
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_TEXT_SINGLE)
          || fieldType.equals(ChatRoomConfigurationFormField.TYPE_ID_SINGLE)) {
        field = new JTextField();

        if (values.hasNext()) {
          String value = values.next().toString();

          ((JTextField) field).setText(value);
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_TEXT_PRIVATE)) {
        field = new JPasswordField();

        if (values.hasNext()) {
          String value = values.next().toString();

          ((JPasswordField) field).setText(value);
        }
      } else if (fieldType.equals(ChatRoomConfigurationFormField.TYPE_ID_MULTI)) {
        StringBuffer buff = new StringBuffer();

        while (values.hasNext()) {
          String value = values.next().toString();
          buff.append(value);

          if (values.hasNext()) buff.append(System.getProperty("line.separator"));
        }
        field = new JTextArea(buff.toString());
      } else {
        if (label.getText() == null) continue;

        field = new JTextField();

        if (values.hasNext()) {
          String value = values.next().toString();

          ((JTextField) field).setText(value);
        }
      }

      // If the field is not fixed (i.e. could be changed) we would like
      // to save it in a list in order to use it later when user saves
      // the configuration data.
      if (!fieldType.equals(ChatRoomConfigurationFormField.TYPE_TEXT_FIXED)) {
        uiFieldsTable.put(formField.getName(), field);
      }

      JPanel fieldPanel = new TransparentPanel(new GridLayout(1, 2));
      fieldPanel.setOpaque(false);

      if (!(field instanceof JLabel))
        fieldPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
      else fieldPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));

      fieldPanel.add(label);
      fieldPanel.add(field);

      this.mainPanel.add(fieldPanel);
    }
  }
Exemplo n.º 26
0
 private void setDisabledColors(JComponent c) {
   AlgebraTheme theme = AlgebraTheme.getInstance();
   c.setBackground(theme.getDisabledPaper());
   c.setForeground(theme.getDisabledInk());
 }