Java 类java.awt.SystemColor 实例源码

项目:incubator-netbeans    文件:ColorComboBoxRenderer.java   
@Override
public Component getListCellRendererComponent (
    JList<? extends ColorValue>
                list,
    ColorValue  value,
    int         index,
    boolean     isSelected,
    boolean     cellHasFocus
) {
    this.value = value;
    setEnabled (list.isEnabled ());
    setBackground (isSelected ? 
        SystemColor.textHighlight : SystemColor.text
        //Color.RED
    );
    setForeground (isSelected ? 
        SystemColor.textHighlightText : SystemColor.textText
    );
    return this;
}
项目:powertext    文件:FastListUI.java   
private Color determineSelectionBackground() {
    Color c = UIManager.getColor("List.selectionBackground");
    if (c==null) {
        c = UIManager.getColor("nimbusSelectionBackground");
        if (c==null) { // Not Nimbus, but still need a value - fallback
            c = UIManager.getColor("textHighlight");
            if (c==null) {
                c = SystemColor.textHighlight;
            }
        }
    }

    // Nimbus unfortunately requires a Color, not a ColorUIResource, for
    // the background override to work. This causes this color to "stick"
    // even if the LAF is changed to something else later.  "c" here may
    // actually be a ColorUIResource
    return new Color(c.getRGB());//new ColorUIResource(c);

}
项目:jaer    文件:FilterPanel.java   
private void enabledCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enabledCheckBoxActionPerformed
    boolean yes = enabledCheckBox.isSelected();
    if (getFilter() != null) {
        getFilter().setFilterEnabled(yes);
    }

    if (yes) {
        ((TitledBorder) getBorder()).setTitleColor(SystemColor.textText);
        titledBorder.setBorder(redLineBorder);
    } else {
        ((TitledBorder) getBorder()).setTitleColor(SystemColor.textInactiveText);
        titledBorder.setBorder(normalBorder);
    }

    repaint();
    getFilter().setSelected(yes);
}
项目:parabuild-ci    文件:ConnectionDialog.java   
/**
 * Method declaration
 *
 *
 * @param center
 *
 * @return
 */
protected static Panel createBorderPanel(Component center) {

    Panel p = new Panel();

    p.setBackground(SystemColor.control);
    p.setLayout(new BorderLayout());
    p.add("Center", center);
    p.add("North", createLabel(""));
    p.add("South", createLabel(""));
    p.add("East", createLabel(""));
    p.add("West", createLabel(""));
    p.setBackground(SystemColor.control);

    return p;
}
项目:parabuild-ci    文件:ConnectionDialog.java   
/**
 * Method declaration
 *
 *
 * @param center
 *
 * @return
 */
protected static Panel createBorderPanel(Component center) {

    Panel p = new Panel();

    p.setBackground(SystemColor.control);
    p.setLayout(new BorderLayout());
    p.add("Center", center);
    p.add("North", createLabel(""));
    p.add("South", createLabel(""));
    p.add("East", createLabel(""));
    p.add("West", createLabel(""));
    p.setBackground(SystemColor.control);

    return p;
}
项目:openjdk-jdk10    文件:WPanelPeer.java   
@Override
void initialize() {
    super.initialize();
    insets_ = new Insets(0,0,0,0);

    Color c = ((Component)target).getBackground();
    if (c == null) {
        c = SystemColor.window;
        ((Component)target).setBackground(c);
        setBackground(c);
    }
    c = ((Component)target).getForeground();
    if (c == null) {
        c = SystemColor.windowText;
        ((Component)target).setForeground(c);
        setForeground(c);
    }
}
项目:wiimote-paintboard    文件:CameraMonitor.java   
public CameraMonitor(WiimoteDataHandler dh) {
    super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CameraMonitor.class).getString("monitor.Action.text"));
    getRootPane().putClientProperty("Window.style", "small");
    setLayout(new MigLayout());

    dh.addWiimoteDataListener(this);

    canvas = new JPanel(null, true);
    canvas.setOpaque(true);
    canvas.setBorder(BorderFactory.createLineBorder(SystemColor.inactiveCaptionBorder));
    add(canvas, "w 50sp, h 50sp, grow, push");

    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                setVisible(false);
            }
        }
    });

    pack();
    setLocationRelativeTo(null);

    new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ);
}
项目:pumpernickel    文件:JLink.java   
@Override
public void paint(Graphics g) {
  super.paint(g);

    if(drawLine) {
        LineMetrics m = getFont().getLineMetrics(getText(),frc);
        Insets i = getInsets();
        int descent = (int)m.getDescent()-4;
        if(isEnabled()) {
            g.setColor(getForeground());
        } else {
            g.setColor(SystemColor.textInactiveText);
        }
        g.drawLine(i.left,getHeight()-i.bottom-descent,getWidth()-i.right-1,getHeight()-i.bottom-descent);
    }
}
项目:ftc    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 *
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    boolean isNimbus = isNimbusLookAndFeel();
    if (c==null || isNimbus) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c==null || (isNimbus && isDerivedColor(c))) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}
