Exemple #1
0
    @Override
    public void paint(Graphics g) {
      Color b;
      Color f;
      if (entered) {
        b = UIManager.getColor("controlDkShadow");
        f = Color.BLACK;
      } else {
        b = UIManager.getColor("control");
        f = UIManager.getColor("controlDkShadow");
      }
      g.setColor(b);
      g.fillRect(0, 0, getWidth(), getHeight());
      int center = getWidth() / 2;
      int[] xs = {center, center - 3, center + 3};
      int[] ys;
      if (open) {
        ys = yup;

      } else {
        ys = ydown;
      }
      g.setColor(f);
      g.drawPolygon(xs, ys, 3);
      g.fillPolygon(xs, ys, 3);
    }
  protected void installDefaults(final JComponent c) {
    LookAndFeel.installColorsAndFont(c, "ToolTip.background", "ToolTip.foreground", "ToolTip.font");
    LookAndFeel.installBorder(c, "ToolTip.border");

    backgroundInactiveColor = UIManager.getColor("ToolTip.backgroundInactive");
    foregroundInactiveColor = UIManager.getColor("ToolTip.foregroundInactive");
  }
  private void initialiseTrees() {
    AnalysedModuleDTO rootModule = new AnalysedModuleDTO("", "", "", "");
    DefaultMutableTreeNode rootTo = new DefaultMutableTreeNode(rootModule);
    DefaultMutableTreeNode rootFrom = new DefaultMutableTreeNode(rootModule);

    this.fromModuleTree = new JTree(rootTo);
    createTreeLayout(fromModuleTree);
    fromModuleTree.addTreeSelectionListener(this);

    this.toModuleTree = new JTree(rootFrom);
    createTreeLayout(toModuleTree);
    toModuleTree.addTreeSelectionListener(this);

    List<AnalysedModuleDTO> rootModules = dataControl.getRootModules();
    for (AnalysedModuleDTO module : rootModules) {
      DefaultMutableTreeNode toNode = new DefaultMutableTreeNode(module);
      DefaultMutableTreeNode fromNode = new DefaultMutableTreeNode(module);
      rootTo.add(toNode);
      fillNode(toNode);
      rootFrom.add(fromNode);
      fillNode(fromNode);
    }
    this.expandLeaf(toModuleTree, 1);
    this.expandLeaf(fromModuleTree, 1);

    fromModuleScrollPane.setBackground(UIManager.getColor("Panel.background"));
    fromModuleScrollPane.setViewportView(fromModuleTree);
    toModuleScrollPane.setBackground(UIManager.getColor("Panel.background"));
    toModuleScrollPane.setViewportView(toModuleTree);
  }
 @Override
 protected void paintComponent(Graphics g) {
   if (isSelected()) {
     setBackground(UIManager.getColor("Tree.selectionBackground"));
     g.setColor(UIManager.getColor("Tree.selectionBackground"));
     Dimension size = getSize();
     g.fillRect(0, 0, size.width, size.height);
     setForeground(UIManager.getColor("Tree.selectionForeground"));
   } else {
     setBackground(UIManager.getColor("ToggleButton.background"));
     Color foreground = UIManager.getColor("ToggleButton.foreground");
     switch (demo.getState()) {
       case STOPPED:
         {
           foreground = visitedForeground;
           break;
         }
       case FAILED:
         {
           foreground = failedForeground;
         }
     }
     setForeground(foreground);
   }
   super.paintComponent(g);
 }
  private void init() {

    energyConsumptionStatsPanel = new JPanel(new GridLayout(17, 2, 5, 5));
    energyStatisticsLeftAlligmentPanel = new JPanel(new BorderLayout());
    energyConsumptionStatsPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
    energyStatisticsLeftAlligmentPanel.setBackground(
        UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));

    createRRCStatsPanel();
    createPeripheralStatisticsPanel();

    energyStatisticsPanel = new JPanel();
    energyStatisticsPanel.setLayout(new VerticalLayout());
    energyStatisticsPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
    energyStatisticsHeaderLabel = new JLabel(rb.getString("energy.title"));
    energyStatisticsHeaderLabel.setFont(HEADER_FONT);
    energyStatisticsPanel.add(energyStatisticsHeaderLabel);

    spacePanel = new JPanel();
    spacePanel.setPreferredSize(new Dimension(this.getWidth(), HEADER_DATA_SPACING));
    spacePanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
    energyStatisticsPanel.add(spacePanel);

    energyStatisticsPanel.add(energyConsumptionStatsPanel);

    energyStatisticsLeftAlligmentPanel.add(energyStatisticsPanel, BorderLayout.WEST);
  }
  protected JComponent createTitleArea(String demoSetTitle) {
    JPanel titleAreaPanel = new JPanel(new BorderLayout());
    titlePanel =
        new GradientPanel(
            UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR1_KEY),
            UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR2_KEY));
    titlePanel.setLayout(new BorderLayout());
    titlePanel.setBorder(panelBorder);
    demoListLabel = new JLabel(demoSetTitle);
    demoListLabel.setOpaque(false);
    demoListLabel.setHorizontalAlignment(JLabel.LEADING);
    titlePanel.add(demoListLabel, BorderLayout.CENTER);
    titleAreaPanel.add(titlePanel, BorderLayout.NORTH);

    // Add panel with view combobox
    viewPanel = new JPanel();
    viewPanel.setLayout(new BoxLayout(viewPanel, BoxLayout.X_AXIS));
    viewPanel.setBorder(new CompoundBorder(chiselBorder, new EmptyBorder(12, 8, 12, 8)));
    JLabel viewLabel = new JLabel("Hi:");
    viewPanel.add(viewLabel);
    viewPanel.add(Box.createHorizontalStrut(6));
    JLabel viewComboBox = new JLabel();
    viewComboBox.setText(args[1].toUpperCase().toString());
    //        viewComboBox.addItem("By Category");
    viewPanel.add(viewComboBox);
    titleAreaPanel.add(viewPanel, BorderLayout.CENTER);

    return titleAreaPanel;
  }
 public DefaultCheckboxTreeCellRenderer() {
   this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
   add(this.checkBox);
   add(this.label);
   this.checkBox.setBackground(UIManager.getColor("Tree.textBackground"));
   this.setBackground(UIManager.getColor("Tree.textBackground"));
 }
