Example usage for java.awt SystemColor control

List of usage examples for java.awt SystemColor control

Introduction

In this page you can find the example usage for java.awt SystemColor control.

Prototype

SystemColor control

To view the source code for java.awt SystemColor control.

Click Source Link

Document

The color rendered for the background of control panels and control objects, such as pushbuttons.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println(SystemColor.control.getRGB());

}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(SystemColor.CONTROL);

}

From source file:Main.java

public static void main(String[] a) {
    Color[] sysColor = new Color[] { SystemColor.activeCaption, SystemColor.activeCaptionBorder,
            SystemColor.activeCaptionText, SystemColor.control, SystemColor.controlDkShadow,
            SystemColor.controlHighlight, SystemColor.controlLtHighlight, SystemColor.controlShadow,
            SystemColor.controlText, SystemColor.desktop, SystemColor.inactiveCaption,
            SystemColor.inactiveCaptionBorder, SystemColor.inactiveCaptionText, SystemColor.info,
            SystemColor.infoText, SystemColor.menu, SystemColor.menuText, SystemColor.scrollbar,
            SystemColor.text, SystemColor.textHighlight, SystemColor.textHighlightText,
            SystemColor.textInactiveText, SystemColor.textText, SystemColor.window, SystemColor.windowBorder,
            SystemColor.windowText };

    for (Color c : sysColor) {
        System.out.println(c);//from  w  w w  .  ja  va 2 s . co m

    }

}

From source file:Main.java

public static void setEnabledWithBackground(Component comp, boolean isEnabled) {
    comp.setEnabled(isEnabled);/*  w  ww .j a  va  2  s  .c o m*/
    if (isEnabled)
        comp.setBackground(SystemColor.text);
    else
        comp.setBackground(SystemColor.control);
}

From source file:TextBox3D.java

public synchronized void paint(Graphics g) {
    FontMetrics fm = g.getFontMetrics();
    Dimension size = getSize();//  w w w  . j  a v  a 2s. co m
    int x = (size.width - fm.stringWidth(text)) / 2;
    int y = (size.height - fm.getHeight()) / 2;
    g.setColor(SystemColor.control);
    g.fillRect(0, 0, size.width, size.height);
    g.setColor(SystemColor.controlShadow);
    g.drawLine(0, 0, 0, size.height - 1);
    g.drawLine(0, 0, size.width - 1, 0);
    g.setColor(SystemColor.controlDkShadow);
    g.drawLine(0, size.height - 1, size.width - 1, size.height - 1);
    g.drawLine(size.width - 1, 0, size.width - 1, size.height - 1);
    g.setColor(SystemColor.controlText);
    g.drawString(text, x, y);
}

From source file:Main.java

/**
 * Setups the given table for usage as row-header. This method setups the background color to
 * the same one than the column headers.
 *
 * {@note In a previous version, we were assigning to the row headers the same cell renderer than
 *        the one created by <cite>Swing</cite> for the column headers. But it produced strange
 *        effects when the L&F uses a vertical grandiant instead than a uniform color.}
 *
 * @param  table The table to setup as row headers.
 * @return The renderer which has been assigned to the table.
 *//*from  w  w  w . ja va  2  s  .c o m*/
public static TableCellRenderer setupAsRowHeader(final JTable table) {
    final JTableHeader header = table.getTableHeader();
    Color background = header.getBackground();
    Color foreground = header.getForeground();
    if (background == null || background.equals(table.getBackground())) {
        if (!SystemColor.control.equals(background)) {
            background = SystemColor.control;
            foreground = SystemColor.controlText;
        } else {
            final Locale locale = table.getLocale();
            background = UIManager.getColor("Label.background", locale);
            foreground = UIManager.getColor("Label.foreground", locale);
        }
    }
    final DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setBackground(background);
    renderer.setForeground(foreground);
    renderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
    final TableColumn column = table.getColumnModel().getColumn(0);
    column.setCellRenderer(renderer);
    column.setPreferredWidth(60);
    table.setPreferredScrollableViewportSize(table.getPreferredSize());
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setCellSelectionEnabled(false);
    return renderer;
}

From source file:ItemEventComponent.java

MainClass() {
    super("Listening In");
    ItemEventComponent c = new ItemEventComponent();
    add(c, "Center");
    c.addItemListener(this);
    c.setBackground(SystemColor.control);
    setSize(200, 200);// w  w  w. jav  a2s .c om
}