项目:ftc    文件:FastListUI.java   
private Color determineSelectionBackground() {
    Color c = UIManager.getColor("List.selectionBackground");
    if (c==null) {
        c = UIManager.getColor("nimbusSelectionBackground");
        if (c==null) { // Not Nimbus, but still need a value - fallback
            c = UIManager.getColor("textHighlight");
            if (c==null) {
                c = SystemColor.textHighlight;
            }
        }
    }

    // Nimbus unfortunately requires a Color, not a ColorUIResource, for
    // the background override to work. This causes this color to "stick"
    // even if the LAF is changed to something else later.  "c" here may
    // actually be a ColorUIResource
    return new Color(c.getRGB());//new ColorUIResource(c);

}
项目:ftc    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 *
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    boolean isNimbus = isNimbusLookAndFeel();
    if (c==null || isNimbus) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c==null || (isNimbus && isDerivedColor(c))) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}
项目:cas    文件:EventManager.java   
public void ruleNumberEvent(){
    if(validator.isRuleNumberValid()){
        int value = Integer.valueOf(main.txtRuleNumber.getText());
        main.txtRuleNumber.setBackground(SystemColor.text);
        char[] binary = Integer.toBinaryString(value).toCharArray();
        int[] states = new int[8];
        for(int i = 0; i < states.length; i++){
            if(i < binary.length){
                states[i] = Integer.parseInt(String.valueOf(binary[binary.length - 1 - i]));
            } else {
                states[i] = 0;
            }
        }
        main.transitionsView.setStates(states);
    }
}
项目:Tank    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 * 
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    if (c == null || UIManager.getLookAndFeel().getName().equals("Nimbus")) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c == null) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}
项目:Tank    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 * 
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    if (c == null || UIManager.getLookAndFeel().getName().equals("Nimbus")) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c == null) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}
项目:swingx    文件:TaskPaneAddon.java   
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  Font taskPaneFont = UIManagerExt.getSafeFont("Label.font", new Font(
              "Dialog", Font.PLAIN, 12));
  taskPaneFont = taskPaneFont.deriveFont(Font.BOLD);

  Color menuBackground = new ColorUIResource(SystemColor.menu);

  defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicTaskPaneUI");
  defaults.add("TaskPane.font", new FontUIResource(taskPaneFont));
  defaults.add("TaskPane.background", UIManagerExt.getSafeColor("List.background",
            new ColorUIResource(Color.decode("#005C5C"))));
  defaults.add("TaskPane.specialTitleBackground", new ColorUIResource(menuBackground.darker()));
  defaults.add("TaskPane.titleBackgroundGradientStart", menuBackground);
  defaults.add("TaskPane.titleBackgroundGradientEnd", menuBackground);
  defaults.add("TaskPane.titleForeground", new ColorUIResource(SystemColor.menuText));
  defaults.add("TaskPane.specialTitleForeground", new ColorUIResource(SystemColor.menuText.brighter()));
  defaults.add("TaskPane.animate", Boolean.TRUE);
  defaults.add("TaskPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
          "ENTER", "toggleCollapsed",
          "SPACE", "toggleCollapsed"}));
}
项目:icedtea-web    文件:CachePane.java   
public void restoreDisabled() {
    cleanAll.setEnabled(true);
    // If nothing selected then keep deleteButton disabled
    if (!cacheTable.getSelectionModel().isSelectionEmpty()) {
        deleteButton.setEnabled(true);
    }
    // Enable buttons
    refreshButton.setEnabled(true);
    doneButton.setEnabled(true);
    // If cacheTable is empty disable it and set background
    // color to indicate being disabled
    if (cacheTable.getModel().getRowCount() == 0) {
        cacheTable.setEnabled(false);
        cacheTable.setBackground(SystemColor.control);
    }
    // Reset cursor
    parent.getContentPane().setCursor(Cursor.getDefaultCursor());
}
项目:dsworkbench    文件:ColoredProgressBar.java   
public ColoredProgressBar(int start, int end) {
    setMinimum(start);
    setMaximum(end);
    setForeground(SystemColor.window);
    setBackground(SystemColor.window);
    setBorder(new EmptyBorder(3, 5, 3, 5));
    Dimension size = new Dimension(300, 20);
    setPreferredSize(size);
    setMaximumSize(size);
    setMinimumSize(size);
    BasicProgressBarUI ui = new BasicProgressBarUI() {

        protected Color getSelectionForeground() {
            return Color.BLACK;
        }

        protected Color getSelectionBackground() {
            return Color.BLACK;
        }
    };
    setUI(ui);
}
项目:typecast    文件:TableTreeCellRenderer.java   
public void paint(Graphics g) {
    if (_selected) {
        g.setColor(SystemColor.textHighlight);
    } else if(getParent() != null) {
        g.setColor(getParent().getBackground());
    } else {
        g.setColor(getBackground());
    }
    Icon icon = getIcon();
    int offset = 0;
    if (icon != null && getText() != null) {
        offset = icon.getIconWidth() + getIconTextGap();
    }
    g.fillRect(offset, 0, getWidth() - 1 - offset, getHeight() - 1);
    super.paint(g);
}
项目:AtidDesktop    文件:Preview.java   
@Override
protected void paintComponent(Graphics g) {
    if (thumbnail == null) {
        loadImage();
    }
    if (thumbnail != null) {
        setBackground(Color.white);
        super.paintComponent(g);
        int x = getWidth() / 2 - thumbnail.getIconWidth() / 2;
        int y = getHeight() / 2 - thumbnail.getIconHeight() / 2;

        if (y < 0) {
            y = 0;
        }
        if (x < 0) {
            x = 0;
        }
        thumbnail.paintIcon(this, g, x, y);
    } else {
        setBackground(SystemColor.control);
        super.paintComponent(g);
    }
}
项目:ESPlorer    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 *
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    boolean isNimbus = isNimbusLookAndFeel();
    if (c==null || isNimbus) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c==null || (isNimbus && isDerivedColor(c))) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}
