Java Code Examples for javax.swing.JCheckBox#setForeground()
The following examples show how to use
javax.swing.JCheckBox#setForeground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StringCheckbox.java From pdfxtk with Apache License 2.0 | 7 votes |
public void create(PropertiesPanel panel) { panel.container.add(Awt.newComponent(), Awt.constraints(false)); JCheckBox cb = new JCheckBox(label, initialState); cb.setEnabled(enabled); cb.setForeground(required ? PropertiesPanel.REQUIRED : PropertiesPanel.NON_REQUIRED); panel.valuecmps.put(key, cb); panel.container.add(cb, Awt.constraints(true)); }
Example 2
Source File: KwikiDateModesSelectorPanel.java From ET_Redux with Apache License 2.0 | 6 votes |
private void SetupSliderLockCheckBox () { ChangeListener sliderLockChangeListener = new ChangeListener() { public void stateChanged ( ChangeEvent changeEvent ) { propertySupport.firePropertyChange(// SLIDER_LOCK_PROPERTY, "", String.valueOf( ((JCheckBox) changeEvent.getSource()).isSelected() ) ); } }; sliderLockCheckBox = new JCheckBox( "Lock Uncertainties" ); sliderLockCheckBox.setOpaque( false ); sliderLockCheckBox.setForeground( new java.awt.Color( 204, 0, 0 ) ); sliderLockCheckBox.setFont( new Font( "SansSerif", Font.BOLD, 9 ) ); sliderLockCheckBox.setBounds( 1, 60, 120, 15 ); sliderLockCheckBox.addChangeListener( sliderLockChangeListener ); add( sliderLockCheckBox, javax.swing.JLayeredPane.DEFAULT_LAYER ); }
Example 3
Source File: SettingsPage.java From xdm with GNU General Public License v2.0 | 5 votes |
private JCheckBox createCheckBox(String name, Font font) { JCheckBox chk = new JCheckBox(StringResource.get(name)); chk.setName(name); chk.setIcon(ImageResource.getIcon("unchecked.png", 16, 16)); chk.setSelectedIcon(ImageResource.getIcon("checked.png", 16, 16)); chk.setOpaque(false); chk.setFocusPainted(false); chk.setForeground(Color.WHITE); chk.setFont(font); return chk; }
Example 4
Source File: ColorizationFactor.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Creates the main frame for <code>this</code> sample. */ public ColorizationFactor() { super("Colorization factor"); this.setLayout(new BorderLayout()); final JPanel panel = new JPanel(new FlowLayout()); JButton button = new JButton("sample"); button.setBackground(Color.yellow); button.setForeground(Color.red); panel.add(button); JCheckBox checkbox = new JCheckBox("sample"); checkbox.setSelected(true); checkbox.setBackground(Color.green.brighter()); checkbox.setForeground(Color.blue.darker()); panel.add(checkbox); JRadioButton radiobutton = new JRadioButton("sample"); radiobutton.setSelected(true); radiobutton.setBackground(Color.yellow); radiobutton.setForeground(Color.green.darker()); panel.add(radiobutton); this.add(panel, BorderLayout.CENTER); JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JSlider colorizationSlider = new JSlider(0, 100, 50); colorizationSlider.addChangeListener((ChangeEvent e) -> { double val = colorizationSlider.getValue() / 100.0; SubstanceCortex.ComponentOrParentChainScope.setColorizationFactor(panel, val); panel.repaint(); }); controls.add(colorizationSlider); this.add(controls, BorderLayout.SOUTH); this.setSize(400, 200); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
Example 5
Source File: JPanel_AppManager.java From MobyDroid with Apache License 2.0 | 5 votes |
public JCheckBoxTableHeaderCellRenderer() { jCheckBox = new JCheckBox(); jCheckBox.setFont(UIManager.getFont("TableHeader.font")); jCheckBox.setBorder(UIManager.getBorder("TableHeader.cellBorder")); jCheckBox.setBackground(UIManager.getColor("TableHeader.background")); jCheckBox.setForeground(UIManager.getColor("TableHeader.foreground")); jCheckBox.setHorizontalAlignment(SwingConstants.CENTER); jCheckBox.setBorderPainted(true); }
Example 6
Source File: JPanel_TaskManager.java From MobyDroid with Apache License 2.0 | 5 votes |
public JCheckBoxTableHeaderCellRenderer() { jCheckBox = new JCheckBox(); jCheckBox.setFont(UIManager.getFont("TableHeader.font")); jCheckBox.setBorder(UIManager.getBorder("TableHeader.cellBorder")); jCheckBox.setBackground(UIManager.getColor("TableHeader.background")); jCheckBox.setForeground(UIManager.getColor("TableHeader.foreground")); jCheckBox.setHorizontalAlignment(SwingConstants.CENTER); jCheckBox.setBorderPainted(true); }
Example 7
Source File: ProjectSelectionPanel.java From netbeans with Apache License 2.0 | 5 votes |
private JCheckBox createComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { EclipseProject project = projects[row]; JCheckBox chb = new JCheckBox(); chb.setSelected(selectedProjects.contains(project) || requiredProjects.contains(project)); chb.setToolTipText(null); if (project.isImportSupported() && !requiredProjects.contains(project)) { chb.setEnabled(true); } else { // required and non-java project are disabled chb.setEnabled(false); if (!project.isImportSupported()) { chb.setToolTipText(ProjectImporterWizard.getMessage( "MSG_NonJavaProject", project.getName())); // NOI18N } } if (isSelected) { chb.setOpaque(true); chb.setForeground(table.getSelectionForeground()); chb.setBackground(table.getSelectionBackground()); } else { chb.setOpaque(false); chb.setForeground(table.getForeground()); chb.setBackground(table.getBackground()); } return chb; }
Example 8
Source File: EventsBreakpointCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
private static void setupCheckBoxToRender(JCheckBox chb, JList list, boolean isSelected, boolean cellHasFocus) { if (isSelected) { chb.setBackground(list.getSelectionBackground()); chb.setForeground(list.getSelectionForeground()); } else { chb.setBackground(list.getBackground()); chb.setForeground(list.getForeground()); } }
Example 9
Source File: ShowNextTime.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates a new instance of RecentProjects */ public ShowNextTime() { super( new BorderLayout() ); setOpaque(false); button = new JCheckBox( BundleSupport.getLabel( "ShowOnStartup" ) ); // NOI18N button.setSelected( WelcomeOptions.getDefault().isShowOnStartup() ); button.setOpaque( false ); button.setForeground( Utils.getTopBarForeground() ); button.setHorizontalTextPosition( SwingConstants.LEFT ); BundleSupport.setAccessibilityProperties( button, "ShowOnStartup" ); //NOI18N add( button, BorderLayout.CENTER ); button.addActionListener( this ); }
Example 10
Source File: CustomCheckBoxList.java From tmc-intellij with MIT License | 5 votes |
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(false); checkbox.setBorder( isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : new EmptyBorder(1, 1, 1, 1)); return checkbox; }
Example 11
Source File: CheckBoxList.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); return checkbox; }
Example 12
Source File: KwikiDateModesSelectorPanel.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @param enableThPa */ public void SetupDateCorrectionCheckBoxes ( boolean enableThPa ) { ActionListener dateCorrectionChkBoxActionListener = new ActionListener() { public void actionPerformed ( ActionEvent e ) { AbstractButton abstractButton = (AbstractButton) e.getSource(); String choice = abstractButton.getActionCommand(); CalculateDateCorrectionMode( choice ); } }; correctTh = new JCheckBox( "Th" ); correctTh.setActionCommand( "Th" ); correctTh.setOpaque( false ); correctTh.setForeground( new java.awt.Color( 204, 0, 0 ) ); correctTh.setFont( new Font( "SansSerif", Font.BOLD, 9 ) ); correctTh.setBounds( 125, 20, 45, 15 ); correctTh.setEnabled( enableThPa ); correctTh.addActionListener( dateCorrectionChkBoxActionListener ); add( correctTh, javax.swing.JLayeredPane.DEFAULT_LAYER ); correctPa = new JCheckBox( "Pa" ); correctPa.setActionCommand( "Pa" ); correctPa.setOpaque( false ); correctPa.setForeground( new java.awt.Color( 204, 0, 0 ) ); correctPa.setFont( new Font( "SansSerif", Font.BOLD, 9 ) ); correctPa.setBounds( 125, 40, 45, 15 ); correctPa.setEnabled( enableThPa ); correctPa.addActionListener( dateCorrectionChkBoxActionListener ); add( correctPa, javax.swing.JLayeredPane.DEFAULT_LAYER ); }
Example 13
Source File: JPlagCreator.java From jplag with GNU General Public License v3.0 | 5 votes |
public static JCheckBox createCheckBox(String toolTip) { JCheckBox box = new JCheckBox(); box.setFont(JPlagCreator.SYSTEM_FONT); box.setPreferredSize(new java.awt.Dimension(20, 20)); box.setForeground(JPlagCreator.OPTION_PANEL_FOREGROUND); box.setBackground(JPlagCreator.SYSTEMCOLOR); if (toolTip != null && !toolTip.equals("")) box.setToolTipText(toolTip); return box; }
Example 14
Source File: CheckboxTreeCellEditor.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 4 votes |
@Override public Component getTreeCellEditorComponent(JTree aTree, Object aValue, boolean isSelected, boolean isExpanded, boolean isLeaf, int isRow) { final JCheckBox theEditor = new JCheckBox(); UIInitializer.getInstance().initializeComponent(theEditor); editingNode = (DefaultMutableTreeNode) aValue; if (editingNode.getUserObject() instanceof SelectableWrapper) { SelectableWrapper theWrapper = (SelectableWrapper) editingNode .getUserObject(); theEditor.setEnabled(true); theEditor.setText(objectToString(theWrapper.getValue())); theEditor.setSelected(theWrapper.isSelected()); if (isSelected) { theEditor.setBackground(initializer.getConfiguration() .getDefaultListSelectionBackground()); theEditor.setForeground(initializer.getConfiguration() .getDefaultListSelectionForeground()); } else { theEditor.setBackground(initializer.getConfiguration() .getDefaultListNonSelectionBackground()); theEditor.setForeground(initializer.getConfiguration() .getDefaultListNonSelectionForeground()); } ItemListener theItemListener = itemEvent -> { if (stopCellEditing()) { SelectableTableModel theModel = (SelectableTableModel) tree.getModel(); theModel.setSelected(editingNode, theEditor.isSelected()); fireEditingStopped(); } }; theEditor.addItemListener(theItemListener); return theEditor; } throw new IllegalArgumentException("Wrong object type"); }
Example 15
Source File: JCheckBoxFactory.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
public static JCheckBox createJCheckBox(String description) { JCheckBox checkBox = new JCheckBox(description); checkBox.setForeground(ColorPalette.FOREGROUND_COLOR); checkBox.setFont(Fonts.FONT); return checkBox; }