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

The following examples show how to use javax.swing.JRadioButton#setBounds() . 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: ControlsDialog.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
private void addMouseControlPanel(KeyBindings keyBindings) {
	JPanel mouseControlPanel = JPanelFactory.createJPanel("Mouse");

	mouseControlPanel.setOpaque(false);
	mouseControlPanel.setBounds(15, 430, 368, 150);
	mouseControlPanel.setLayout(null);
	
	JRadioButton defaultMouseControl = JRadioButtonFactory.createJRadioButton("<html>left-click: center map<br>right-click: show possible actions</html>");
	defaultMouseControl.setSelected(keyBindings.leftMouseClickCentersMap());
	defaultMouseControl.setOpaque(false);
	defaultMouseControl.setBounds(12, 25, 360, 50);
	mouseControlPanel.add(defaultMouseControl);
	
	JRadioButton alternateMouseControl = JRadioButtonFactory.createJRadioButton("<html>right-click: center map<br>left-click: show possible actions</html>");
	alternateMouseControl.setSelected(!keyBindings.leftMouseClickCentersMap());
	alternateMouseControl.setOpaque(false);
	alternateMouseControl.setBounds(12, 85, 360, 50);
	mouseControlPanel.add(alternateMouseControl);
	
	ButtonGroup buttonGroup = new ButtonGroup();
	buttonGroup.add(defaultMouseControl);
	buttonGroup.add(alternateMouseControl);
	
	addComponent(mouseControlPanel);
	
	defaultMouseControl.addItemListener(new ItemListener() {
		
		@Override
		public void itemStateChanged(ItemEvent itemEvent) {
			keyBindings.setLeftMouseClickCentersMap(defaultMouseControl.isSelected());
		}
	});
}
 
Example 3
Source File: TesteComponentes.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
public void TesteComponente(){
    janela.setVisible(true);
    janela.setSize(DIMENSOES);
    janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    JScrollPane teste1 = new JScrollPane(painel);
    teste1.setBounds(1, 2, 150, 200);
    
    JButton teste2 = new JButton("Aperte");
    teste2.setBounds(210, 2, 100, 100);
    
    JToggleButton teste3 = new JToggleButton("Toggle");
    teste3.setBounds(320, 2, 100, 100);
    
    JCheckBox teste4 = new JCheckBox("Teste");
    teste4.setBounds(430, 2, 100, 100);
    
    JRadioButton teste5 = new JRadioButton("Teste2");
    teste5.setBounds(540, 2, 100, 100);
    
    JTextField teste6 = new JTextField();
    teste6.setToolTipText("Seu Nome");
    teste6.setBounds(1, 205, 200, 50);
    
    String[] numeros = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    JList teste7 = new JList(numeros);
    JScrollPane teste7_2 = new JScrollPane(teste7);
    teste7_2.setBounds(210, 205, 100, 100);
    
    String[] numeros2 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    JComboBox teste8 = new JComboBox(numeros2);
    teste8.setBounds(320, 205, 50, 50);
    
    JLabel teste9 = new JLabel();
    teste9.setText("Biografia: ");
    teste9.setBounds(1, 290, 200, 100);
    
    JTextArea teste10 = new JTextArea();
    teste10.setToolTipText("Biografia");
    teste10.setBounds(1, 350, 100, 100);
    
    teste2.addActionListener(this);
    teste3.addActionListener(this);
    teste4.addActionListener(this);
    teste5.addActionListener(this);
    
    janela.add(teste1);
    janela.add(teste2);
    janela.add(teste3);
    janela.add(teste4);
    janela.add(teste5);
    janela.add(teste6);
    janela.add(teste7);
    janela.add(teste8);
    janela.add(teste9);
    janela.add(teste10);
}
 
Example 4
Source File: FontEditor.java    From lsdpatch with MIT License 4 votes vote down vote up
public FontEditor() {
      setTitle("Font Editor");
      setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
      setBounds(100, 100, 415, 324);
      setResizable(false);

      JMenuBar menuBar = new JMenuBar();
      setJMenuBar(menuBar);

      JMenu mnFile = new JMenu("File");
mnFile.setMnemonic(KeyEvent.VK_F);
      menuBar.add(mnFile);

      JMenuItem mntmOpen = new JMenuItem("Open...");
mntmOpen.setMnemonic(KeyEvent.VK_O);
      mntmOpen.addActionListener(this);
      mnFile.add(mntmOpen);

      JMenuItem mntmSave = new JMenuItem("Save...");
mntmSave.setMnemonic(KeyEvent.VK_S);
      mntmSave.addActionListener(this);
      mnFile.add(mntmSave);

      JMenu mnEdit = new JMenu("Edit");
mnEdit.setMnemonic(KeyEvent.VK_E);
      menuBar.add(mnEdit);

      JMenuItem mntmCopy = new JMenuItem("Copy Tile");
      mntmCopy.addActionListener(this);
      mntmCopy.setMnemonic(KeyEvent.VK_C);
      mnEdit.add(mntmCopy);

      JMenuItem mntmPaste = new JMenuItem("Paste Tile");
      mntmPaste.setMnemonic(KeyEvent.VK_P);
      mntmPaste.addActionListener(this);
      mnEdit.add(mntmPaste);

      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);

      fontMap = new FontMap();
      fontMap.setBounds(10, 42, 128, 146);
      fontMap.setTileSelectListener(this);
      contentPane.add(fontMap);

      tileEditor = new TileEditor();
      tileEditor.setBounds(148, 11, 240, 240);
      tileEditor.setTileChangedListener(this);
      contentPane.add(tileEditor);

      fontSelector = new JComboBox();
      fontSelector.setBounds(10, 11, 128, 20);
      fontSelector.setEditable(true);
      fontSelector.addItemListener(this);
      fontSelector.addActionListener(this);
      contentPane.add(fontSelector);

      color1 = new JRadioButton("1");
      color1.setBounds(10, 220, 37, 23);
      color1.addItemListener(this);
      color1.setMnemonic(KeyEvent.VK_1);
      contentPane.add(color1);

      color2 = new JRadioButton("2");
      color2.setBounds(49, 220, 37, 23);
      color2.addItemListener(this);
      color2.setMnemonic(KeyEvent.VK_2);
      contentPane.add(color2);

      color3 = new JRadioButton("3");
      color3.setBounds(88, 220, 37, 23);
      color3.addItemListener(this);
      color3.setSelected(true);
      color3.setMnemonic(KeyEvent.VK_3);
      contentPane.add(color3);

      colorGroup = new javax.swing.ButtonGroup();
      colorGroup.add(color1);
      colorGroup.add(color2);
      colorGroup.add(color3);

      JLabel lblColor = new JLabel("Color:");
      lblColor.setBounds(10, 199, 46, 14);
      contentPane.add(lblColor);
  }
 
Example 5
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 6
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 7
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 8
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;
    }