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
25
votes
2 answers

How to manage two JRadioButtons in java so that only one of them can be selected at a time

How to manage two JRadioButtons in java so that only one of them can be selected at a time? Is there any method in java to take care of this or you need to build your own logic?
stillStudent
  • 449
  • 2
  • 5
  • 7
23
votes
7 answers

Applying a tint to an image in java

I am trying to create several similar visual styles for my programs, each with a different color theme. To do this, I have implemented the use of icons to represent the different states of JCheckBoxs and JRadioButtons. Instead of making one full set…
Ky -
  • 30,724
  • 51
  • 192
  • 308
17
votes
3 answers

How to add a radio button group in a core java program such that only one radio button is selected at one time?

I am building a project in core java. BUt i'm stuck in making a radio button group ( for entering the gender (male/female). For that i need a radio group such that only one radio button is selected at one time; and take the input into the database…
shubh
  • 253
  • 2
  • 3
  • 9
14
votes
1 answer

adding JRadioButton to RadioButton group

Good day Would like to know how to add radiobuttons to a ButtonGroup by dragging and dropping components on to the frame. JRadioButton male = new JRadioButton("Male"); JRadioButton female = new JRadioButton("Female"); ButtonGroup bg = new…
Arianule
  • 8,811
  • 45
  • 116
  • 174
11
votes
5 answers

How to add radio buttons in button group?

After dragging and dropping button group in Netbeans 7.2, how to add radio button in that button group?
Pradip Kharbuja
  • 3,442
  • 6
  • 29
  • 50
11
votes
5 answers

Action Listener on a radio button

I would like to set editable option of a text box based on the selection of a radio button? How to code the action listener on the radio button?
agarwav
  • 400
  • 2
  • 8
  • 16
10
votes
2 answers

Listening on ButtonGroup for "child" changes, and print selected JRadioButton's text

What I want to is: Create an event that fires if the a JRadioButton contained in the ButtonGroup is selected, and then print the text there is on the JRadioButton.
Tyilo
  • 28,998
  • 40
  • 113
  • 198
6
votes
4 answers

JRadioButton: how to replace text by IconImage?

I want to replace the text in my radio button list by an icon. I've tried this: rotateButton = new JRadioButton(rotateIcon.getImage()); But this replaces the radio button and text by the icon. I would like to keep the radio button and display the…
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
6
votes
2 answers

Disable group of radio buttons

I have a group of radio buttons defined as 'ButtonGroup bg1;' using 'javax.swing.ButtonGroup' package. I would like to disable this group so that the user cannot change their selection after clicking the OK-button 'btnOK'. So I was looking for…
Christian
  • 991
  • 2
  • 13
  • 25
6
votes
2 answers

Java Swing: Add a component by code in NetBeans

I'm using NetBeans, and I've a JFrame where I added a JPanel to it using the NetBeans's palette. I want to add a JRadioButton manually to that JPanel, so this is the code I tried in the constructor : ButtonGroup group = new…
Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191
6
votes
3 answers

Swing: hovering mouse over radio button label on translucent JPanel

In my problem I have an opaque JPanel and another JPanel that is translucent(semi-transparent) which sits on the first JPanel. When I have added radio buttons onto the top JPanel. The problem is every time I enter mouse over the area of the label of…
Chamz Des
  • 183
  • 1
  • 2
  • 12
5
votes
1 answer

Is there a way to change font color of Jradiobuttons using the UImanager

I know I how to change the font of a JRadioButton using UIManager and I know how to change the color of a JRadioButton, one button at a time. However is there a way, using the UIManager to change all JradioButtons in my application so that the…
Elliott
  • 5,523
  • 10
  • 48
  • 87
5
votes
3 answers

setSelected a specific jradiobutton in a buttongroup based on action command

i want to setSelected a speicfic jradiobutton in a buttongroup based on the actionCommand(/name of the specific jradiobutton). it could be done usind .setSelected(true) for example, JRadioButton rabbitButton = new JRadioButton("rabbit"); …
Neon Shri
  • 51
  • 1
  • 1
  • 3
5
votes
2 answers

Rectangular Java Swing Radio buttons?

I'd like to create a set of buttons in a Java Swing application like you get in a typical tool palette in a paint program. That is, a set of small square buttons, each containing an icon, only one of which is pressed down, and when you press another…
Nick Fortescue
  • 43,045
  • 26
  • 106
  • 134
5
votes
2 answers

Java: What's the difference between ActionEvent and ItemEvent on a JRadioButton?

They're both raised once after the mouse button is released and both can have all the information available on the JRadioButton right? Is there any difference?
iceburn
  • 987
  • 3
  • 13
  • 16
1
2 3
29 30