Exemple #8
0
 /**
  * @return the color used to indicate when a component has focus. By default this uses the color
  *     (64,113,167), but you can override this by calling: <br>
  *     <code>UIManager.put("focusRing",customColor);</code>
  */
 public static Color getFocusRingColor() {
   Object obj = UIManager.getColor("Focus.color");
   if (obj instanceof Color) return (Color) obj;
   obj = UIManager.getColor("focusRing");
   if (obj instanceof Color) return (Color) obj;
   return new Color(64, 113, 167);
 }
 /** reset the renderer */
 protected void reset() {
   setBackground(UIManager.getColor("Table.background"));
   setForeground(UIManager.getColor("Table.foreground"));
   setBorder(null);
   setIcon(null);
   setToolTipText(null);
 }
 /**
  * Determines and answers the header's background color. Tries to lookup a special color from the
  * L&amp;F. In case it is absent, it uses the standard internal frame background.
  *
  * @return the color of the header's background
  */
 protected Color getHeaderBackground() {
   Color c = UIManager.getColor("SimpleInternalFrame.activeTitleBackground");
   if (c != null) return c;
   //        if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED)
   //            c = UIManager.getColor("InternalFrame.activeTitleGradient");
   return c != null ? c : UIManager.getColor("InternalFrame.activeTitleBackground");
 }