项目:ESPlorer    文件:FastListUI.java   
private Color determineSelectionBackground() {
    Color c = UIManager.getColor("List.selectionBackground");
    if (c==null) {
        c = UIManager.getColor("nimbusSelectionBackground");
        if (c==null) { // Not Nimbus, but still need a value - fallback
            c = UIManager.getColor("textHighlight");
            if (c==null) {
                c = SystemColor.textHighlight;
            }
        }
    }

    // Nimbus unfortunately requires a Color, not a ColorUIResource, for
    // the background override to work. This causes this color to "stick"
    // even if the LAF is changed to something else later.  "c" here may
    // actually be a ColorUIResource
    return new Color(c.getRGB());//new ColorUIResource(c);

}
项目:ESPlorer    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 *
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    boolean isNimbus = isNimbusLookAndFeel();
    if (c==null || isNimbus) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c==null || (isNimbus && isDerivedColor(c))) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}
项目:jplag    文件:InfoPanel.java   
/**
 * This method initializes jTopPanel    
 *  
 * @return javax.swing.JPanel   
 */
private JPanel getJTopPanel() {
    if (jTopPanel == null) {
        jTopPanel = new JPanel();
        CompoundBorder border = BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(SystemColor.activeCaption,2),
                JPlagCreator.titleBorder(Messages.getString(
                    "InfoPanel.JPlag_progress"))), //$NON-NLS-1$
            BorderFactory.createEmptyBorder(0,2,2,2));
        jTopPanel.setBorder(border);
        Insets insets = border.getBorderInsets(jTopPanel);
        jTopPanel.setPreferredSize(
            new java.awt.Dimension(490+insets.left+insets.right, 194));
        jTopPanel.setLayout(new BorderLayout());
        jTopPanel.add(getJPanel2(), java.awt.BorderLayout.NORTH);
        jTopPanel.add(getJProgressBar(), java.awt.BorderLayout.EAST);
    }
    return jTopPanel;
}
项目:aibench-project    文件:TaskPaneAddon.java   
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  Font taskPaneFont = UIManagerExt.getSafeFont("Label.font", new Font(
              "Dialog", Font.PLAIN, 12));
  taskPaneFont = taskPaneFont.deriveFont(Font.BOLD);

  Color menuBackground = new ColorUIResource(SystemColor.menu);

  defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicTaskPaneUI");
  defaults.add("TaskPane.font", new FontUIResource(taskPaneFont));
  defaults.add("TaskPane.background", UIManagerExt.getSafeColor("List.background",
            new ColorUIResource(Color.decode("#005C5C"))));
  defaults.add("TaskPane.specialTitleBackground", new ColorUIResource(menuBackground.darker()));
  defaults.add("TaskPane.titleBackgroundGradientStart", menuBackground);
  defaults.add("TaskPane.titleBackgroundGradientEnd", menuBackground);
  defaults.add("TaskPane.titleForeground", new ColorUIResource(SystemColor.menuText));
  defaults.add("TaskPane.specialTitleForeground", new ColorUIResource(SystemColor.menuText.brighter()));
  defaults.add("TaskPane.animate", Boolean.TRUE);
  defaults.add("TaskPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
          "ENTER", "toggleExpanded",
          "SPACE", "toggleExpanded"}));
}
项目:incubator-taverna-workbench    文件:ReportViewComponent.java   
private JPanel wrapComponent(JComponent c) {
    JPanel result = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = 2;
    gbc.weightx = 0.9;
    gbc.insets = rightGap;
    result.add(c, gbc);
    c.setBackground(SystemColor.text);
    gbc.weightx = 0.9;
    gbc.weighty = 0.9;
    gbc.gridx = 0;
    gbc.gridy++;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.BOTH;
    JPanel filler = new JPanel();
    filler.setBackground(SystemColor.text);
    result.setBackground(SystemColor.text);
    result.add(filler, gbc);
    return result;
}
项目:S3F    文件:ToolBarButton.java   
@Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
//            g.clearRect(29, 0, 55, 35);

            g.setColor((mouseOver || button.isSelected())
                    //                        ? SystemColor.controlDkShadow
                    //                        : SystemColor.activeCaptionBorder);
                    ? SystemColor.activeCaptionBorder
                    : SystemColor.control);

            g.drawLine(29, 7, 29, 27);

            if (ToolBarButton.this.actionListener != null) {
//                    g.setColor(SystemColor.activeCaptionBorder);
                g.setColor(SystemColor.controlDkShadow);
            }

            int x = 24 + 13;
            int y = this.getHeight() / 2 + 1;
            int aw = 4;
            int ah = 2;

            g.fillPolygon(new int[]{x - aw, x + aw, x}, new int[]{y - ah, y - ah, y + ah}, 3);
        }
