Java Code Examples for javax.swing.JRadioButton#setFont()

The following examples show how to use javax.swing.JRadioButton#setFont() . 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: DataPresentationModeChooserPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
private JRadioButton buttonForFitFunctionFactory(//
        int pixelsFromTop, //
        final DataPresentationModeEnum myDataPresentationMode) {

    JRadioButton dataViewModeButton = new JRadioButton(myDataPresentationMode.getName());
    dataViewModeButton.setName(myDataPresentationMode.getName());
    dataViewModeButton.setFont(new Font("SansSerif", Font.PLAIN, 10));
    dataViewModeButton.setBounds(5, pixelsFromTop, 90, 20);
    dataViewModeButton.setSelected(myDataPresentationMode.equals(dataPresentationMode));
    dataViewModeButton.setBackground(this.getBackground());
    dataViewModeButton.setOpaque(true);

    dataViewModeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            ((AbstractRawDataView) sampleSessionDataView).setDataPresentationMode(myDataPresentationMode);
            ((AbstractRawDataView) sampleSessionDataView).refreshPanel(true, false);

        }
    });

    dataViewModeButtonGroup.add(dataViewModeButton);
    return dataViewModeButton;
}
 
Example 2
Source File: SettingsPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
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: BatchPatternDialog.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
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 4
Source File: MaterialRadioButtonUI.java    From material-ui-swing with MIT License 5 votes vote down vote up
@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: ChartTableToggle.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
public ChartTableToggle(NMONVisualizerGui gui) {
    // border layout pads differently than the default flow layout
    // use it so the text for the radio buttons lines up with other text in the parent
    super(new BorderLayout());

    this.gui = gui;

    charts = new JRadioButton("Charts");
    table = new JRadioButton("Table");

    charts.setFont(Styles.LABEL);
    table.setFont(Styles.LABEL);

    charts.setBorder(Styles.CONTENT_BORDER);
    table.setBorder(Styles.CONTENT_BORDER);

    charts.setActionCommand("Charts");
    table.setActionCommand("Table");

    ActionListener toggle = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ChartTableToggle.this.gui.setProperty("chartsDisplayed", !e.getActionCommand().equals("Table"));
        }
    };

    charts.addActionListener(toggle);
    table.addActionListener(toggle);

    ButtonGroup group = new ButtonGroup();
    group.add(charts);
    group.add(table);

    charts.setSelected(true);
    table.setSelected(false);

    add(charts, BorderLayout.LINE_START);
    add(table, BorderLayout.LINE_END);

    gui.addPropertyChangeListener("chartsDisplayed", this);
}
 
Example 6
Source File: ControlPanel.java    From gepard with MIT License 4 votes vote down vote up
private JRadioButton getCustomRadioButton(String caption) {
	JRadioButton ret = new JRadioButton(caption);
	ret.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	ret.setFont(MAIN_FONT);
	return ret;
}
 
Example 7
Source File: JRadioButtonFactory.java    From WorldGrower with GNU General Public License v3.0 4 votes vote down vote up
public static JRadioButton createJRadioButton(String description) {
	JRadioButton radioButton = new JRadioButton(description);
	radioButton.setForeground(ColorPalette.FOREGROUND_COLOR);
	radioButton.setFont(Fonts.FONT);
	return radioButton;
}
 
Example 8
Source File: AbstractValueModelsPanelView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
/**
 *
 *
 * @param ValueModels the value of ValueModels
 */
