JCheckBox is the Java Swing implementation of a check box, an item that can be selected or deselected, and which displays its state to the user.
Questions tagged [jcheckbox]
613 questions
2
votes
2 answers
JCheckBox value in JTable
JCheckBox is checked but it still shows its value as false when i use system.out.print .If the focus is lost but with JCheckBox still checked then it returns true.
i.e when i check 2 checkbox the result showed is for first checkbox. the status of…

user1101703
- 21
- 1
- 5
2
votes
2 answers
How to make a checkbox non-editable in Java?
I have a checkbox. I will obtain one value from a database to determine whether the checkbox can be edited or not. If this value is zero, the checkbox should not be selected. How do I achieve that in code? Please help me out here. This is my…

shree
- 2,745
- 7
- 28
- 35
2
votes
1 answer
Preventing checkboxes from moving in a JTable
I have a column in a JTable with cells rendered as checkboxes below:
How do I prevent the checkboxes from moving every time I click on it? Here is my cell renderer and cell editor:
protected class CheckBoxCellRenderer extends JCheckBox implements…

BJ Dela Cruz
- 5,194
- 13
- 51
- 84
2
votes
2 answers
How can I determine which JCheckBox caused an event when the JCheckBox text is the same
I am working on a program that needs to determine which JCheckBox was selected. I am using three different button groups, two of which have overlapping text. I need to be able to determine which triggered the event so I can add the appropriate…

Nick
- 33
- 1
- 7
2
votes
1 answer
How to avoid redundant coding with JCheckBoxes in Java
I have a set of classes that implement a particular interface and I have a set of checkboxes. I want to throw an error if no checkboxes are selected. If atleast one or more checkboxes are selected, then it should create objects associated with that…

Vigneshwaran
- 3,265
- 6
- 23
- 36
2
votes
1 answer
Enable and disable the JCheckbox (or Checkbox panel) while selecting radio button
I'm very new to JFrame, I was trying to enable and disable the JCheckbox (or) JCheckbox panel depends on radio button selection.
Here :
If "Yes" Radio button is selected JCheckboxs panel needs to be disabled and Textbox should be enabled.
If "No"…

vinoth
- 45
- 5
2
votes
2 answers
Question on jtable cell editors in swing
I want to implement a component that serves as a list of options, that a user can choose to select or not.
Visually I thought that it would be best presented in a UI (if there is a better approach please tell me) as follows:
Anyway, I thought that…

Cratylus
- 52,998
- 69
- 209
- 339
2
votes
1 answer
adding actionlistener to jcheckbox in java
I use the following code to generate a table with three columns and three rows, the first column contains checkboxes, and the second column just contains the word : row i, where i corresponds to the row number.
private void loadTable {
int…

shaw
- 215
- 2
- 5
- 9
2
votes
1 answer
how to add a checkbox into JList (java netbeans)?
I have added a checkbox into JList its working successfully but problem is it not select multiple checkbox in same time and the multi-selection code for checkbox not working and I also add the image.
…

Mirwais Faizi
- 41
- 6
2
votes
2 answers
Can JCheckBox components be added to JComboBoxes?
Can JCheckBox components be added to JComboBoxes? If so, how?

ravI Teja
- 23
- 1
- 3
2
votes
1 answer
Is JCheckBox.isSelected() thread safe?
I am currently refactoring an application I made to be thread safe.
I have a JCheckBox that I need to check. This JCheckBox is referenced throughout the program in various different threads.
Can I simply call checkbox.isSelected() or do I have to…

DCON
- 628
- 5
- 18
2
votes
1 answer
How does Java applet use the item selected in a JComboBox
The goal of the current program is to create a line, of varying thickness, between two points in a window frame. So far, so good.
Next, I would like the program to recognize that the user has made a selection from the JComboBox.
This post, and the…

johniccp
- 41
- 1
- 5
2
votes
1 answer
How to properly set editable checkbox inside a JTable cell in Java Swing application?
I have a JTable, where I have couple of JCheckBoxes. I am initializing JCheckBoxes and other cells values from database. My problem is, when I click on the JCheckBox to checked or unchecked, they don't do nothing.
When I clicked twice, the editable…

Sadequer Rahman
- 133
- 5
- 11
2
votes
2 answers
Optimizing text from JTextField based selected buttons
I'm pretty new to java and I have a small issue with my code. The code works pretty well but I feel like it can be improved.
Here's the code:
if(evt.getStateChange()==1){
String value = "-MyAppArgument ";
String temp =…

Cravenica
- 169
- 10
2
votes
2 answers
How do I write superscript word for checkbox text in java?
I made few checkboxes using swing in Java.
I want to write a superscript text for the checkboxes but I'm not sure how.
The code currently looks like this.
JCheckBox hCheckBox = new JCheckBox("[M + H]+");
I want to have "+" sign inside the JCheckBox…

js0823
- 1,843
- 8
- 24
- 36