项目:energy2d    文件:View2D.java   
private void showTipPopupMenu(String msg, int x, int y, int time) {
    if (tipPopupMenu == null) {
        tipPopupMenu = new JPopupMenu("Tip");
        tipPopupMenu.setBorder(BorderFactory.createLineBorder(Color.black));
        tipPopupMenu.setBackground(SystemColor.info);
        JLabel l = new JLabel(msg);
        l.setFont(new Font(null, Font.PLAIN, 10));
        l.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
        tipPopupMenu.add(l);
    } else {
        ((JLabel) tipPopupMenu.getComponent(0)).setText(msg);
    }
    tipPopupMenu.show(this, x, y);
    if (time > 0) {
        Timer timer = new Timer(time, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                tipPopupMenu.setVisible(false);
            }
        });
        timer.setRepeats(false);
        timer.setInitialDelay(time);
        timer.start();
    }
}
项目:cn1    文件:WinTextComponent.java   
public static void drawBackground(Graphics g, TextComponentState s,
                                  WinTheme t) {

    Color c = (s.isEnabled() ? s.getBackground() : SystemColor.control);

    WinThemeGraphics wgr = new WinThemeGraphics(g);

    if (t.isXpThemeActive()) {

        wgr.setTheme(t.getXpTheme("Edit")); //$NON-NLS-1$
        int flags = (s.isEnabled() ? WindowsConsts.ETS_NORMAL :
                     WindowsConsts.ETS_DISABLED);
        wgr.drawXpBackground(s.getSize(),
                WindowsConsts.EP_EDITTEXT, flags);
        if (s.isEnabled() && s.isBackgroundSet()) {
            fill(s, c, wgr);
        }

    } else {
        g.setColor(c);
        fill(s, c, wgr);
        wgr.drawEdge(s.getSize(), WindowsDefs.EDGE_SUNKEN);
    }
    wgr.dispose();
}
项目:cn1    文件:AWTHighlighter.java   
public void paintLayeredHighlights(final Graphics g, final int p0,
                                   final int p1, final Shape viewBounds,
                                   final View view) {
    if (start == null || end == null) {
        return;
    }
     int startOffset = getStartOffset();
     int endOffset = getEndOffset();

     if (endOffset > getDocumentLength() || startOffset > p1
            || endOffset < p0) {
         return;
     }
     TextUtils.paintLayer(g, Math.max(p0, startOffset),
                          Math.min(p1, endOffset), viewBounds,
                          SystemColor.textHighlight, view, true);
}
项目:cn1    文件:DefaultChoice.java   
public static Rectangle drawButton(Graphics g, ChoiceState s) {
    Dimension size = s.getSize();
    Rectangle buttonRect = getButtonRect(size);
    int dx = buttonRect.x;
    int dy = buttonRect.y;
    g.translate(dx, dy);
    g.setColor(SystemColor.control);
    int buttonWidth = buttonRect.width;
    int buttonHeight = buttonRect.height;
    g.fillRect(0, 0, buttonWidth, buttonHeight);
    DefaultScrollbar.paintArrowButton(g, DefaultScrollbar.SOUTH,
                                      buttonWidth,
                                      buttonHeight,
                                      s.isPressed(), s.isEnabled());
    g.translate(-dx, -dy);
    return buttonRect;
}
项目:cn1    文件:DefaultChoice.java   
public static void drawText(Graphics g, ChoiceState s) {
    String text = s.getText();
    if (text == null) {
        return;
    }

    Rectangle r = s.getTextBounds();

    Shape oldClip = g.getClip();
    g.clipRect(r.x, r.y, r.width, r.height);

    g.setFont(s.getFont());
    g.setColor(s.isFocused() ? SystemColor.textHighlightText
                             : s.getTextColor());
    int baseX = r.x;
    int baseY = r.y + r.height - s.getFontMetrics().getDescent();
    if (s.isEnabled()) {
        g.drawString(text, baseX, baseY);
    } else {
        drawDisabledString(g, text, baseX, baseY);
    }
    g.setClip(oldClip);
}
项目:cn1    文件:DefaultFileDialog.java   
public boolean show() {
    if (!shown) {
        fileDialog.setBackground(SystemColor.control);
        // create components & add listeners here
        createComponents();
        addLayoutComponents();
        addListeners();
        fileDialog.setSize(SIZE, SIZE);
        String file = fileDialog.getFile();
        File curFile = ((file != null) ? new File(file) : null);
        File curFolder = ((curFile != null) ?
                     curFile.getParentFile() : getDefaultFolder());
        changeDirectory(curFolder);
        if (curFile != null) {
            fileName.setText(file);
        }
        fillChoice();
        shown = true;
    }
    return true; // call Dialog's show()
}
项目:cn1    文件:DefaultScrollbar.java   
private static void paintTriangle(final Graphics g, final int[] x, final int[] y,
                                  final boolean isEnabled) {


    g.setColor(isEnabled ? arrowColor : SystemColor.controlShadow);
    g.fillPolygon(new Polygon(x, y, x.length));
    if (!isEnabled) {
        g.setColor(SystemColor.controlHighlight);
        int x1 = x[0] + 1;
        int y1 = y[0] + 1;
        int x2 = x[1] + 1;
        int y2 = y[1] + 1;
        g.drawLine(x1, y1, x2, y2);
    }

}
项目:cn1    文件:DefaultList.java   
private static void drawItem(int idx, Graphics g, ListState s) {        
    Rectangle itemRect = s.getItemBounds(idx);
    itemRect.width = s.getClient().width - itemRect.x + 1;
    int itemHeight = itemRect.height;        
    if (s.isSelected(idx)) {
        g.setColor(SystemColor.textHighlight);
        ((Graphics2D)g).fill(itemRect);
        g.setColor(SystemColor.textHighlightText);
    }
    String item = s.getItem(idx);
    FontMetrics fm = s.getFontMetrics();
    int baseLineOffset = itemHeight - fm.getDescent() - 1;
    g.drawString(item, itemRect.x + 1, baseLineOffset + itemRect.y);

    if (s.isSelected(idx)) {
        g.setColor(s.getTextColor());
    }
}
项目:cn1    文件:DefaultButton.java   
public static void drawBackground(Graphics g, ButtonState s) {
    Rectangle rect = s.getBounds();
    Color bkColor = s.isBackgroundSet() ? s.getBackground() :
                                          SystemColor.control;
    g.setColor(bkColor);
    g.fillRect(0, 0, rect.width, rect.height);

    drawButtonFrame(g, s.getBounds(), s.isPressed());

    if (s.isFocused()) {
        Color foreColor = s.isTextColorSet() ?
                s.getTextColor() :
                SystemColor.controlText;
        g.setColor(foreColor);

        drawFocusRect(g, 3, 3, rect.width - 7, rect.height - 7);
    }
}
项目:cn1    文件:DefaultButton.java   
public static void drawButtonFrame(Graphics g, Rectangle rect, boolean pressed) {
    if (pressed) {
        g.setColor(SystemColor.controlHighlight);
        g.drawLine(rect.width - 1, 0, rect.width - 1, rect.height - 1);
        g.drawLine(0, rect.height - 1, rect.width - 1, rect.height - 1);
        g.setColor(SystemColor.controlShadow);
        g.drawLine(1, 1, rect.width - 3, 1);
        g.drawLine(1, 1, 1, rect.height - 3);
        g.setColor(SystemColor.controlDkShadow);
        g.drawLine(0, 0, rect.width - 2, 0);
        g.drawLine(0, 0, 0, rect.height - 2);
    } else {
        g.setColor(SystemColor.controlHighlight);
        g.drawLine(0, 0, rect.width - 1, 0);
        g.drawLine(0, 0, 0, rect.height - 1);
        g.setColor(SystemColor.controlShadow);
        g.drawLine(rect.width - 2, 1, rect.width - 2, rect.height - 2);
        g.drawLine(1, rect.height - 2, rect.width - 2, rect.height - 2);
        g.setColor(SystemColor.controlDkShadow);
        g.drawLine(rect.width - 1, 0, rect.width - 1, rect.height - 1);
        g.drawLine(0, rect.height - 1, rect.width - 1, rect.height - 1);
    }
}
项目:cn1    文件:DefaultCheckbox.java   
private static void drawPressedRect(Graphics g, Rectangle rect,
                                    boolean pressed) {
    int w = rect.width;
    int h = rect.height;
    int x = rect.x;
    int y = rect.y;
    g.setColor(SystemColor.controlHighlight);

    g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
    g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    g.setColor(SystemColor.controlShadow);
    g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
    g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
    g.setColor(SystemColor.controlDkShadow);
    g.drawLine(x, y, x + w - 2, y);
    g.drawLine(x, y, x, y + h - 2);
    g.setColor(pressed ? pressedColor : SystemColor.window);
    g.fillRect(x+2, y+2, CB_SIZE - 2, CB_SIZE - 2);
}
项目:cn1    文件:DefaultCheckbox.java   
private static void drawPressedCircle(Graphics g, Rectangle rect,
                                      boolean pressed) {
    int w = rect.width;
    int h = rect.height;
    int x = rect.x;
    int y = rect.y;

    g.setColor(SystemColor.controlShadow);
    int startAngle = 45;
    int angle = 180;
    int endAngle = startAngle + angle;
    g.drawArc(x, y, w, h, startAngle, angle);
    g.setColor(SystemColor.controlDkShadow);
    g.drawArc(x + 1, y + 1, w - 1, h - 1,  startAngle, angle);

    g.setColor(SystemColor.controlHighlight);
    g.drawArc(x, y, w, h, endAngle, angle);
    g.setColor(SystemColor.controlLtHighlight);
    g.drawArc(x + 1, y + 1, w - 1, h - 1, endAngle, angle);
    g.setColor(pressed ? pressedColor : SystemColor.window);
    g.fillOval(x+2, y+2, CB_SIZE - 2, CB_SIZE - 2);

}
项目:ESPlorer    文件:TipUtil.java   
/**
 * Returns the default background color to use for tool tip windows.
 *
 * @return The default background color.
 */
public static Color getToolTipBackground() {

    Color c = UIManager.getColor("ToolTip.background");

    // Tooltip.background is wrong color on Nimbus (!)
    boolean isNimbus = isNimbusLookAndFeel();
    if (c==null || isNimbus) {
        c = UIManager.getColor("info"); // Used by Nimbus (and others)
        if (c==null || (isNimbus && isDerivedColor(c))) {
            c = SystemColor.info; // System default
        }
    }

    // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
    // with a ColorUIResource does nothing, must be a normal Color
    if (c instanceof ColorUIResource) {
        c = new Color(c.getRGB());
    }

    return c;

}