public AbstractValueModelsPanelView ( ValueModel[] ValueModels ) {

    valueModelViews = new AbstractValueModelView[ValueModels.length];

    JLabel ratioLabel = new JLabel( "<html><u>Name</u></html>" );
    ratioLabel.setFont(ReduxConstants.sansSerif_12_Bold );
    ratioLabel.setHorizontalAlignment( SwingConstants.CENTER );
    ratioLabel.setBounds( 0, 2, 100, AbstractValueModelView.PANEL_HEIGHT );
    this.add( ratioLabel );

    JLabel valueLabel = new JLabel( "<html><u>Value</u></html>" );
    valueLabel.setFont(ReduxConstants.sansSerif_12_Bold );
    valueLabel.setHorizontalAlignment( SwingConstants.CENTER );
    valueLabel.setBounds( 110, 2, 150, AbstractValueModelView.PANEL_HEIGHT );
    this.add( valueLabel );

    absUnctRadioButton = new JRadioButton( "<html><u>1\u03C3 ABS</u></html>" );
    absUnctRadioButton.setName( "ABS" );
    absUnctRadioButton.setFont(ReduxConstants.sansSerif_10_Bold );
    absUnctRadioButton.setHorizontalAlignment( SwingConstants.CENTER );
    absUnctRadioButton.setBounds( 300, 2, 75, AbstractValueModelView.PANEL_HEIGHT );
    this.add( absUnctRadioButton );

    pctUnctRadioButton = new JRadioButton( "<html><u>1\u03C3 PCT</u></html>" );
    pctUnctRadioButton.setName( "PCT" );
    pctUnctRadioButton.setFont(ReduxConstants.sansSerif_10_Bold );
    pctUnctRadioButton.setHorizontalAlignment( SwingConstants.CENTER );
    pctUnctRadioButton.setBounds( 370, 2, 75, AbstractValueModelView.PANEL_HEIGHT );
    this.add( pctUnctRadioButton );

    ButtonGroup uncertaintyGroup = new ButtonGroup();
    uncertaintyGroup.add( absUnctRadioButton );
    uncertaintyGroup.add( pctUnctRadioButton );

    ActionListener uncertaintyActionListener = new ActionListener() {
        String lastSelectedName = "ABS";

        public void actionPerformed ( ActionEvent actionEvent ) {
            AbstractButton aButton = (AbstractButton) actionEvent.getSource();
            String name = aButton.getName();

            if (  ! name.equalsIgnoreCase( lastSelectedName ) ) {
                lastSelectedName = name;

                for (int i = 0; i < valueModelViews.length; i ++) {
                    valueModelViews[i].toggleShowOneSigmaAsPerCent();
                }
            }
        }
    };

    absUnctRadioButton.addActionListener( uncertaintyActionListener );
    pctUnctRadioButton.addActionListener( uncertaintyActionListener );

}
 
Example 9
Source File: KwikiDateModesSelectorPanel.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
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 10
Source File: KwikiPDFToolBar.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
private void SetupDateChooserButtons() {
    dateChooserButtonGroup = new ButtonGroup();

    date206_238_radioButton = new JRadioButton("206/238");
    dateChooserButtonGroup.add(date206_238_radioButton);
    date206_238_radioButton.setFont(new java.awt.Font("Arial", 1, 10));
    date206_238_radioButton.setText("206/238");
    date206_238_radioButton.setName("age206_238r");
    date206_238_radioButton.setBounds(40, 1, 70, 17);
    date206_238_radioButton.setSelected(true);
    date206_238_radioButton.setOpaque(true);
    date206_238_radioButton.setBackground(Color.white);
    add(date206_238_radioButton);

    date207_206_radioButton = new JRadioButton("207/206");
    dateChooserButtonGroup.add(date207_206_radioButton);
    date207_206_radioButton.setFont(new java.awt.Font("Arial", 1, 10));
    date207_206_radioButton.setText("207/206");
    date207_206_radioButton.setName("age207_206r");
    date207_206_radioButton.setBounds(40, 19, 70, 17);
    date207_206_radioButton.setOpaque(true);
    date207_206_radioButton.setBackground(Color.white);
    add(date207_206_radioButton);

    dateBest_radioButton = new JRadioButton("best");
    dateChooserButtonGroup.add(dateBest_radioButton);
    dateBest_radioButton.setFont(new java.awt.Font("Arial", 1, 10));
    dateBest_radioButton.setText("best");
    dateBest_radioButton.setName("bestAge");
    dateBest_radioButton.setOpaque(true);
    dateBest_radioButton.setBackground(Color.white);
    dateBest_radioButton.setBounds(40, 37, 70, 17);

    add(dateBest_radioButton);

    // choose date
    for (Enumeration e = dateChooserButtonGroup.getElements(); e.hasMoreElements();) {
        final JRadioButton jrb = (JRadioButton) e.nextElement();
        jrb.addActionListener((ActionEvent arg0) -> {
            // oct 2014 handle new Pbc corrections
            String chosenDateName = jrb.getName();

            ((DateProbabilityDensityPanel) probabilityPanel).setChosenDateName(chosenDateName);
            ((DateProbabilityDensityPanel) probabilityPanel).//
                    setSelectedFractions(sample.getUpbFractionsUnknown());
            ((DateProbabilityDensityPanel) probabilityPanel).prepareAndPaintPanel();
        });
    }

}
 
