Questions tagged [jcheckbox]

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.

613 questions
73
votes
2 answers

How to check that a JCheckBox is checked?

How can I check if a JCheckBox is checked?
oneat
  • 10,778
  • 16
  • 52
  • 70
64
votes
5 answers

JCheckbox - ActionListener and ItemListener?

Both ActionListener and ItemListener are used to fire an event with JCheckBox? So, what's the difference between them and in which case one of them is preferred to the other?
TU_HEO DAKAI
  • 2,197
  • 8
  • 28
  • 39
37
votes
8 answers

Java Replace Line In Text File

How do I replace a line of text found within a text file? I have a string such as: Do the dishes0 And I want to update it with: Do the dishes1 (and vise versa) How do I accomplish this? ActionListener al = new ActionListener() { …
Eveno
  • 373
  • 1
  • 3
  • 5
35
votes
11 answers

How do I make a list with checkboxes in Java Swing?

What would be the best way to have a list of items with a checkbox each in Java Swing? I.e. a JList with items that have some text and a checkbox each?
Shabaz
  • 873
  • 1
  • 8
  • 17
24
votes
3 answers

Java Swing: Need a good quality developed JTree with checkboxes

I was looking for a a JTree implementation, that contains checkboxes and which: When you select one node, all its successors in the tree are automatically selected When you unselect one node, all its successors in the tree are automatically…
SomethingSomething
  • 11,491
  • 17
  • 68
  • 126
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
18
votes
2 answers

JCheckbox change the text position

How do i change the position of the text in JCheckbox. I want the text to be on the left of the check box and not as default on the right. i been over the jcheckbox, jtooglebutton and jabstractButton api few times.
Adi Mor
  • 2,145
  • 5
  • 25
  • 44
18
votes
3 answers

Evaluating Checkbox Boolean Value

I'm sure this is a rediculously easy question, but I just can't find the answer to it anywhere. I have a JCheckbox that I need to evaluate the boolean value of, and then change the value with an if statement. The problem is I just can't find the…
justanother1
  • 599
  • 3
  • 7
  • 17
16
votes
1 answer

How to add checkboxes to JTABLE swing

Does anyone know how to put a JCheckBox in a JTable column? Something like this: I took this from How To use Tables Thanks in advance.
java2world
  • 219
  • 1
  • 2
  • 4
12
votes
3 answers

Having a Left and Right Aligned Label inside a JCheckBox

I'll start with what I want then go from there: +------------------------------------------+ |[] jCheckBox jLabel | +------------------------------------------+ Basically I would like to have a JCheckBox with 2 segments of…
Opal
  • 1,057
  • 8
  • 27
12
votes
1 answer

Swing: creating a checkbox or check symbol in menuItem of jMenu

I want to create a checkbox or check symbol in front of menuItem in a JMenu. For example, when we open a Notepad file and click on Format menu there is a checkbox in front of Word Wrap menuItem of the Format menu.
Neeraj singh
  • 257
  • 1
  • 8
  • 18
11
votes
2 answers

JTree rendering with JCheckBox nodes

I am attempting to modify the standard Swing JTree to intermingle nodes with and without checkboxes. This is an example: When I attempt to check/uncheck one of the checkboxes (the 'User 01' node in this example), the tree loses nodes: I my code…
craig
  • 25,664
  • 27
  • 119
  • 205
10
votes
3 answers

How to prevent JPopUpMenu disappearing when checking checkboxes in it?

I want to use JCheckBoxMenuItems in a JPopupMenu. It works, but the problem is that the popup menu disappears when a checkbox item has been checked or unchecked. So if one wants to check/uncheck several items, the popup needs to be launched…
Joonas Pulakka
  • 36,252
  • 29
  • 106
  • 169
10
votes
8 answers

Java Swing - JCheckbox with 3 states (full selected, partially selected and deselected)

I want a JCheckbox that has 3 states as shown below: Partially Selected Unselected Full Selected Q1. Can I use the JCheckbox for the above purpose or have to go for some custom swing component?
Amit
  • 33,847
  • 91
  • 226
  • 299
9
votes
3 answers

how to set JCheckBox to have a check mark, or not within a program

I am using a single JCheckBox as an un-editable indicator for when something happens in my program. Right now I have this: public void update(Observable o, Object arg) { try { if (Controller.c.turn.equals(this)) { …
Cheesegraterr
  • 517
  • 3
  • 14
  • 26
1
2 3
40 41