Exemple #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"));
 }
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   if (isSelected) {
     setForeground(table.getSelectionForeground());
     setBackground(table.getSelectionBackground());
   } else {
     setForeground(table.getForeground());
     setBackground(table.getBackground());
   }
   setFont(table.getFont());
   if (hasFocus) {
     setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
     if (table.isCellEditable(row, column)) {
       setForeground(UIManager.getColor("Table.focusCellForeground"));
       setBackground(UIManager.getColor("Table.focusCellBackground"));
     }
   } else {
     setBorder(new EmptyBorder(1, 2, 1, 2));
   }
   if (value != null) {
     setText(value.toString());
   } else {
     setText("");
   }
   adjustRowHeight(table, row, column);
   return this;
 }
    @Override
    public void paint(Graphics g) {
      if ((target instanceof Frame && !(target instanceof JFrame))
          || (target instanceof Dialog && !(target instanceof JDialog))) {
        SwingBaseWindow<?, ?> sf = SwingBaseWindow.this;
        Window f = target;

        Color bg = f.getBackground();
        if (bg == null) bg = UIManager.getColor("window");
        if (bg == null) bg = UIManager.getColor("control");
        if (bg == null) bg = Color.GRAY;

        g.setColor(bg);
        g.fillRect(0, 0, getWidth(), getHeight());

        Point f_loc = sf.getLocationOnScreen();
        Point p_loc = this.getLocationOnScreen();

        int dx = p_loc.x - f_loc.x;
        int dy = p_loc.y - f_loc.y;

        for (Component c : f.getComponents()) {
          Graphics cg = g.create(c.getX() - dx, c.getY() - dy, c.getWidth(), c.getHeight());
          c.paintAll(cg);
          cg.dispose();
        }
      }
    }
 public ScrollableTabButton(int direction) {
   super(
       direction,
       UIManager.getColor("TabbedPane.selected"),
       UIManager.getColor("TabbedPane.shadow"),
       UIManager.getColor("TabbedPane.darkShadow"),
       UIManager.getColor("TabbedPane.highlight"));
 }
 /**
  * Creates a {@code BasicArrowButton} whose arrow is drawn in the specified direction.
  *
  * @param direction the direction of the arrow; one of {@code SwingConstants.NORTH}, {@code
  *     SwingConstants.SOUTH}, {@code SwingConstants.EAST} or {@code SwingConstants.WEST}
  */
 public MyBasicArrowButton(int direction) {
   this(
       direction,
       UIManager.getColor("control"),
       UIManager.getColor("controlShadow"),
       UIManager.getColor("controlDkShadow"),
       UIManager.getColor("controlLtHighlight"));
 }
 private void actualizarActivo() {
   if (lado) {
     txtAyNBlancas.setBackground(new Color(204, 0, 0));
     txtAyNNegras.setBackground(UIManager.getColor("Button.background"));
   } else {
     txtAyNBlancas.setBackground(UIManager.getColor("Button.background"));
     txtAyNNegras.setBackground(new Color(204, 0, 0));
   }
 }
  public Component getTreeCellRendererComponent(
      JTree tree,
      Object value,
      boolean selected,
      boolean expanded,
      boolean leaf,
      int row,
      boolean hasFocus) {
    jl.setFont(tree.getFont());

    /*
     * Icons are *important*; this is (obviously) wholly inadequate ATM.
     * Individual programs should have their own icons, where possible
     * (ideally, favicons from main site pages). Seasons
     * could use Apple-alias-style derived icons, or something.
     */

    if (leaf) {
      jl.setIcon(UIManager.getIcon("Tree.leafIcon"));
    } else if (expanded) {
      jl.setIcon(UIManager.getIcon("Tree.openIcon"));
    } else {
      jl.setIcon(UIManager.getIcon("Tree.closedIcon"));
    }

    //        this.value = value.toString();
    jl.setText(value.toString());
    jl.setForeground(Color.BLACK);

    Checkable c = (Checkable) value;

    this.implicit = c.implicit;
    this.selected = c.isSelected();

    if (c instanceof EpisodeTreeNode) {
      EpisodeTreeNode n = (EpisodeTreeNode) c;
      if (n.icon != null) jl.setIcon(n.icon);
    }

    if (c.isLocal) {
      jl.setFont(jl.getFont().deriveFont(Font.BOLD));
    }

    if (c.isPartiallyLocal) {
      jl.setForeground(Color.BLUE);
    } else if (selected) {
      jl.setForeground(UIManager.getColor("Tree.selectionForeground"));
    }

    if (selected) {
      jl.setBackground(UIManager.getColor("Tree.selectionBackground"));
    } else {
      jl.setBackground(UIManager.getColor("Tree.textBackground"));
    }

    return this;
  }
