I would like to have JRadioPanelwith three parameters. The first two are hard-coded options, and I want the third to be “different”. I would like to have JTextFieldthis button instead of text, but I'm not sure how to do it. I tried just putting the field as an argument for the switch, but he didn't like it. I did not find anything online to tell me, except, perhaps, through NetBeans, and this does not do me much good. Is there a way to easily do this, or do I need to do some fancy stuff with a layout?
Ok, a new problem. Buttons look right, but for some reason they are in a row instead of a column. Here is the code for it. I don’t know why this is done.
tf2 = new JTextField("Other", 20);
newName.setActionCommand("newname");
fulfillment.setActionCommand("fulfillment");
fulfillment.setSelected(true);
type.add(fulfillment);
type.add(newName);
fulfillment.addActionListener(this);
newName.addActionListener(this);
GridBagConstraints rC = new GridBagConstraints();
JPanel radioPanel3 = new JPanel(new GridBagLayout());
rC.gridwidth = 2;
radioPanel3.add(fulfillment);
rC.gridy = 1;
radioPanel3.add(newName);
rC.gridy = 2;
rC.gridwidth = 1;
radioPanel3.add(other);
rC.gridx = 1;
radioPanel3.add(tf2);
c.gridx = 10;
c.gridy = 4;
pane.add(radioPanel3, c);