List of usage examples for javax.swing JRadioButton JRadioButton
public JRadioButton(String text)
From source file:uk.nhs.cfh.dsp.yasb.searchpanel.SearchPanel.java
/** * Creates the button panel.//ww w . j av a 2 s.c o m */ private void createButtonPanel() { buttonsPanel = new JPanel(); buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.PAGE_AXIS)); JPanel fieldsPanel = new JPanel(); fieldsPanel.add(new JLabel("Search using ")); fieldsPanel.add(Box.createHorizontalStrut(5)); fieldsPanel.setLayout(new BoxLayout(fieldsPanel, BoxLayout.LINE_AXIS)); // create button group for term selection JRadioButton allRadioButton = new JRadioButton(new AbstractAction("Term") { public void actionPerformed(ActionEvent event) { // set search on term searchConceptId = false; doSearch(); } }); JRadioButton idRadioButton = new JRadioButton(new AbstractAction("ID") { public void actionPerformed(ActionEvent event) { // set search on id searchConceptId = true; doSearch(); } }); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(allRadioButton); buttonGroup.add(idRadioButton); buttonGroup.setSelected(allRadioButton.getModel(), true); // add search field terms to fields panel fieldsPanel.add(allRadioButton); fieldsPanel.add(idRadioButton); fieldsPanel.add(Box.createHorizontalGlue()); // create panel that contains button that toggles display of controlsPane JideButton controlsButton = new JideButton(new AbstractAction() { public void actionPerformed(ActionEvent e) { if (controlsPane.isCollapsed()) { controlsPane.setCollapsed(false); } else { controlsPane.setCollapsed(true); } } }); controlsButton.setIcon(new ImageIcon(SearchPanel.class.getResource("resources/configure.png"))); controlsButton.setToolTipText("Click to display or hide configuration panel"); JPanel panel4 = new JPanel(); panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS)); panel4.add(Box.createHorizontalGlue()); panel4.add(new JLabel("Change search and display preferences ")); panel4.add(controlsButton); // add panels to button panel buttonsPanel.add(fieldsPanel); buttonsPanel.add(panel4); }
From source file:us.paulevans.basicxslt.TransformOutputPropertiesFrame.java
/** * Builds the method panel/* w w w. jav a2 s . com*/ * @return */ private JPanel buildMethodPanel() { int row; ButtonGroup group; GridBagLayout layout; GridBagConstraints constraints; JPanel panel; row = 0; group = new ButtonGroup(); layout = new GridBagLayout(); constraints = new GridBagConstraints(); panel = new JPanel(layout); GUIUtils.add(panel, xml = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_XML) + " | "), layout, constraints, row, 0, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, html = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_HTML) + " | "), layout, constraints, row, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, text = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_TEXT) + " | "), layout, constraints, row, 2, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, other = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_OTHER)), layout, constraints, row, 3, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, otherMethod = new JTextField(10), layout, constraints, row, 4, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); group.add(xml); group.add(html); group.add(text); group.add(other); xml.addActionListener(this); html.addActionListener(this); text.addActionListener(this); other.addActionListener(this); xml.setSelected(true); otherMethod.setEnabled(false); otherMethod.setBackground(Color.LIGHT_GRAY); return panel; }
From source file:verdandi.ui.settings.DefaultSettingsPanel.java
private JPanel getTimeFormatSettingsPanel() { JPanel res = new JPanel(); res.setLayout(new BoxLayout(res, BoxLayout.LINE_AXIS)); radioFormatHHMM = new JRadioButton("01:45"); radioFormatHHQuarters = new JRadioButton("1,75"); ButtonGroup grp = new ButtonGroup(); grp.add(radioFormatHHMM);// ww w . j av a 2 s.c om grp.add(radioFormatHHQuarters); res.add(radioFormatHHMM); res.add(Box.createHorizontalStrut(5)); res.add(radioFormatHHQuarters); res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.timeformat.title"))); return res; }
From source file:visolate.Visolate.java
private Box getToolpathBox() { Dimension d;/*www . j a va 2 s . c o m*/ Box toolpathsBox = Box.createHorizontalBox(); toolpathsButton = new JButton("Make Toolpaths"); toolpathsButton.setBackground(Color.WHITE); toolpathsButton.setVerticalAlignment(AbstractButton.CENTER); toolpathsButton.setHorizontalAlignment(AbstractButton.CENTER); d = toolpathsButton.getPreferredSize(); toolpathsButton.setMaximumSize(new Dimension(d.width, d.height)); toolpathsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { computeToolpaths(); } }); toolpathsBox.add(toolpathsButton); // toolpathsBox.add(Box.createHorizontalStrut(16)); ButtonGroup modeGroup = new ButtonGroup(); voronoiButton = new JRadioButton("voronoi"); modeGroup.add(voronoiButton); voronoiButton.setBackground(Color.WHITE); // VORONOI_MODE is the default mode. voronoiButton.setSelected(true); toolpathsBox.add(voronoiButton); outlineButton = new JRadioButton("outline"); modeGroup.add(outlineButton); outlineButton.setBackground(Color.WHITE); // VORONOI_MODE is the default mode. outlineButton.setSelected(false); toolpathsBox.add(outlineButton); return toolpathsBox; }
From source file:visolate.Visolate.java
private JRadioButton getAbsoluteCoordinatesButton() { if (myAbsoluteCoordinatesButton == null) { myAbsoluteCoordinatesButton = new JRadioButton("absolute"); myAbsoluteCoordinatesButton.setSelected(gCodeWriter.getIsAbsolute()); myAbsoluteCoordinatesButton.setToolTipText( "Output absolute G-code coordinates. For the starting point, set X, Y and cutting height."); myAbsoluteCoordinatesButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { setAbsoluteCoordinates(myAbsoluteCoordinatesButton.isSelected()); }/* w w w . j a va 2s . c o m*/ }); } return myAbsoluteCoordinatesButton; }
From source file:visolate.Visolate.java
private JRadioButton getRelativeCoordinatesButton() { if (myRelativeCoordinatesButton == null) { myRelativeCoordinatesButton = new JRadioButton("relative"); myRelativeCoordinatesButton.setSelected(!gCodeWriter.getIsAbsolute()); myRelativeCoordinatesButton/* w w w. ja v a 2 s .com*/ .setToolTipText("Output relative G-code coordinates, starting at { 0.0, 0.0, 0.0 }."); myRelativeCoordinatesButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { setAbsoluteCoordinates(!myRelativeCoordinatesButton.isSelected()); } }); } return myRelativeCoordinatesButton; }
From source file:visolate.Visolate.java
private JRadioButton getMetricButton() { if (myMetricButton == null) { myMetricButton = new JRadioButton("metric"); myMetricButton.setSelected(gCodeWriter.getIsMetric()); myMetricButton.setToolTipText("Output G-code in mm. Coordinates entered here are in mm, too."); myMetricButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (myMetricButton.isSelected()) { getImperialButton().setSelected(false); gCodeWriter.setIsMetric(true); }//from w w w . j a v a2 s.c o m } }); } return myMetricButton; }
From source file:visolate.Visolate.java
private JRadioButton getImperialButton() { if (myImperialButton == null) { myImperialButton = new JRadioButton("imperial"); myImperialButton.setSelected(!gCodeWriter.getIsMetric()); myImperialButton/*from w ww .ja va 2 s. c om*/ .setToolTipText("Output G-code in inches. Coordinates entered here are in inches, too."); myImperialButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (myImperialButton.isSelected()) { getMetricButton().setSelected(false); gCodeWriter.setIsMetric(false); } } }); } return myImperialButton; }
From source file:zsk.JFCMainClient.java
/** * @param pane/*from w w w . j a va2 s .co m*/ * @param downloadDir */ public void addComponentsToPane(final Container pane, String downloadDir) { this.panel = new JPanel(); this.panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; JFCMainClient.dlm = new DefaultListModel<String>(); this.urllist = new JList<String>(JFCMainClient.dlm); // TODO maybe we add a button to remove added URLs from list? // this.userlist.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); this.urllist.setFocusable(false); this.textarea = new JTextArea(2, 2); this.textarea.setEditable(true); this.textarea.setFocusable(false); JScrollPane leftscrollpane = new JScrollPane(this.urllist); JScrollPane rightscrollpane = new JScrollPane(this.textarea); this.middlepane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftscrollpane, rightscrollpane); this.middlepane.setOneTouchExpandable(true); this.middlepane.setDividerLocation(150); Dimension minimumSize = new Dimension(25, 25); leftscrollpane.setMinimumSize(minimumSize); rightscrollpane.setMinimumSize(minimumSize); this.directorybutton = new JButton("", createImageIcon("images/open.png", "")); gbc.gridx = 0; gbc.gridy = 0; this.directorybutton.addActionListener(this); this.panel.add(this.directorybutton, gbc); this.saveconfigcheckbox = new JCheckBox(isgerman() ? "Konfig. speichern" : "Save config"); this.saveconfigcheckbox.setSelected(false); this.saveconfigcheckbox.addItemListener(this); this.panel.add(this.saveconfigcheckbox); this.saveconfigcheckbox.setEnabled(false); // TODO check if initial download directory exists // assume that at least the users homedir exists //if (System.getProperty("user.home").equals("/home/knoedel")) shomedir = "/home/knoedel/YouTube Downloads/"; debugoutput("user.home: ".concat(System.getProperty("user.home")).concat(" shomedir: ".concat(shomedir))); debugoutput("os.name: ".concat(System.getProperty("os.name"))); debugoutput("os.arch: ".concat(System.getProperty("os.arch"))); debugoutput("os.version: ".concat(System.getProperty("os.version"))); debugoutput("Locale.getDefault: ".concat(Locale.getDefault().toString())); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.directorytextfield = new JTextField(downloadDir, 20 + (JFCMainClient.getbDEBUG() ? 48 : 0)); //this.directorytextfield = new JTextField( shomedir, 20+(JFCMainClient.getbDEBUG()?48:0) ); this.directorytextfield.setEnabled(false); this.directorytextfield.setFocusable(true); this.directorytextfield.addActionListener(this); this.panel.add(this.directorytextfield, gbc); JLabel dirhint = new JLabel(isgerman() ? "Speichern im Ordner:" : "Download to folder:"); gbc.gridx = 0; gbc.gridy = 1; this.panel.add(dirhint, gbc); debugoutput(String.format("heigth x width: %d x %d", Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height)); this.middlepane.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width / 3, Toolkit.getDefaultToolkit().getScreenSize().height / 4 + (JFCMainClient.getbDEBUG() ? 200 : 0))); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 2; gbc.weightx = 2; gbc.gridwidth = 2; this.panel.add(this.middlepane, gbc); // radio buttons for resolution to download JFCMainClient.frame.hdbutton = new JRadioButton("HD"); JFCMainClient.frame.hdbutton.setActionCommand("hd"); JFCMainClient.frame.hdbutton.addActionListener(this); JFCMainClient.frame.hdbutton.setToolTipText("1080p/720p"); JFCMainClient.frame.stdbutton = new JRadioButton("Std"); JFCMainClient.frame.stdbutton.setActionCommand("std"); JFCMainClient.frame.stdbutton.addActionListener(this); JFCMainClient.frame.stdbutton.setToolTipText("480p/360p"); JFCMainClient.frame.ldbutton = new JRadioButton("LD"); JFCMainClient.frame.ldbutton.setActionCommand("ld"); JFCMainClient.frame.ldbutton.addActionListener(this); JFCMainClient.frame.ldbutton.setToolTipText("< 360p"); JFCMainClient.frame.stdbutton.setSelected(true); JFCMainClient.frame.hdbutton.setEnabled(true); JFCMainClient.frame.ldbutton.setEnabled(true); ButtonGroup bgroup = new ButtonGroup(); bgroup.add(JFCMainClient.frame.hdbutton); bgroup.add(JFCMainClient.frame.stdbutton); bgroup.add(JFCMainClient.frame.ldbutton); JPanel radiopanel = new JPanel(new GridLayout(1, 0)); radiopanel.add(JFCMainClient.frame.hdbutton); radiopanel.add(JFCMainClient.frame.stdbutton); radiopanel.add(JFCMainClient.frame.ldbutton); gbc.gridx = 1; gbc.gridy = 0; gbc.gridheight = 0; gbc.gridwidth = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHEAST; this.panel.add(radiopanel, gbc); // radio buttons for video format to download JFCMainClient.frame.mpgbutton = new JRadioButton("MPEG"); JFCMainClient.frame.mpgbutton.setActionCommand("mpg"); JFCMainClient.frame.mpgbutton.addActionListener(this); JFCMainClient.frame.mpgbutton.setToolTipText("Codec: H.264 MPEG-4"); JFCMainClient.frame.webmbutton = new JRadioButton("WEBM"); JFCMainClient.frame.webmbutton.setActionCommand("webm"); JFCMainClient.frame.webmbutton.addActionListener(this); JFCMainClient.frame.webmbutton.setToolTipText("Codec: Google/On2's VP8 or Googles WebM"); JFCMainClient.frame.flvbutton = new JRadioButton("FLV"); JFCMainClient.frame.flvbutton.setActionCommand("flv"); JFCMainClient.frame.flvbutton.addActionListener(this); JFCMainClient.frame.flvbutton.setToolTipText("Codec: Flash Video (FLV1)"); bgroup = new ButtonGroup(); bgroup.add(JFCMainClient.frame.mpgbutton); bgroup.add(JFCMainClient.frame.webmbutton); bgroup.add(JFCMainClient.frame.flvbutton); JFCMainClient.frame.mpgbutton.setSelected(true); JFCMainClient.frame.mpgbutton.setEnabled(true); JFCMainClient.frame.webmbutton.setEnabled(true); JFCMainClient.frame.flvbutton.setEnabled(true); JFCMainClient.frame.save3dcheckbox = new JCheckBox("3D"); JFCMainClient.frame.save3dcheckbox.setToolTipText("stereoscopic video"); JFCMainClient.frame.save3dcheckbox.setSelected(false); JFCMainClient.frame.save3dcheckbox.setEnabled(true); JFCMainClient.frame.save3dcheckbox.addItemListener(this); radiopanel = new JPanel(new GridLayout(1, 0)); radiopanel.add(JFCMainClient.frame.save3dcheckbox); radiopanel.add(JFCMainClient.frame.mpgbutton); radiopanel.add(JFCMainClient.frame.webmbutton); radiopanel.add(JFCMainClient.frame.flvbutton); gbc.gridx = 1; gbc.gridy = 1; gbc.gridheight = 0; gbc.gridwidth = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHEAST; this.panel.add(radiopanel, gbc); JLabel hint = new JLabel( isgerman() ? "eingeben, reinkopieren, reinziehen von YT-Webadressen oder YT-Videobilder:" : "Type, paste or drag'n drop a YouTube video address:"); gbc.fill = 0; gbc.gridwidth = 0; gbc.gridheight = 1; gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; this.panel.add(hint, gbc); this.textinputfield = new JTextField(20); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 2; this.textinputfield.setEnabled(true); this.textinputfield.setFocusable(true); this.textinputfield.addActionListener(this); this.textinputfield.getDocument().addDocumentListener(this); this.panel.add(this.textinputfield, gbc); this.quitbutton = new JButton("", createImageIcon("images/exit.png", "")); gbc.gridx = 2; gbc.gridy = 5; gbc.gridwidth = 0; this.quitbutton.addActionListener(this); this.quitbutton.setActionCommand("quit"); this.quitbutton.setToolTipText("Exit."); this.panel.add(this.quitbutton, gbc); pane.add(this.panel); addWindowListener(this); JFCMainClient.frame.setDropTarget(new DropTarget(this, this)); JFCMainClient.frame.textarea.setTransferHandler(null); // otherwise the dropped text would be inserted }