Exemple #18
0
  @Override
  public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
    JComponent popup = (JComponent) c;
    g.translate(x, y);
    try {
      this.bottomLeft = (Image) popup.getClientProperty(RoundedPopupFactory.BOTTOM_LEFT_PIC);
      if (this.bottomLeft != null) {
        g.drawImage(this.bottomLeft, 0, h - 5, c);
      }

      this.bottomRight = (Image) popup.getClientProperty(RoundedPopupFactory.BOTTOM_RIGHT_PIC);
      if (this.bottomRight != null) {
        g.drawImage(this.bottomRight, w - 5, h - 5, c);
      }

      this.right = (Image) popup.getClientProperty(RoundedPopupFactory.RIGHT_PIC);
      if (this.right != null) {
        g.drawImage(this.right, w - 1, 0, c);
      }

      this.bottom = (Image) popup.getClientProperty(RoundedPopupFactory.BOTTOM_PIC);
      if (this.bottom != null) {
        g.drawImage(this.bottom, 5, h - 1, c);
      }
    } catch (Exception exp) {
      // do nothing
    }

    if (ShadowedPopupMenuBorder.POPUP_BOTTOM_LEFT != null)
      g.drawImage(ShadowedPopupMenuBorder.POPUP_BOTTOM_LEFT, 0, h - 5, popup);
    if (ShadowedPopupMenuBorder.POPUP_BOTTOM_RIGHT != null)
      g.drawImage(ShadowedPopupMenuBorder.POPUP_BOTTOM_RIGHT, w - 5, h - 5, popup);

    ColorUIResource c1 = new ColorUIResource(150, 150, 150);
    Color c4 = new Color(160, 160, 160, 100);
    ColorUIResource c2 = new ColorUIResource(135, 135, 135);

    g.setColor(UIManager.getColor("MenuItem.background"));
    g.drawLine(1, 0, w - 4, 0);
    g.drawLine(1, 1, w - 4, 1);
    g.drawLine(1, 0, 1, h - 7);
    g.drawLine(5, h - 3, w - 6, h - 3);
    g.setColor(UIManager.getColor("MenuItem.fadingColor"));
    g.drawLine(w - 3, 2, w - 3, h - 5);

    g.setColor(c1);
    g.drawLine(0, 0, 0, h - 6);
    g.setColor(c4);
    g.drawLine(5, h - 1, w - 6, h - 1);
    g.drawLine(w - 1, 2, w - 1, h - 6);

    g.setColor(c2);
    g.drawLine(w - 2, 0, w - 2, h - 6);
    g.drawLine(5, h - 2, w - 6, h - 2);

    g.translate(-x, -y);
  }
