javax.swing.JRadioButton#setFont ( )源码实例Demo

下面列出了javax.swing.JRadioButton#setFont ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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;
}
 
源代码2 项目: xdm   文件: SettingsPage.java
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;
}
 
源代码3 项目: xdm   文件: BatchPatternDialog.java
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;
}
 
源代码4 项目: material-ui-swing   文件: MaterialRadioButtonUI.java
@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));
}
 
源代码5 项目: nmonvisualizer   文件: ChartTableToggle.java
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);
}
 
源代码6 项目: gepard   文件: ControlPanel.java
private JRadioButton getCustomRadioButton(String caption) {
	JRadioButton ret = new JRadioButton(caption);
	ret.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	ret.setFont(MAIN_FONT);
	return ret;
}
 
源代码7 项目: WorldGrower   文件: JRadioButtonFactory.java
public static JRadioButton createJRadioButton(String description) {
	JRadioButton radioButton = new JRadioButton(description);
	radioButton.setForeground(ColorPalette.FOREGROUND_COLOR);
	radioButton.setFont(Fonts.FONT);
	return radioButton;
}
 
源代码8 项目: ET_Redux   文件: AbstractValueModelsPanelView.java
/**
 *
 *
 * @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 );

}
 
源代码9 项目: ET_Redux   文件: KwikiDateModesSelectorPanel.java
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 );

}
 
源代码10 项目: ET_Redux   文件: KwikiPDFToolBar.java
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();
        });
    }

}
 
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;
    }