List of usage examples for javax.swing ButtonGroup add
public void add(AbstractButton b)
From source file:TapTapTap.java
private JPanel createPanel() { JPanel p = new JPanel(); ButtonGroup entreeGroup = new ButtonGroup(); JRadioButton radioButton;/* www. j av a2 s. com*/ p.add(radioButton = new JRadioButton("Beef", true)); entreeGroup.add(radioButton); p.add(radioButton = new JRadioButton("Chicken")); entreeGroup.add(radioButton); p.add(radioButton = new JRadioButton("Vegetable")); entreeGroup.add(radioButton); p.add(new JCheckBox("Ketchup")); p.add(new JCheckBox("Mustard")); p.add(new JCheckBox("Pickles")); p.add(new JLabel("Special requests:")); p.add(new JTextField(20)); mOrderButton = new JButton("Place Order"); p.add(mOrderButton); return p; }
From source file:com.floreantpos.ui.OrderFilterPanel.java
private void createOrderTypeFilterPanel() { OrderTypeFilterButton btnFilterByOrderTypeALL = new OrderTypeFilterButton(POSConstants.ALL); JPanel filterByOrderPanel = new JPanel(new MigLayout("", "fill, grow", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ filterByOrderPanel.setBorder(new TitledBorder(Messages.getString("SwitchboardView.4"))); //$NON-NLS-1$ ButtonGroup orderTypeGroup = new ButtonGroup(); orderTypeGroup.add(btnFilterByOrderTypeALL); filterByOrderPanel.add(btnFilterByOrderTypeALL); List<OrderType> orderTypes = Application.getInstance().getOrderTypes(); for (OrderType orderType : orderTypes) { OrderTypeFilterButton orderTypeFilterButton = new OrderTypeFilterButton(orderType.getName()); orderTypeGroup.add(orderTypeFilterButton); filterByOrderPanel.add(orderTypeFilterButton); }//from w w w. j a va 2 s .com getContentPane().add(filterByOrderPanel); }
From source file:LNFSwitcher.java
/** Construct a program... */ public LNFSwitcher() { super();/*from ww w . j a v a2s .c o m*/ theFrame = new JFrame("LNF Switcher"); theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); cp = theFrame.getContentPane(); cp.setLayout(new FlowLayout()); ButtonGroup bg = new ButtonGroup(); JRadioButton bJava = new JRadioButton("Java"); bJava.addActionListener(new LNFSetter("javax.swing.plaf.metal.MetalLookAndFeel", bJava)); bg.add(bJava); cp.add(bJava); JRadioButton bMSW = new JRadioButton("MS-Windows"); bMSW.addActionListener(new LNFSetter("com.sun.java.swing.plaf.windows.WindowsLookAndFeel", bMSW)); bg.add(bMSW); cp.add(bMSW); JRadioButton bMotif = new JRadioButton("Motif"); bMotif.addActionListener(new LNFSetter("com.sun.java.swing.plaf.motif.MotifLookAndFeel", bMotif)); bg.add(bMotif); cp.add(bMotif); JRadioButton bMac = new JRadioButton("Sun-MacOS"); bMac.addActionListener(new LNFSetter("com.sun.java.swing.plaf.mac.MacLookAndFeel", bMac)); bg.add(bMac); cp.add(bMac); String defaultLookAndFeel = UIManager.getSystemLookAndFeelClassName(); // System.out.println(defaultLookAndFeel); JRadioButton bDefault = new JRadioButton("Default"); bDefault.addActionListener(new LNFSetter(defaultLookAndFeel, bDefault)); bg.add(bDefault); cp.add(bDefault); (previousButton = bDefault).setSelected(true); theFrame.pack(); theFrame.setVisible(true); }
From source file:components.CrayonPanel.java
protected void buildChooser() { setLayout(new GridLayout(0, 1)); ButtonGroup boxOfCrayons = new ButtonGroup(); Border border = BorderFactory.createEmptyBorder(4, 4, 4, 4); redCrayon = createCrayon("red", border); boxOfCrayons.add(redCrayon); add(redCrayon);//from ww w . j a va2 s .com yellowCrayon = createCrayon("yellow", border); boxOfCrayons.add(yellowCrayon); add(yellowCrayon); greenCrayon = createCrayon("green", border); boxOfCrayons.add(greenCrayon); add(greenCrayon); blueCrayon = createCrayon("blue", border); boxOfCrayons.add(blueCrayon); add(blueCrayon); }
From source file:algorithm.OpenStegoRandomLSBSteganography.java
/** * Buttons to toggle optional compression on and off */// w ww.ja v a 2s.c om private void initButtons() { ButtonGroup buttonGroupCompression = new ButtonGroup(); buttonGroupCompression.add(trueCompressionButton); buttonGroupCompression.add(falseCompressionButton); trueCompressionButton.setSelected(true); }
From source file:net.sf.jhylafax.AbstractFaxDialog.java
protected void addDateControls() { dateNowRadionButton = new JRadioButton(); dateNowRadionButton.setSelected(true); dateLabel = builder.append("", dateNowRadionButton); builder.nextLine();/*www .ja va 2s. co m*/ dateLaterRadionButton = new JRadioButton(); dateModel = new SpinnerDateModel(); final JSpinner dateSpinner = new JSpinner(dateModel); dateSpinner.setEnabled(false); dateLaterRadionButton.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { dateSpinner.setEnabled(dateLaterRadionButton.isSelected()); } }); builder.append("", dateLaterRadionButton, dateSpinner); builder.nextLine(); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(dateNowRadionButton); buttonGroup.add(dateLaterRadionButton); }
From source file:uk.co.petertribble.jkstat.gui.KstatBaseChartFrame.java
/** * Create the Sleep for... Menu.//from ww w. j a v a 2 s .com * * @return the Sleep Menu */ protected JMenu sleepMenu() { JMenu jms = new JMenu(KstatResources.getString("SLEEP.TEXT")); jms.setMnemonic(KeyEvent.VK_U); sleepItem1 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.1")); sleepItem1.addActionListener(this); sleepItem2 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.2")); sleepItem2.addActionListener(this); sleepItem5 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.5"), true); sleepItem5.addActionListener(this); sleepItem10 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.10")); sleepItem10.addActionListener(this); jms.add(sleepItem1); jms.add(sleepItem2); jms.add(sleepItem5); jms.add(sleepItem10); ButtonGroup sleepGroup = new ButtonGroup(); sleepGroup.add(sleepItem1); sleepGroup.add(sleepItem2); sleepGroup.add(sleepItem5); sleepGroup.add(sleepItem10); return jms; }
From source file:ui.results.ResultChartPanel.java
/** * Creates the choice panel, that is placed above the chart. * @return the choice panel//w ww . j av a2 s .c o m */ protected JPanel createChoicePanel() { // The radiobuttons JRadioButton line = new JRadioButton("Line Chart", true); JRadioButton bar = new JRadioButton("Bar Chart", false); line.setActionCommand("line chart"); bar.setActionCommand("bar chart"); line.addActionListener(this); bar.addActionListener(this); // Let the radiobuttons form a group: i.e. only one can be selected. ButtonGroup choiceGroup = new ButtonGroup(); choiceGroup.add(line); choiceGroup.add(bar); // Joining it all on the panel JPanel choicePanel = new JPanel(); choicePanel.add(line); choicePanel.add(bar); return choicePanel; }
From source file:REDemo.java
/** Construct the REDemo object including its GUI */ public REDemo() { super();/*from ww w.jav a 2 s . c o m*/ JPanel top = new JPanel(); top.add(new JLabel("Pattern:", JLabel.RIGHT)); patternTF = new JTextField(20); patternTF.getDocument().addDocumentListener(new PatternListener()); top.add(patternTF); top.add(new JLabel("Syntax OK?")); compiledOK = new JCheckBox(); top.add(compiledOK); ChangeListener cl = new ChangeListener() { public void stateChanged(ChangeEvent ce) { tryMatch(); } }; JPanel switchPane = new JPanel(); ButtonGroup bg = new ButtonGroup(); match = new JRadioButton("Match"); match.setSelected(true); match.addChangeListener(cl); bg.add(match); switchPane.add(match); find = new JRadioButton("Find"); find.addChangeListener(cl); bg.add(find); switchPane.add(find); findAll = new JRadioButton("Find All"); findAll.addChangeListener(cl); bg.add(findAll); switchPane.add(findAll); JPanel strPane = new JPanel(); strPane.add(new JLabel("String:", JLabel.RIGHT)); stringTF = new JTextField(20); stringTF.getDocument().addDocumentListener(new StringListener()); strPane.add(stringTF); strPane.add(new JLabel("Matches:")); matchesTF = new JTextField(3); strPane.add(matchesTF); setLayout(new GridLayout(0, 1, 5, 5)); add(top); add(strPane); add(switchPane); }
From source file:com.mirth.connect.client.ui.AttachmentExportDialog.java
private void initComponents() { binaryButton = new JRadioButton("Binary"); binaryButton.setSelected(true);/*from w w w. j a va 2s . com*/ binaryButton.setBackground(Color.white); binaryButton.setFocusable(false); textButton = new JRadioButton("Text"); textButton.setBackground(Color.white); textButton.setFocusable(false); ButtonGroup typeButtonGroup = new ButtonGroup(); typeButtonGroup.add(binaryButton); typeButtonGroup.add(textButton); serverButton = new JRadioButton("Server"); serverButton.setBackground(Color.white); serverButton.setFocusable(false); localButton = new JRadioButton("My Computer"); localButton.setBackground(Color.white); localButton.setSelected(true); localButton.setFocusable(false); browseButton = new MirthButton("Browse..."); localButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browseButton.setEnabled(true); fileField.setText(null); } }); serverButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browseButton.setEnabled(false); fileField.setText(null); } }); ButtonGroup locationButtonGroup = new ButtonGroup(); locationButtonGroup.add(serverButton); locationButtonGroup.add(localButton); browseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browseSelected(); } }); fileField = new JTextField(); exportButton = new JButton("Export"); cancelButton = new JButton("Cancel"); exportButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { export(); } }); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); }