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
3
votes
0 answers

How do I iterate over a ButtonGroup in Swing?

I have a group of RadioButtons in a JPanel. I want them to have a green background when not selected, and a red background when one is selected. By the very nature of JRadioButtons, only one should be red at a single time. My problem is that setting…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
3
votes
2 answers

Creating a GUI with for loop using Java Swing

I have a GUI, from this GUI I choose an input file with the dimensions of a Booking system(new GUI) If the plane has 100 seats the GUI will be for example 10x10, if the plane has 200 seats it will be 10x20, all the seats are going to be buttons, and…
Anarkie
  • 657
  • 3
  • 19
  • 46
3
votes
2 answers

how can I define label position of a jRadioButton on Netbeans?

I'd like to define label position of jRadioButtons on a buttonGroup on Netbeans so the label would be positioned under its radioButton. Can it be done?
gtludwig
  • 5,411
  • 10
  • 64
  • 90
3
votes
1 answer

Clearing a group of radio buttons in Java

I have a program which prompts users to select a choice out of four options (from a group of RadioButtons). Once the user has made a choice, he/she clicks a button and then receives a message. After closing the window, the user will go back to the…
PAT
  • 61
  • 1
  • 1
  • 9
3
votes
1 answer

JRadioButtonMenuItem with a tick

I am wondering if it's possible to change the default radio button menu item appearance in Java Swing. By default a circle with a dot inside will indicate the selected state of the button, but i just want the good old fashioned tick next to a…
Dany Khalife
  • 1,850
  • 3
  • 20
  • 47
3
votes
1 answer

JRadio Buttons are "Hiding" in GridBagLayout

Please have a look at the following code package normal; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Form extends JFrame { private JLabel heightLabel, weightLabel, waistLabel, neckLabel,…
PeakGen
  • 21,894
  • 86
  • 261
  • 463
3
votes
1 answer

How to enable a disabled JRadioButton

I have two JRadioButton with ImageIcon for each one. Because of the ImageIcons I'm using, I need to give the appearance that one button is selected and the other one is not selected. To do this I'm trying to disable the other button, which…
Marquinio
  • 4,601
  • 13
  • 45
  • 68
3
votes
0 answers

Checkboxes and Radio Buttons Together in a JTree

I'd like to create a JTree that more or less has the following structure (with a hidden root node) [No Option] Main Dish [Radio Button] Steak [Radio Button] Fish [Radio Button] Filet Mignon [Checkbox] Side Dish [Checkbox] Mashed…
Thunderforge
  • 19,637
  • 18
  • 83
  • 130
3
votes
1 answer

Switch Like Interface using JRadioButtons

Can anyone please tell me how to make an interface like that which is been shown below. Right now i'm using two JRadioButton for implementing that task. My code which i've done is shown below JRadioButton but1 = new JRadioButton("Option…
Nidhish Krishnan
  • 20,593
  • 6
  • 63
  • 76
3
votes
2 answers

Pressing JRadiobutton freezes GUI

I am new to Swing so this might seem like a very naive question. I have a JFrame which displays an initial statement and two radiobuttons. RadioButton1 is Accept and RadioButton2 is Reject. If the user chooses Accept, the program proceeds. So I have…
user1773010
  • 107
  • 7
3
votes
3 answers

Radio button in JTable not working properly

I have a problem with the following code. My task is, I have to have radio buttons in the first column and when a user selects that radio button that row is selected and sent for processing. But my problem is, I am able to select the radio button…
Amarnath
  • 8,736
  • 10
  • 54
  • 81
3
votes
1 answer

ActionEvent for jButton given a jRadioButton option

So basically, I'm trying to make a simple program here with GUI that let's you make a choice given two jRadioButtons as choices of which either of the two leads to a corresponding storyline in similar fashion to visual novels. The problem however is…
dothackjhe
  • 29
  • 1
  • 2
  • 5
3
votes
1 answer

How to add JRadioButton to group in JTable

I have added radio buttons to a JTable using renderer and editor. I have also created group for the same. I'm unable to achieve the exclusiveness (only 1 radio button should be selected) using this principle. Please see my code below and appreciate…
monk
  • 51
  • 1
  • 3
2
votes
1 answer

returning value out of ButtonGroup()

I am having problem to return a simple int value out of radiobutton i have created. static int f5(String question) { int intValue = 0; answered = false; JFrame f = new JFrame(question); …
Joe Park
  • 139
  • 3
  • 12
2
votes
1 answer

JRadioButton calling options

This is the code: String male = "Male"; String female = "Female"; JRadioButton checkGenderMale = new JRadioButton(male); checkGenderMale.addActionListener(new genderListener()); JRadioButton checkGenderFemale = new…
Maydayfluffy
  • 427
  • 1
  • 7
  • 16
1 2
3
29 30