Exemple #19
0
 protected void renderColor(boolean selected) {
   if (selected) {
     setForeground(UIManager.getColor("Table.selectionForeground"));
     setBackground(UIManager.getColor("Table.selectionBackground"));
   } else {
     setForeground(UIManager.getColor("Table.foreground"));
     setBackground(UIManager.getColor("Table.background"));
   }
 }
  public MetalScrollButton(int direction, int width, boolean freeStanding) {
    super(direction);

    shadowColor = UIManager.getColor("ScrollBar.darkShadow");
    highlightColor = UIManager.getColor("ScrollBar.highlight");

    buttonWidth = width;
    isFreeStanding = freeStanding;
  }
    public void paintIcon(Component c, Graphics g, int x, int y) {
      Color oldColor = g.getColor();
      boolean enabled = c.isEnabled();
      boolean pressed = false;
      if (c instanceof JButton) {
        pressed = ((JButton) c).getModel().isPressed();
      }

      int i = 0;
      int j = 0;
      int w = Math.min(width, c.getWidth());
      int h = c.getHeight();
      if (h < 5 || w < 5) { // not enough space for the arrow
        g.setColor(oldColor);
        return;
      }

      int size = Math.min(h / 2, w / 2);
      size = Math.max(size, 2);
      int mid = size / 2;

      x = ((w - size) / 2); // center arrow
      y = (h - size) / 2; // center arrow
      if (pressed) {
        x++;
        y++;
      }
      g.translate(x, y); // move the x,y origin in the graphic

      if (enabled) g.setColor(UIManager.getColor("controlDkShadow")); // NOT
      // LOCALIZABLE
      else g.setColor(UIManager.getColor("controlShadow")); // NOT
      // LOCALIZABLE

      if (!enabled) {
        g.translate(1, 1);
        g.setColor(UIManager.getColor("controlLtHighlight")); // NOT
        // LOCALIZABLE
        for (i = size - 1; i >= 0; i--) {
          g.drawLine(mid - i, j, mid + i, j);
          j++;
        }
        g.translate(-1, -1);
        g.setColor(UIManager.getColor("controlShadow")); // NOT
        // LOCALIZABLE
      }

      j = 0;
      for (i = size - 1; i >= 0; i--) {
        g.drawLine(mid - i, j, mid + i, j);
        j++;
      }

      g.translate(-x, -y);
      g.setColor(oldColor);
    }
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {

      g.translate(x, y);
      g.setColor(UIManager.getColor("controlLtHighlight"));
      g.fillRect(0, 0, w, 1);
      g.fillRect(0, 1, 1, h - 1);
      g.setColor(UIManager.getColor("controlShadow"));
      g.fillRect(0, h - 1, w, 1);
      g.translate(-x, -y);
    }
 public SortedTableHeaderRenderer(TableSorter sorter) {
   this.m_sorter = sorter;
   setOpaque(true);
   setForeground(UIManager.getColor("TableHeader.foreground"));
   setBackground(UIManager.getColor("TableHeader.background"));
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   setFont(UIManager.getFont("TableHeader.font"));
   setHorizontalTextPosition(SwingConstants.LEFT);
   this.setIconTextGap(2);
 }
  /** Create a new instance of this renderer. Initialises a lot of values. */
  public DOMTreeCellRenderer() {
    textSelectColor = UIManager.getColor("Tree.selectionForeground");
    textUnselectColor = UIManager.getColor("Tree.textForeground");
    bgSelectColor = UIManager.getColor("Tree.selectionBackground");
    bgUnselectColor = UIManager.getColor("Tree.textBackground");
    borderColor = UIManager.getColor("Tree.selectionBorderColor");

    Object value = UIManager.get("Tree.drawsFocusBorderAroundIcon");
    iconFocusBorder = (value != null && ((Boolean) value).booleanValue());
  }
 private void createTreeLayout(JTree theTree) {
   DefaultTreeCellRenderer moduleNodeRenderer = new SoftwareTreeCellRenderer(dataControl);
   moduleNodeRenderer.setBackground(UIManager.getColor("Panel.background"));
   moduleNodeRenderer.setBackgroundNonSelectionColor(UIManager.getColor("Panel.background"));
   moduleNodeRenderer.setBackgroundSelectionColor(UIManager.getColor("Table.sortIconColor"));
   moduleNodeRenderer.setTextNonSelectionColor(UIManager.getColor("Panel.background"));
   moduleNodeRenderer.setTextSelectionColor(UIManager.getColor("Table.sortIconColor"));
   theTree.setCellRenderer(moduleNodeRenderer);
   theTree.setBackground(PANELBACKGROUND);
 }
