Questions tagged [jradiobutton]

JRadioButton is the Java Swing implementation of a radio button.

JRadioButton is a Java implementation of a radio button -- an item that can be selected or deselected, and which displays its state to the user. Used with a ButtonGroup object to create a group of buttons in which only one button at a time can be selected.

Relevant tutorials:

445 questions
2
votes
2 answers

Changing source of JTable in Netbeans and updating it

I am working on a GUI that will feature a table that has been manually connected to a database. Above this table there are 3 radio buttons that will "decide " what criteria is to be used when fetching the data( All rows have a boolean value,…
Orvil Nordström
  • 325
  • 6
  • 18
2
votes
4 answers

How to get value of selected radioButton of buttonGroup

How to get value of selected radioButton? I tried using buttonGroup1.getSelection().getActionCommand() (as posted in some of answers here) but it is not working. Also, i am temporarily using this code but i want to know is this a good practice or…
Malwinder Singh
  • 6,644
  • 14
  • 65
  • 103
2
votes
2 answers

Java trouble with ArrayLists when there are multiple classes and help fixing up the code

I've come to the conclusion that I have 3 questions. How do I use the variables and arrayList of the company class in the Employee class. How should I make the actionListeners so the operate correctly. Would the methods in the Company class work…
user3482560
2
votes
1 answer

How to set image and text on JRadioButton?

I am using Swing and JRadioButton in my application. I need to set image and text on my button. For that I am using this: JRadioButton button1 = new JRadioButton("text", iconpath, false); But what it giving output is it's hiding radio button and…
Kishan Bheemajiyani
  • 3,429
  • 5
  • 34
  • 68
2
votes
1 answer

Correct syntax for disabling a radio button after it was chosen

is it possible to disable a radio button? after a user chooses one of the radio buttons , i don't want them changing answers so i want to disable the radio button, i've used radioButton.setEnable(false) but still it's able to choose other radio…
2
votes
3 answers

Setting print size of a jLabel and put a jRadiobutton on the print

I have a jLabel with an Icon that I should print. However, I can't get the jLabel's icon to full size. Here's some of the code that I think that it is affecting the print size. public static void printComponentToFile(Component comp, boolean fill)…
user3337385
  • 83
  • 1
  • 1
  • 10
2
votes
3 answers

Can a JRadioButton be in several ButtonGroups?

I'm trying to set up a JRadioButton-Matrix, so that in each column and in each row, only one Button can be selected at a time. I have the following code: JRadioButton[][] button = new JRadioButton[names.length][names.length]; ButtonGroup[] r = new…
Zuerill
  • 21
  • 2
2
votes
5 answers

Java radio button selection and proceed

I want to have the user to select either one of the choices. but my code doesnt work. not sure if i got it wrong if (!jRadioMale.isSelected() || !jRadioFemale.isSelected()) { JOptionPane.showConfirmDialog(rootPane, "Please Select Male or…
BeyondProgrammer
  • 893
  • 2
  • 15
  • 32
2
votes
4 answers

JRadioButton navigation with arrow keys

I am trying to get a group of JRadioButtons to be navigable using the arrow keys. I was going to implement this manually with KeyListeners, but apparently this behavior is already supposed to work for at least the last 8 years…
Boann
  • 48,794
  • 16
  • 117
  • 146
2
votes
1 answer

how to set radio buttons initial value on Netbeans for a Java desktop application?

This app I'm working on has three radio buttons, but I need to open the JFrame with one of them selected and the other two not. Upon the JFrame load, I call the following method: private void initJRadio() { jRadioButton1.setSelected(false); …
gtludwig
  • 5,411
  • 10
  • 64
  • 90
2
votes
1 answer

JMenu disappears when JRadioButtons or JCheckBoxes are used

I have created a JMenuBar with a Pizza JMenu. The JMenu has 3 JRadioButtons and 2 JCheckBoxes that appear when menuItems are scrolled over. The problem is that when I click on a JRadioButton or JCheckBox, the whole menu disappears. Is there a…
Marcus Ward
  • 37
  • 1
  • 6
2
votes
3 answers

Adding array of JRadioButtons with variable length to a JWindow

Hello everyone I was trying to add an array of variable length to a JWindow but I am getting a run time error. Want help from here .. Here is my code : package components; import java.util.Calendar; public class FullDay extends…
Mavrick
  • 505
  • 1
  • 7
  • 27
2
votes
1 answer

Possible to prevent the firing of actionlistener on one occasion?

The situation: The states of a set of components are saved to an XML file. Everything saves fine. I am trying to load the same data to the same components (although the rest of the application may be in a different state, e.g. new instance of the…
Kirsty Williams
  • 340
  • 1
  • 2
  • 10
2
votes
1 answer

JRadioButtons not working

I'm having an issue where my JRadioButtons will not appear until moused over. I've looked up this issue before and it seems most people have solved it using layouts. However, I am not supposed to use them for my assignment, being completely new to…
2
votes
3 answers

How to structure my attendance program

I'm in the process of making an application that keeps attendance. Once I have a list of students, how would I go about displaying them all and checking whether they are present or absent. I intially thought JTable would work, but it's not the…
Joel Christophel
  • 2,604
  • 4
  • 30
  • 49