Java Code Examples for javax.swing.JRadioButton#setName()
The following examples show how to use
javax.swing.JRadioButton#setName() .
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 |
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: AbstractValueModelsPanelView.java From ET_Redux with Apache License 2.0 | 4 votes |
/** * * * @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 3
Source File: KwikiPDFToolBar.java From ET_Redux with Apache License 2.0 | 4 votes |
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 4
Source File: AbstractFitFunctionPresentationView.java From ET_Redux with Apache License 2.0 | 4 votes |
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; }
Example 5
Source File: Continuous3BandGraphicalForm.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
public Continuous3BandGraphicalForm(final ColorManipulationForm parentForm) { this.parentForm = parentForm; imageInfoEditor = new ImageInfoEditor2(parentForm); imageInfoEditorSupport = new ImageInfoEditorSupport(imageInfoEditor); moreOptionsForm = new MoreOptionsForm(this, parentForm.getFormModel().canUseHistogramMatching()); models = new ImageInfoEditorModel3B[3]; initialChannelSources = new RasterDataNode[3]; currentChannelSources = new RasterDataNode[3]; channelSourcesList = new ArrayList<>(32); channel = 0; final Property channelSourceNameModel = Property.createForField(this, CHANNEL_SOURCE_NAME_PROPERTY, ""); JComboBox channelSourceNameBox = new JComboBox(); channelSourceNameBox.setEditable(false); final Property gammaModel = Property.createForField(this, GAMMA_PROPERTY, 1.0); gammaModel.getDescriptor().setValueRange(new ValueRange(1.0 / 10.0, 10.0)); gammaModel.getDescriptor().setDefaultValue(1.0); JTextField gammaField = new JTextField(); gammaField.setColumns(6); gammaField.setHorizontalAlignment(JTextField.RIGHT); moreOptionsForm.getBindingContext().getPropertySet().addProperty(channelSourceNameModel); moreOptionsForm.getBindingContext().bind(CHANNEL_SOURCE_NAME_PROPERTY, channelSourceNameBox); moreOptionsForm.getBindingContext().getPropertySet().addProperty(gammaModel); moreOptionsForm.getBindingContext().bind(GAMMA_PROPERTY, gammaField); moreOptionsForm.addRow(new JLabel("Source band: "), channelSourceNameBox); moreOptionsForm.addRow(new JLabel("Gamma non-linearity: "), gammaField); final PropertyContainer propertyContainer = new PropertyContainer(); propertyContainer.addProperty(Property.createForField(this, "channel", 0)); propertyContainer.getProperty("channel").getDescriptor().setValueSet(new ValueSet(new Integer[]{0, 1, 2})); final BindingContext bindingContext = new BindingContext(propertyContainer); JRadioButton rChannelButton = new JRadioButton("Red"); JRadioButton gChannelButton = new JRadioButton("Green"); JRadioButton bChannelButton = new JRadioButton("Blue"); rChannelButton.setName("rChannelButton"); gChannelButton.setName("gChannelButton"); bChannelButton.setName("bChannelButton"); final ButtonGroup channelButtonGroup = new ButtonGroup(); channelButtonGroup.add(rChannelButton); channelButtonGroup.add(gChannelButton); channelButtonGroup.add(bChannelButton); bindingContext.bind("channel", channelButtonGroup); bindingContext.addPropertyChangeListener("channel", evt -> acknowledgeChannel()); final JPanel channelButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); channelButtonPanel.add(rChannelButton); channelButtonPanel.add(gChannelButton); channelButtonPanel.add(bChannelButton); contentPanel = new JPanel(new BorderLayout(2, 2)); contentPanel.add(channelButtonPanel, BorderLayout.NORTH); contentPanel.add(imageInfoEditor, BorderLayout.CENTER); moreOptionsForm.getBindingContext().addPropertyChangeListener(GAMMA_PROPERTY, evt -> handleGammaChanged()); moreOptionsForm.getBindingContext().addPropertyChangeListener(CHANNEL_SOURCE_NAME_PROPERTY, this::handleChannelSourceNameChanged); }
Example 6
Source File: SwingRadioButtonListWidget.java From atdl4j with MIT License | 4 votes |
@Override protected List< ? extends Component> createBrickComponents() { List<Component> components = new ArrayList<Component>(); JPanel wrapper = new JPanel(); String tooltip = getTooltip(); // label if ( control.getLabel() != null ) { label = new JLabel(); label.setName(getName()+"/label"); label.setText( control.getLabel() ); if ( tooltip != null ) label.setToolTipText( tooltip ); components.add(label); } /* //TODO: implement horiz/vert orientation for Swing if ( ((RadioButtonListT) control).getOrientation() != null && PanelOrientationT.VERTICAL.equals( ((RadioButtonListT) control).getOrientation() ) ) { c.setLayout( new GridLayout( 1, false ) ); } else { RowLayout rl = new RowLayout(); rl.wrap = false; c.setLayout( rl ); } */ // radioButton for ( ListItemT listItem : ( (RadioButtonListT) control ).getListItem() ) { JRadioButton radioElement = new JRadioButton(); radioElement.setName(getName()+"/button/"+listItem.getEnumID()); radioElement.setText( listItem.getUiRep() ); if ( parameter != null ) { for ( EnumPairT enumPair : parameter.getEnumPair() ) { if ( enumPair.getEnumID() == listItem.getEnumID() ) { radioElement.setToolTipText( enumPair.getDescription() ); break; } } } else { radioElement.setToolTipText( tooltip ); } group.add( radioElement ); buttons.add( radioElement ); wrapper.add( radioElement ); } // set initValue (Note that this has to be the enumID, not the // wireValue) // set initValue if ( ControlHelper.getInitValue( control, getAtdl4jOptions() ) != null ) setValue( (String) ControlHelper.getInitValue( control, getAtdl4jOptions() ), true ); components.add(wrapper); return components; }