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
1 answer

How to disable group of radio buttons in java

Hello I am looking for a way to disable a radio buttons if textfield is empty. My radio buttons called buttonGroup1(jbutton1,jbutton2,jbutton3,jbutton4) should be disabled if textfield is empty but I have no idea how to make if statment for this
user2121038
  • 153
  • 1
  • 3
  • 14
1
vote
3 answers

What am i doing wrong in retrieving value of button group?

import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import net.java.dev.designgridlayout.DesignGridLayout; import java.sql.*; class databaseprob { JFrame JF; Container C,C1; JDesktopPane…
Toms
  • 239
  • 1
  • 5
  • 15
1
vote
1 answer

Adding a Buttongroup to a GUI OR making only one button selected at a time without a GUI

I am currently working on a project that will take theorhetical orders for Pizza. One panel I'm making will have three options for Pizza. Thin crust, regular, and deep dish. My initial thought was to use a Buttongroup, because those make it so only…
1
vote
1 answer

How to test if my jradiomenubutton it's the value that i wanted

What are the best way to test my return value if its the value that i selected, Somehow i'm stuck with the concept on how to get the value selected... what my function does right now ,its that i added all the button that i wanted in my GUI and i…
Andy Ho
  • 179
  • 1
  • 3
  • 15
1
vote
1 answer

Cannot properly add values to ArrayList from radio Buttons - Java GUI

I have created a program that allows a user to choose restaurant menu items and adds the total of each item creating a double mealTotal for each person. I need to also add each mealTotal every time a new person is entered(using the Next Person…
lchristina26
  • 205
  • 5
  • 20
1
vote
1 answer

How to return a String from function with vararg

The method is supposed to create as many buttons, as it is given Strings and then return the selected String. Eclipse says that my return statement doesnt return a String. How do I have to write the return statement for it to do so? private static …
1
vote
1 answer

Get text from JRadioButton that isn't part of a ButtonGroup

My program is a GUI. I have this method where when a button is clicked. It populates the next screen with JRadioButtons dynamically. private void setExamButtonActionPerformed(java.awt.event.ActionEvent evt) { …
C-Elipse
  • 43
  • 4
1
vote
1 answer

how to change JRadioButton selectionBall's color?

how to change JRadioButton selectionBall's color? we should use BasicRadioButtonUI? how should we do that? or we should change the radioButton's selectedIcon ?
shayan
  • 79
  • 1
  • 9
1
vote
1 answer

Using getSource for actions on components of unknown types

I want to track specific components clicked in a specific order. I am using getSource and flags like this: public void actionPerformed(ActionEvent e) { JButton q = (JButton)e.getSource(); JRadioButton w = (JRadioButton)e.getSource(); if…
user2079483
  • 135
  • 2
  • 3
  • 12
1
vote
1 answer

Java Radio Button changes Button Text in another Panel

I'm making a Calendar in java for my Programming II class and I need some help. I've made my calendar so that it is 6 x 7 grid of buttons and created a method which changes the button text to match the selected month (chosen by a radio button). It…
Marz A
  • 13
  • 4
1
vote
2 answers

Swing: how to get container bind to JRadioButton?

I have a bunch of dynamically added panels that contain radio button and a panel with several labels bind to radio button. Suppose I have a button that should retrieve container with labels bind to selected radio button or let's say another words -…
Dragon
  • 2,431
  • 11
  • 42
  • 68
1
vote
2 answers

Multiple radio buttons getting selected

I have two radio buttons made in java. The problem is they are not linked together i.e. they both can be selected at the same time. How do i achieve link between them?
one.whoknocks
  • 58
  • 1
  • 7
1
vote
2 answers

setEnabled(true) when radioButton.isSelected()

as I said in other posts I'm new in Java and I'm having some dumb problems, here's the deal: I have a radioButton (radioStock) and a textField (stockField). I want stockField to be setEnabled(false) by default, no problem with that, and whenever the…
Agustín
  • 1,546
  • 7
  • 22
  • 41
1
vote
1 answer

My JRadioButtons arent interacting with my JButton

public Quiz(){ frame = new JFrame(); frame.setSize(500, 500); frame.setLocationRelativeTo(null); frame.setTitle("x"); frame.getContentPane().setBackground(Color.GRAY); frame.setLayout(new FlowLayout()); label = new…
1
vote
1 answer

How to add a button group of JRadioButtons in a Panel or just JRadioButtons in a panel in Java?

I am trying to make a menu of a restaurant and the reason I am putting this question is because I want to have 4 panels using border layout.I am having 4 panels each of them named westPanel,topPanel,eastPanel and bottomPanel.I have already made the…