List of usage examples for javax.swing ButtonGroup add
public void add(AbstractButton b)
From source file:de.interactive_instruments.ShapeChange.UI.DefaultDialog.java
private void addRadioButton(JPanel panel, ButtonGroup group, String label, String value, String parameter) { JRadioButton radioButton;/*w w w . j a va 2 s . c om*/ panel.add(radioButton = new JRadioButton(label, parameter.equalsIgnoreCase(value))); radioButton.setActionCommand(value); group.add(radioButton); }
From source file:algorithm.QRCodeWatermarking.java
/** * Initialises the GUI buttons./*from w ww.ja v a 2s . c o m*/ */ private void initButtons() { ButtonGroup encapsulateGroup = new ButtonGroup(); encapsulateGroup.add(trueEncapsulate); encapsulateGroup.add(falseEncapsulate); trueEncapsulate.setSelected(true); messageLabel.setForeground(Color.red); }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Creates a diminutive toggle button used for selecting the message type * //from w ww. java2s . c om * @param title * the title of the button * @param icon * the icon to use * @param selected * whether the button is selected or not * @param group * the group to add the button to * @return the instantiated button */ private JToggleButton createMessageTypeButton(String title, ImageIcon icon, boolean selected, ButtonGroup group) { JToggleButton button = new JToggleButton(icon); group.add(button); button.setSelected(selected); button.setToolTipText(title); button.setFocusable(false); button.setFocusPainted(false); button.addActionListener(this); button.setPreferredSize(new Dimension(18, 18)); return button; }
From source file:com.aw.swing.mvp.binding.BindingManager.java
private BndIJRadioButton bindIntern(JRadioButton component, String fieldName, Object selectedValue, ButtonGroup buttonGroup) { BndIJRadioButton inputComponent = new BndIJRadioButton(currentInputCmpMgr, component, fieldName, selectedValue);/* w ww . j a v a 2 s. c o m*/ currentInputCmpMgr.initComponent(inputComponent); buttonGroup.add(component); return inputComponent; }
From source file:net.sf.jabref.external.DroppedFileHandler.java
public DroppedFileHandler(JabRefFrame frame, BasePanel panel) { this.frame = frame; this.panel = panel; ButtonGroup grp = new ButtonGroup(); grp.add(linkInPlace); grp.add(copyRadioButton);//from w ww . j a va 2 s . com grp.add(moveRadioButton); FormLayout layout = new FormLayout("left:15dlu,pref,pref,pref", "bottom:14pt,pref,pref,pref,pref"); layout.setRowGroups(new int[][] { { 1, 2, 3, 4, 5 } }); FormBuilder builder = FormBuilder.create().layout(layout); builder.add(linkInPlace).xyw(1, 1, 4); builder.add(destDirLabel).xyw(1, 2, 4); builder.add(copyRadioButton).xyw(2, 3, 3); builder.add(moveRadioButton).xyw(2, 4, 3); builder.add(renameCheckBox).xyw(2, 5, 1); builder.add(renameToTextBox).xyw(4, 5, 1); optionsPanel.add(builder.getPanel()); }
From source file:com.mirth.connect.client.ui.components.rsta.FindReplaceDialog.java
private void initComponents() { setLayout(new MigLayout("insets 11, novisualpadding, hidemode 3, fill, gap 6")); setBackground(UIConstants.COMBO_BOX_BACKGROUND); getContentPane().setBackground(getBackground()); findPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill, gap 6")); findPanel.setBackground(getBackground()); ActionListener findActionListener = new ActionListener() { @Override//from ww w. ja v a2 s .c o m public void actionPerformed(ActionEvent evt) { find(); } }; findLabel = new JLabel("Find text:"); findComboBox = new JComboBox<String>(); findComboBox.setEditable(true); findComboBox.setBackground(UIConstants.BACKGROUND_COLOR); findComboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getModifiers() == 0) { find(); } } }); ActionListener replaceActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { replace(); } }; replaceLabel = new JLabel("Replace with:"); replaceComboBox = new JComboBox<String>(); replaceComboBox.setEditable(true); replaceComboBox.setBackground(UIConstants.BACKGROUND_COLOR); directionPanel = new JPanel(new MigLayout("insets 8, novisualpadding, hidemode 3, fill, gap 6")); directionPanel.setBackground(getBackground()); directionPanel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createLineBorder(new Color(150, 150, 150)), "Direction", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); ButtonGroup directionButtonGroup = new ButtonGroup(); directionForwardRadio = new JRadioButton("Forward"); directionForwardRadio.setBackground(directionPanel.getBackground()); directionButtonGroup.add(directionForwardRadio); directionBackwardRadio = new JRadioButton("Backward"); directionBackwardRadio.setBackground(directionPanel.getBackground()); directionButtonGroup.add(directionBackwardRadio); optionsPanel = new JPanel(new MigLayout("insets 8, novisualpadding, hidemode 3, fill, gap 6")); optionsPanel.setBackground(getBackground()); optionsPanel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createLineBorder(new Color(150, 150, 150)), "Options", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); wrapSearchCheckBox = new JCheckBox("Wrap Search"); matchCaseCheckBox = new JCheckBox("Match Case"); regularExpressionCheckBox = new JCheckBox("Regular Expression"); wholeWordCheckBox = new JCheckBox("Whole Word"); findButton = new JButton("Find"); findButton.addActionListener(findActionListener); replaceButton = new JButton("Replace"); replaceButton.addActionListener(replaceActionListener); replaceAllButton = new JButton("Replace All"); replaceAllButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { replaceAll(); } }); warningLabel = new JLabel(); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { dispose(); } }); }
From source file:ShowComponent.java
/** * This static method queries the system to find out what Pluggable * Look-and-Feel (PLAF) implementations are available. Then it creates a * JMenu component that lists each of the implementations by name and allows * the user to select one of them using JRadioButtonMenuItem components. * When the user selects one, the selected menu item traverses the component * hierarchy and tells all components to use the new PLAF. *///from ww w . j ava 2 s .c o m public static JMenu createPlafMenu(final JFrame frame) { // Create the menu JMenu plafmenu = new JMenu("Look and Feel"); // Create an object used for radio button mutual exclusion ButtonGroup radiogroup = new ButtonGroup(); // Look up the available look and feels UIManager.LookAndFeelInfo[] plafs = UIManager.getInstalledLookAndFeels(); // Loop through the plafs, and add a menu item for each one for (int i = 0; i < plafs.length; i++) { String plafName = plafs[i].getName(); final String plafClassName = plafs[i].getClassName(); // Create the menu item JMenuItem item = plafmenu.add(new JRadioButtonMenuItem(plafName)); // Tell the menu item what to do when it is selected item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { // Set the new look and feel UIManager.setLookAndFeel(plafClassName); // Tell each component to change its look-and-feel SwingUtilities.updateComponentTreeUI(frame); // Tell the frame to resize itself to the its // children's new desired sizes frame.pack(); } catch (Exception ex) { System.err.println(ex); } } }); // Only allow one menu item to be selected at once radiogroup.add(item); } return plafmenu; }
From source file:de.burrotinto.jKabel.dispalyAS.DisplayAAS.java
private JMenu getjTypSortMenu() { JMenu typSortMenu = new JMenu("Typ Sortierung"); JRadioButtonMenuItem inOrder = new JRadioButtonMenuItem("Aufsteigend Sortieren"); inOrder.setSelected(ConfigReader.getInstance().isTypeInOrder()); inOrder.addActionListener(new ActionListener() { @Override/*from w w w. j av a 2 s . com*/ public void actionPerformed(ActionEvent actionEvent) { try { ConfigReader.getInstance().setTypeInOrder(inOrder.isSelected()); // if (kabelTypAuswahlAAS != null) { // kabelTypAuswahlAAS.typSelected(kabelTypAuswahlAAS.getSelected()); // } } catch (IOException e) { e.printStackTrace(); } } }); typSortMenu.add(inOrder); typSortMenu.addSeparator(); ButtonGroup group = new ButtonGroup(); for (AbstractTypeSort aTS : ConfigReader.getInstance().getAllTypSort()) { JRadioButtonMenuItem sw = new JRadioButtonMenuItem(aTS.getName()); sw.setSelected(aTS.equals(ConfigReader.getInstance().getKabeltypSort())); group.add(sw); typSortMenu.add(sw); sw.addActionListener(aTS); } return typSortMenu; }
From source file:com.att.aro.ui.view.menu.datacollector.DeviceDialogOptions.java
private void loadRadioGroupVideoOrient() { txtPortrait = ResourceBundleHelper.getMessageString("dlog.collector.option.video.orient.portrait"); txtLandscape = ResourceBundleHelper.getMessageString("dlog.collector.option.video.orient.landscape"); btn_portrait = new JRadioButton(txtPortrait); btn_landscape = new JRadioButton(txtLandscape); btn_portrait.addActionListener(this); btn_landscape.addActionListener(this); ButtonGroup radioBtnVideoOrient = new ButtonGroup(); radioBtnVideoOrient.add(btn_portrait); radioBtnVideoOrient.add(btn_landscape); }
From source file:com.att.aro.ui.view.menu.datacollector.DeviceDialogOptions.java
private void loadRadioGroupVideo() { txtLREZ = ResourceBundleHelper.getMessageString("dlog.collector.option.video.orig"); txtHDEF = ResourceBundleHelper.getMessageString("dlog.collector.option.video.hdef"); txtSDEF = ResourceBundleHelper.getMessageString("dlog.collector.option.video.sdef"); txtNONE = ResourceBundleHelper.getMessageString("dlog.collector.option.video.none"); btn_lrez = new JRadioButton(txtLREZ); btn_hdef = new JRadioButton(txtHDEF); btn_sdef = new JRadioButton(txtSDEF); btn_none = new JRadioButton(txtNONE); btn_lrez.addActionListener(this); btn_hdef.addActionListener(this); btn_sdef.addActionListener(this); btn_none.addActionListener(this); ButtonGroup radioBtnVideo = new ButtonGroup(); radioBtnVideo.add(btn_lrez); radioBtnVideo.add(btn_hdef);/*w ww . j a va 2 s .co m*/ radioBtnVideo.add(btn_sdef); radioBtnVideo.add(btn_none); }