From source file:au.org.ala.delta.intkey.ui.MultiStateInputDialog.java

/**
 * ctor//from w  w w.  ja v a2 s  . co  m
 * 
 * @param owner
 *            Owner frame of dialog
 * @param ch
 *            the character whose states are being set
 * @param initialSelectedStates
 *            initial states that should be selected in the dialog. In
 *            general this should be any states already set for the
 *            character. In the case that this is a controlling character
 *            being set before its dependent character, all states that make
 *            the dependent character applicable should be selected.
 * @param dependentCharacter
 *            the dependent character - if the dialog is being used to set a
 *            controlling character before its dependent character, this
 *            argument should be a reference to the dependent character. In
 *            all other cases it should be null.
 * @param imageSettings
 *            image settings
 * @param displayNumbering
 *            true if numbering should be displayed
 * @param enableImagesButton
 *            the if the images button should be enabled
 * @param imagesStartScaled
 *            true if images should start scaled.
 */
public MultiStateInputDialog(Frame owner, MultiStateCharacter ch, Set<Integer> initialSelectedStates,
        au.org.ala.delta.model.Character dependentCharacter, ImageSettings imageSettings,
        boolean displayNumbering, boolean enableImagesButton, boolean imagesStartScaled, boolean advancedMode) {
    super(owner, ch, imageSettings, displayNumbering, enableImagesButton, imagesStartScaled, advancedMode);

    ResourceMap resourceMap = Application.getInstance().getContext()
            .getResourceMap(MultiStateInputDialog.class);
    resourceMap.injectFields(this);

    setTitle(title);
    setPreferredSize(new Dimension(600, 350));

    if (dependentCharacter != null) {
        _pnlControllingCharacterMessage = new JPanel();
        _pnlControllingCharacterMessage.setFocusable(false);
        _pnlControllingCharacterMessage.setBorder(new EmptyBorder(5, 0, 0, 0));
        _pnlMain.add(_pnlControllingCharacterMessage, BorderLayout.SOUTH);
        _pnlControllingCharacterMessage.setLayout(new BorderLayout(0, 0));

        _lblWarningIcon = new JLabel("");
        _lblWarningIcon.setFocusable(false);
        _lblWarningIcon.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
        _pnlControllingCharacterMessage.add(_lblWarningIcon, BorderLayout.WEST);

        _txtControllingCharacterMessage = new JTextArea();
        _txtControllingCharacterMessage.setText(MessageFormat.format(setControllingCharacterMessage,
                _formatter.formatCharacterDescription(dependentCharacter),
                _formatter.formatCharacterDescription(ch)));
        _txtControllingCharacterMessage.setFocusable(false);
        _txtControllingCharacterMessage.setBorder(new EmptyBorder(0, 5, 0, 0));
        _txtControllingCharacterMessage.setEditable(false);
        _pnlControllingCharacterMessage.add(_txtControllingCharacterMessage);
        _txtControllingCharacterMessage.setWrapStyleWord(true);
        _txtControllingCharacterMessage.setFont(UIManager.getFont("Button.font"));
        _txtControllingCharacterMessage.setLineWrap(true);
        _txtControllingCharacterMessage.setBackground(SystemColor.control);
    }

    _scrollPane = new JScrollPane();
    _pnlMain.add(_scrollPane, BorderLayout.CENTER);

    _list = new JList();
    _scrollPane.setViewportView(_list);

    _listModel = new DefaultListModel();
    for (int i = 0; i < ch.getNumberOfStates(); i++) {
        _listModel.addElement(_formatter.formatState(ch, i + 1));
    }

    _list.setModel(_listModel);

    _list.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() > 1) {
                // Treat double click on a list item as the ok button being
                // pressed.
                _okPressed = true;
                handleBtnOKClicked();
            }
        }

    });

    // Select the list items that correspond to the initial selected states.
    if (initialSelectedStates != null) {
        List<Integer> listIndiciesToSelect = new ArrayList<Integer>();
        for (int stateNumber : new ArrayList<Integer>(initialSelectedStates)) {
            listIndiciesToSelect.add(stateNumber - 1);
        }

        Integer[] wrappedPrimitivesList = listIndiciesToSelect
                .toArray(new Integer[initialSelectedStates.size()]);
        _list.setSelectedIndices(ArrayUtils.toPrimitive(wrappedPrimitivesList));
    }

    _inputData = new HashSet<Integer>();

}

