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
1
vote
2 answers

Use JRadioButtons to set two text fields

Very new to Java here. How do I use a JRadioButton to set two different text fields? The three buttons are: 1. 7 at 5.35% 2. 15 at 5.5% 3. 30 at 5.75% Choice 1 sets field1 to 7 and field2 to 5.35 Choice 2 sets field1 to 15 and field2 to 5.5 Choice…
user617273
  • 11
  • 3
1
vote
1 answer

Huge gap between JLabel and JRadiobutton?

I have a problem. I have huge gap between the Label and radiobuttons but I dont want to have the gaps. I think it is because of my Layout but I am not sure. Importent: Below this is a Picture. Picture has more to say then words^^ "Action choose"…
KukuBra
  • 33
  • 1
  • 6
1
vote
3 answers

Getting value from JRadioButton

I'd like to change value of my variable "name" when I select right button and click "ok" on my JRadio Frame. For example when i select r1 and hit "ok" I'd like to have name=="Fast" in the entire package. package Snake; public class Radio extends…
user7944431
1
vote
1 answer

RadioButton on DefaulTableModel

How can I add a JRadioButton on my table with the help of DefaultTableModel?
1
vote
2 answers

how to add a round border to a jradiobutton

Hi I need to add a Round Border, that could be etched, beveled etc. for a JRadioButton. to allow the button to keep its round appearance. but i cannot find any round borders. does anyone know how to do this? chis
f1wade
  • 2,877
  • 6
  • 27
  • 43
1
vote
1 answer

Selected RadioButton on ButtonGroup doesn't show into TextArea in Java

I'm a student and right now I have a project for my college. this is short of my code. private void buttonProccesActionPerformed(java.awt.event.ActionEvent evt) { String gender =…
1
vote
1 answer

How to set a shortcut key for JRadioButton without modifiers

I'm working in a project where I need to add a key shortcut for each JRadioButton, while looking on another similar question and as I'm using some other custom Actions I decided to use the method setAction on each of my JRadioButtons, however it…
Frakcool
  • 10,915
  • 9
  • 50
  • 89
1
vote
2 answers

Java determining if which JRadioButton was selected

I know that it is possible in an event driven program in Java to find out what object caused an event (e.g. JRadioButton was selected, therefore a certain action will take place). My question is, if you have 2 JRadioButtons in a buttongroup, both…
MoneyC
  • 7
  • 3
1
vote
1 answer

setText on JRadioButton dynamically

I have one JInternalframe in which there are many JRadioButton and JLabel. I want to Retrive Data from Database and display on this JRadioButton and JLabel Since there can be any numbers of row in Database which will be fetched. I had successfullly…
Kartik Agarwal
  • 1,129
  • 1
  • 8
  • 27
1
vote
1 answer

My JRadioButton does not shows when I run but when I click on that area it shows

Hello Im facing this problem in netbeans 8.1 when I run my simple swing application. My frame shows only one radio button and for second radio button when I select on that area it shows and when I deselect it disappears. Check the below images When…
topper1309
  • 151
  • 3
  • 16
1
vote
2 answers

Making JRadioButton random

my data comes from query like this to my radio buttons: radio1.setText(Question.get(i).getChoiceOne()) // assign ist choice to ist radio button radio2.setText(Question.get(i).getChoiceTwo()) // assign second choice to second…
s.shah
  • 21
  • 6
1
vote
1 answer

Radio buttons don't show

I am trying to make survey in java. I have 20 questions and 5 possible choices. I was thinking of making 20 labels and 100 radio buttons grouped by 5. I managed to manually add labels using the Net beans GUI, but I wanted to generate buttons, but…
1
vote
0 answers

Align JRadioButtons and Labels

Good afternoon! I have this two methods that create 5 rows with each row being a label and five radio buttons on a button group: private JPanel criarPainelAvaliacoes() { JPanel painel = new JPanel(); BoxLayout box = new BoxLayout(painel,…
Diogo Santos
  • 780
  • 4
  • 17
1
vote
1 answer

JCheckBox enables/disables JRadioButton

I have a group of JRadioButtons and a single JCheckBox. If the JCheckBox is unchecked, the JRadioButtons should disable and reset, and vice versa. The problem I have is whether I check the JCheckBox or not, the JRadioButtons stay disabled. Also…
Maikyl
  • 35
  • 6
1
vote
2 answers

How to deselect already selected JRadioButton by clicking on it

Let's say we are having some JRadioButtons which belongs to same ButtonGroup, when user clicks on a JRadioButton it got selected. I want to add a feature that when user click on already selected JRadioButton, it gets deselected, that is whole…
Sukhbir
  • 553
  • 8
  • 23