Java Code Examples for javax.swing.JRadioButton#setForeground()
The following examples show how to use
javax.swing.JRadioButton#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: SettingsPage.java From xdm with GNU General Public License v2.0 | 5 votes |
private JRadioButton createRadioButton(String name, Font font) { JRadioButton chk = new JRadioButton(StringResource.get(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 2
Source File: BatchPatternDialog.java From xdm with GNU General Public License v2.0 | 5 votes |
private JRadioButton createRadioButton(String name, Font font) { JRadioButton chk = new JRadioButton(StringResource.get(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 3
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 4
Source File: MaterialRadioButtonUI.java From material-ui-swing with MIT License | 5 votes |
@Override public void installUI (JComponent c) { super.installUI (c); JRadioButton radioButton = (JRadioButton) c; radioButton.setFont (UIManager.getFont ("RadioButton.font")); radioButton.setBackground (UIManager.getColor ("RadioButton.background")); radioButton.setForeground (UIManager.getColor ("RadioButton.foreground")); radioButton.setIcon (UIManager.getIcon ("RadioButton.icon")); radioButton.setSelectedIcon (UIManager.getIcon ("RadioButton.selectedIcon")); c.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }
Example 5
Source File: JRadioButtonFactory.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
public static JRadioButton createJRadioButton(String description) { JRadioButton radioButton = new JRadioButton(description); radioButton.setForeground(ColorPalette.FOREGROUND_COLOR); radioButton.setFont(Fonts.FONT); return radioButton; }
Example 6
Source File: KwikiDateModesSelectorPanel.java From ET_Redux with Apache License 2.0 | 4 votes |
private void SetupUncertaintyModeButtonGroup () { uncertaintyModeGroup = new ButtonGroup(); ActionListener uncertaintyModeActionListener = new ActionListener() { public void actionPerformed ( ActionEvent e ) { propertySupport.firePropertyChange(// UNCERTAINTY_MODE_PROPERTY, "", ((JRadioButton) e.getSource()).getActionCommand() ); } }; JRadioButton analyticalRB = new JRadioButton( "Analytical", true ); analyticalRB.setActionCommand( "Analytical" ); uncertaintyModeGroup.add( analyticalRB ); analyticalRB.setOpaque( false ); analyticalRB.setForeground( new java.awt.Color( 204, 0, 0 ) ); analyticalRB.setFont( new Font( "SansSerif", Font.BOLD, 9 ) ); analyticalRB.setBounds( 1, 2, 130, 16 ); analyticalRB.addActionListener( uncertaintyModeActionListener ); add( analyticalRB, javax.swing.JLayeredPane.DEFAULT_LAYER ); JRadioButton tracerRB = new JRadioButton( "+ Tracer", false ); tracerRB.setActionCommand( "Tracer" ); uncertaintyModeGroup.add( tracerRB ); tracerRB.setOpaque( false ); tracerRB.setForeground( new java.awt.Color( 204, 0, 0 ) ); tracerRB.setFont( new Font( "SansSerif", Font.BOLD, 9 ) ); tracerRB.setBounds( 1, 21, 130, 16 ); tracerRB.addActionListener( uncertaintyModeActionListener ); add( tracerRB, javax.swing.JLayeredPane.DEFAULT_LAYER ); JRadioButton lambdaRB = new JRadioButton( "+ decay constants", false ); lambdaRB.setActionCommand( "Lambda" ); uncertaintyModeGroup.add( lambdaRB ); lambdaRB.setOpaque( false ); lambdaRB.setForeground( new java.awt.Color( 204, 0, 0 ) ); lambdaRB.setFont( new Font( "SansSerif", Font.BOLD, 9 ) ); lambdaRB.setBounds( 1, 40, 130, 16 ); lambdaRB.addActionListener( uncertaintyModeActionListener ); add( lambdaRB, javax.swing.JLayeredPane.DEFAULT_LAYER ); }
Example 7
Source File: EphemerisView.java From Astrosoft with GNU General Public License v2.0 | 4 votes |
private JPanel createEphModeSelector(Color bgClr, Color fgClr){ JPanel panel = new JPanel(); ActionListener modeListener = new ActionListener(){ public void actionPerformed(ActionEvent e) { ephMode = Mode.valueOf(e.getActionCommand()); if (ephMode.isMonthly()){ tablePanel.setScrollPaneSize(monthyTableSize); ((CalendarSpinner) monthChooser).setDateFormat(CalendarSpinner.FMT_YEAR); }else{ tablePanel.setScrollPaneSize(dailyTableSize); int row = ephTable.getSelectedRow(); if (row != -1){ ephDate.set(Calendar.MONTH, row); } monthChooser.setSelectedDate(ephDate.getTime()); ((CalendarSpinner) monthChooser).setDateFormat(CalendarSpinner.FMT_MONTH_YEAR); } updateEphTable(); } }; ButtonGroup bg = new ButtonGroup(); for(Mode m : Mode.values()){ JRadioButton button = new JRadioButton(m.toString()); bg.add(button); button.setActionCommand(m.name()); button.addActionListener(modeListener); panel.add(button); button.setBackground(bgClr); button.setForeground(fgClr); if ( m == ephMode) { button.setSelected(true); } } panel.setBackground(bgClr); return panel; }