Exemple #26
0
  public MultiLabel(String str, int horizontalAlignment, int textAlignment, int verticalAlignment) {
    this.setForeground(UIManager.getColor("Label.foreground"));
    this.setBackground(UIManager.getColor("Label.background"));
    this.setFont(UIManager.getFont("Label.font"));

    setText(str);
    this.horizontalAlignment = horizontalAlignment;
    this.textAlignment = textAlignment;
    this.verticalAlignment = verticalAlignment;
  }
  public Component getTableCellRendererComponent(
      ScreenView screenView,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {

    /*
     * Since the renderer is reusable, we must reinitialize it each time.
     */
    if (isSelected) {
      setForeground(screenView.getSelectionForeground());
      setBackground(screenView.getSelectionBackground());
    } else {
      setForeground(screenView.getForeground());
      setBackground(screenView.getBackground());
      // setBackground(Color.white);
    }

    setFont(screenView.getFont());

    if (hasFocus) {
      setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); // NOT
      // LOCALIZABLE
      if (screenView.isCellEditable(row, column)) {
        setForeground(UIManager.getColor("Table.focusCellForeground")); // NOT
        // LOCALIZABLE
        setBackground(UIManager.getColor("Table.focusCellBackground")); // NOT
        // LOCALIZABLE
      }
    } else {
      setBorder(noFocusBorder);
    }

    setIcon(null);
    setText("");
    setToolTipText(null);

    setValue(screenView, row, column, value);

    ScreenModel model = screenView.getModel();
    if (model instanceof DbDescriptionModel) {
      setEnabled(((DbDescriptionModel) model).isEditable(row));
    } else if (model instanceof DbListModel) {
      DbListModel dblm = (DbListModel) model;
      boolean editable = dblm.isCellEditable(row, column);
      boolean enabled = dblm.isCellEnabled(row, column);
      if (!enabled) {
        int i = 0;
      } else if (editable) setEnabled(editable);
    } else setEnabled(true);

    return this;
  }
  /** This method installs the defaults as specified by the look and feel. */
  protected void installDefaults() {
    LookAndFeel.installBorder(toolBar, "ToolBar.border");
    LookAndFeel.installColorsAndFont(
        toolBar, "ToolBar.background", "ToolBar.foreground", "ToolBar.font");

    dockingBorderColor = UIManager.getColor("ToolBar.dockingForeground");
    dockingColor = UIManager.getColor("ToolBar.dockingBackground");

    floatingBorderColor = UIManager.getColor("ToolBar.floatingForeground");
    floatingColor = UIManager.getColor("ToolBar.floatingBackground");
  }
  private static Color getButtonBackgroundColor() {
    Color color;

    if (isUsingDarculaUIFlavor()) {
      color = UIManager.getColor("ComboBox.darcula.arrowFillColor");
    } else {
      color = UIManager.getColor("ComboBox.buttonBackground");
    }

    return color == null ? UIUtil.getControlColor() : color;
  }
 protected void installDefaults() {
   LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE);
   LookAndFeel.installBorder(progressBar, "ProgressBar.border");
   LookAndFeel.installColorsAndFont(
       progressBar, "ProgressBar.background", "ProgressBar.foreground", "ProgressBar.font");
   cellLength = UIManager.getInt("ProgressBar.cellLength");
   if (cellLength == 0) cellLength = 1;
   cellSpacing = UIManager.getInt("ProgressBar.cellSpacing");
   selectionForeground = UIManager.getColor("ProgressBar.selectionForeground");
   selectionBackground = UIManager.getColor("ProgressBar.selectionBackground");
 }