Example 11
Source File: AbstractFitFunctionPresentationView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
private JRadioButton radioButtonForFitFunctionFactory(//
            final DataModelFitFunctionInterface rawRatioDataModel, final FitFunctionTypeEnum fitFunctionType) {

        // feb 2013
        String overDispersion = "";
        DecimalFormat f = new DecimalFormat("0.000");
        if (fitFunctionType.compareTo(FitFunctionTypeEnum.MEAN_DH) == 0) {
            if (((RawRatioDataModel)rawRatioDataModel).isOverDispersionSelectedDownHole()&& rawRatioDataModel.doesFitFunctionTypeHaveOD(fitFunctionType)) {
                overDispersion = "-OD \u03BE = " + f.format(rawRatioDataModel.getXIforFitFunction(fitFunctionType));
            }
        } else {
            if (rawRatioDataModel.isOverDispersionSelected() && rawRatioDataModel.doesFitFunctionTypeHaveOD(fitFunctionType)) {
                if (fitFunctionType.compareTo(FitFunctionTypeEnum.SMOOTHING_SPLINE) == 0) {
                    overDispersion = "-OD";
                } else {
                    overDispersion = "-OD \u03BE = " + f.format(rawRatioDataModel.getXIforFitFunction(fitFunctionType));
                }
            }
        }

        JRadioButton functionChoiceRadioButton = new JRadioButton(fitFunctionType.getPrettyName() + overDispersion);
        functionChoiceRadioButton.setName(fitFunctionType.getName());
        functionChoiceRadioButton.setFont(ReduxConstants.sansSerif_10_Plain);//    new Font("SansSerif", Font.PLAIN, 10));
        functionChoiceRadioButton.setBounds(1, 1, 160, 17);
        functionChoiceRadioButton.setOpaque(false);

        if (fitFunctionType.compareTo(FitFunctionTypeEnum.MEAN_DH) == 0) {
            // only one available for downhole
            functionChoiceRadioButton.setSelected(true);
        } else {
            functionChoiceRadioButton.setSelected( //
                    rawRatioDataModel.getSelectedFitFunctionType().compareTo(fitFunctionType) == 0);
        }

        functionChoiceRadioButton.addActionListener((ActionEvent e) -> {
            // on click, take control
            // check if fit function exists (could be calculated)
            if (rawRatioDataModel.containsFitFunction(fitFunctionType)) {
                rawRatioDataModel.setSelectedFitFunctionType(fitFunctionType);
                
                if (targetDataModelView instanceof DataViewsOverlay) {
                    ((DataViewsOverlay) targetDataModelView).getDownholeFractionationDataModel()//
                            .calculateWeightedMeanForEachStandard(rawRatioDataModel.getRawRatioModelName(), rawRatioDataModel.getSelectedFitFunction());
                }
                
                layoutFitFunctionViews(atleastOneFit, ((AbstractRawDataView) ((Component) e.getSource()).getParent().getParent()));
                
                updatePlotsWithChanges(targetDataModelView);
                
                updateReportTable();
                
            }
//                do nothing updatePlotsWithChanges(targetDataModelView);
        });

        fitFunctionButtonGroup.add(functionChoiceRadioButton);
        return functionChoiceRadioButton;
    }