private JPanel createXPathVersionPanel() { JPanel p = new JPanel(); p.add(new JLabel("XPath Version:")); for (Entry<String, String> values : XPathRule.VERSION_DESCRIPTOR.mappings().entrySet()) { JRadioButton b = new JRadioButton(); b.setText(values.getKey()); b.setActionCommand(b.getText()); if (values.getKey().equals(XPathRule.VERSION_DESCRIPTOR.defaultValue())) { b.setSelected(true); } xpathVersionButtonGroup.add(b); p.add(b); } return p; }
for (String text : options) { JRadioButton option = new JRadioButton(text); option.setActionCommand(text); group.add(option); panel.add(option); }
for (String text : fileList) { JRadioButton btn = new JRadioButton(text); btn.setActionCommand(text); // radiobuttons don't do this by default buttonGroup.add(btn); // ButtonGroup to allow single selection only myRadioPanel.add(btn); // JPanel usually uses a GridLayout } // if myRadioPanel is already in the GUI, then revalidate and repaint it
JRadioButton enableButton = new JRadioButton("Enable"); enableButton.setActionCommand(ON); JRadioButton disableButton = new JRadioButton("Disable"); disableButton.setActionCommand(OFF);
// radio buttons q1 JRadioButton question1option1 = new JRadioButton(multichoicequestions[0], false); // **** here ***** JRadioButton question1option2 = new JRadioButton(multichoicequestions[1], false); question1option2.setActionCommand("q1o2"); question1option2.addActionListener(onClick); JRadioButton question1option3 = new JRadioButton(multichoicequestions[2], false); question1option1.setActionCommand("q1o3"); // actionCommand 1 start.addActionListener(onClick); JRadioButton question1option4 = new JRadioButton(multichoicequestions[3], false); question1option1.setActionCommand("q1o4"); // a ??? second actionCommand to the same button ???
JRadioButton carrots = new JRadioButton("Carrots"); carrots.setActionCommand("carrots"); JRadioButton peas = new JRadioButton("Peas"); peas.setActionCommand("peas"); ButtonGroup group = new ButtonGroup(); group.add(carrots); group.add(peas);
JRadioButton k = new JRadioButton("<html><font color = 'white'>" + ranLetter + "</font></html>"); k.setActionCommand("Incorrect"); k.addActionListener(listener);
private JRadioButton createComparatorButton(String name, int value, ButtonGroup group) { JRadioButton button = new JRadioButton(name); button.setActionCommand(String.valueOf(value)); button.addActionListener(this); group.add(button); return button; }
private void addNetworkButton(JPanel panel, GridBagConstraints constraints, ButtonGroup group, String text, int mask) { JRadioButton btn = new JRadioButton(text); btn.setActionCommand(String.valueOf(mask)); btn.setSelected(mask == ModelRecord.NETWORK_NONE); panel.add(btn, constraints); group.add(btn); constraints.gridy++; }
JScrollPane scrollPane = new JScrollPane(); JPanel view = new JPanel(new GridLayout(0, 1)); String[] usernames = {"User1", "User2", "User3"}; ButtonGroup group = new ButtonGroup(); this.group = group; for (String name: usernames) { JRadioButton button = new JRadioButton(name); button.setActionCommand(name); button.addActionListener(this); this.group.add(button); view.add(button); } scrollPane.setViewportView(view); // Add scrollpane to WEST position of main view
//initiate jradiobutton arraylist (this will be a field at top of class) buttons = new ArrayList<JRadioButtons>(); //Create buttons with a listener attached JRadioButton b1 = new JRadioButton("RadioButton One"); b1.setActionListener(myActionListener); b1.setActionCommand("select"); buttons.add(b1); //Add rest of buttons in the same way JRadioButton b2... //Add the radio buttons to your panel and such
private JPanel makeSourcePanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createTitledBorder("Apply to:")); useBody = new JRadioButton("Response Text"); useVariable = new JRadioButton("JMeter Variable:"); srcVariableName = new JTextField(20); group = new ButtonGroup(); group.add(useBody); group.add(useVariable); panel.add(useBody); panel.add(useVariable); panel.add(srcVariableName); useBody.setSelected(true); useBody.setActionCommand(JSONPathExtractor.SUBJECT_BODY); useVariable.setActionCommand(JSONPathExtractor.SUBJECT_VARIABLE); return panel; }
private JRadioButton makeDynRadioButton(final int id) { final JRadioButton jrButton = new JRadioButton("Type " + id); jrButton.setActionCommand(TYPE_COMMAND_PREFIX + id); jrButton.addActionListener(this); dynRadioVector.add(jrButton); radioGrp.add(jrButton); markerVector = new CellCntrMarkerVector(id); typeVector.add(markerVector); dynTxtPanel.add(makeDynamicTextArea()); return jrButton; }
JRadioButton maleButton = new JRadioButton( "Male" ); maleButton.setActionCommand( maleButton.getText() );
private void fillMetrics(String[] metrics, JPanel panel) { if (metrics != null) { MetricActionListener listener = new MetricActionListener(); for (int i = 0; i < metrics.length / 2; i++) { JRadioButton radio = new JRadioButton(metrics[2 * i]); String action = metrics[2 * i]; if (action.endsWith(defaultMarker)) { action = action.substring(0, action.length() - defaultMarker.length()); } radio.setActionCommand(action); radio.setToolTipText(metrics[2 * i + 1]); radio.addActionListener(listener); buttonGroupMetrics.add(radio); panel.add(radio); } } else { panel.add(new JLabel(" None...")); } }
/** Sets the up literal panel. */ protected void setUpLiteralPanel() { panelLiteral = new JPanel(); panelLiteral.setBorder(null); panelLiteral.setLayout(new BoxLayout(panelLiteral, BoxLayout.X_AXIS)); rdbtnLiteral = new JRadioButton( Localisation.getString( ExpressionPanelv2.class, "ExpressionPanelv2.literal")); rdbtnLiteral.setMinimumSize(new Dimension(100, 20)); rdbtnLiteral.setPreferredSize(new Dimension(100, 20)); panelLiteral.add(rdbtnLiteral); rdbtnLiteral.setActionCommand(LITERAL); buttonGroup.add(rdbtnLiteral); box.add(panelLiteral); }
private JPanel createXPathVersionPanel() { JPanel p = new JPanel(); p.add(new JLabel("XPath Version:")); for (Entry<String, String> values : XPathRule.VERSION_DESCRIPTOR.mappings().entrySet()) { JRadioButton b = new JRadioButton(); b.setText(values.getKey()); b.setActionCommand(b.getText()); if (values.getKey().equals(XPathRule.VERSION_DESCRIPTOR.defaultValue())) { b.setSelected(true); } xpathVersionButtonGroup.add(b); p.add(b); } return p; }
public AdditionalFieldsPanel(boolean showConcurrencyLimit) { JPanel groupPanel = new HorizontalPanel(); unitMinutes.setActionCommand(ArrivalsThreadGroup.UNIT_MINUTES); unitSeconds.setActionCommand(ArrivalsThreadGroup.UNIT_SECONDS); unitGroup.add(unitMinutes); unitGroup.add(unitSeconds); groupPanel.add(unitMinutes); groupPanel.add(unitSeconds); add("Time Unit: ", groupPanel); add("Thread Iterations Limit: ", iterations); add("Log Threads Status into File: ", logFile); if (showConcurrencyLimit) { add("Concurrency Limit: ", concurrLimit); } }
public AdditionalFieldsPanel(boolean showConcurrencyLimit) { JPanel groupPanel = new HorizontalPanel(); unitMinutes.setActionCommand(ArrivalsThreadGroup.UNIT_MINUTES); unitSeconds.setActionCommand(ArrivalsThreadGroup.UNIT_SECONDS); unitGroup.add(unitMinutes); unitGroup.add(unitSeconds); groupPanel.add(unitMinutes); groupPanel.add(unitSeconds); add("Time Unit: ", groupPanel); add("Thread Iterations Limit: ", iterations); add("Log Threads Status into File: ", logFile); if (showConcurrencyLimit) { add("Concurrency Limit: ", concurrLimit); } }
public AdditionalFieldsPanel(boolean showConcurrencyLimit) { JPanel groupPanel = new HorizontalPanel(); unitMinutes.setActionCommand(ArrivalsThreadGroup.UNIT_MINUTES); unitSeconds.setActionCommand(ArrivalsThreadGroup.UNIT_SECONDS); unitGroup.add(unitMinutes); unitGroup.add(unitSeconds); groupPanel.add(unitMinutes); groupPanel.add(unitSeconds); add("Time Unit: ", groupPanel); add("Thread Iterations Limit: ", iterations); add("Log Threads Status into File: ", logFile); if (showConcurrencyLimit) { add("Concurrency Limit: ", concurrLimit); } }