From source file:com.francetelecom.rd.dashboard.pc.DashboardPC.java

/**
 * Create the frame./* ww w  . ja  v  a2 s  . c o m*/
 */
public DashboardPC() {

    myRulePanelMap = new HashMap<String, JPanel>();

    setResizable(false);
    setTitle("Home Life Context");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 583, 478);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    ruleTabContent = new JPanel();
    ruleTabContent.setBackground(SystemColor.control);
    ruleTabContent.setBorder(new EmptyBorder(5, 5, 5, 5));
    ruleTabContent.setLayout(null);

    nodeTabContent = new JPanel();
    nodeTabContent.setBackground(SystemColor.control);
    nodeTabContent.setBorder(new EmptyBorder(5, 5, 5, 5));
    nodeTabContent.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 11, 557, 422);
    tabbedPane.add("Rules", ruleTabContent);
    tabbedPane.setEnabledAt(0, true);

    rulesContent = new JPanel();
    int initialWidth = 2 * rulePanel_width + interCellSpace;
    int initialHeight = rulePanel_height;
    rulesContent.setBounds(10, 11, initialWidth, initialHeight);
    //ruleTabContent.add(rulesContent);
    rulesContent.setLayout(new GridLayout(0, 2, interCellSpace, interCellSpace));

    scrollRuleList = new JScrollPane(rulesContent);
    scrollRuleList.setBounds(1, 1, scrollArea_maxWidth, initialHeight);
    ruleTabContent.add(scrollRuleList);

    tabbedPane.add("Nodes", nodeTabContent);
    tabbedPane.setEnabledAt(1, true);
    contentPane.add(tabbedPane);

    /*
    // small rule panel
            
    JPanel panelRule = new JPanel();
    rulesContent.add(panelRule);
    panelRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelRule.setLayout(null);
            
    JPanel rulePanelServicePhoto = new JPanel();
    rulePanelServicePhoto.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    rulePanelServicePhoto.setBounds(10, 16, 27, 27);
    panelRule.add(rulePanelServicePhoto);
            
    JLabel ruleLblServiceName = new JLabel("Service friendly name");
    ruleLblServiceName.setFont(new Font("Arial", Font.BOLD, 15));
    ruleLblServiceName.setForeground(new Color(100, 149, 237));
    ruleLblServiceName.setBounds(47, 11, 212, 18);
    panelRule.add(ruleLblServiceName);
            
    JLabel ruleLblIf = new JLabel("IF");
    ruleLblIf.setForeground(Color.GRAY);
    ruleLblIf.setFont(new Font("Arial", Font.BOLD, 30));
    ruleLblIf.setBounds(10, 49, 27, 35);
    panelRule.add(ruleLblIf);
            
    JLabel ruleLblConditionParam = new JLabel("Condition parameter");
    ruleLblConditionParam.setFont(new Font("Arial", Font.BOLD, 13));
    ruleLblConditionParam.setForeground(Color.GRAY);
    ruleLblConditionParam.setBounds(47, 49, 192, 35);
    panelRule.add(ruleLblConditionParam);
            
    JLabel ruleLblOnDevice = new JLabel("on device name");
    ruleLblOnDevice.setForeground(Color.GRAY);
    ruleLblOnDevice.setFont(new Font("Arial", Font.PLAIN, 11));
    ruleLblOnDevice.setBounds(47, 29, 212, 14);
    panelRule.add(ruleLblOnDevice);
            
    // small add rule panel
            
    JPanel panelAddRule = new JPanel();
    rulesContent.add(panelAddRule);
    panelAddRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelAddRule.setLayout(null);
            
    JLabel addRuleLbl = new JLabel("Configure new rule");
    addRuleLbl.setHorizontalAlignment(SwingConstants.CENTER);
    addRuleLbl.setForeground(new Color(169, 169, 169));
    addRuleLbl.setFont(new Font("Arial", Font.BOLD, 13));
    addRuleLbl.setBounds(10, 25, 229, 27);
    panelAddRule.add(addRuleLbl);
            
    JButton addRuleBtn = new JButton("+");
    addRuleBtn.setForeground(new Color(128, 128, 128));
    addRuleBtn.setBounds(100, 57, 41, 23);
    panelAddRule.add(addRuleBtn);
     */
}

From source file:gdsc.smlm.ij.plugins.PSFCalculator.java

private void disableEditing(TextField textField) {
    textField.setEditable(false);
    textField.setBackground(SystemColor.control);
}