GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes JCheckBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JCheckBox" Watch "JCheckBox" New topic
Author

JCheckBox

Michelle Botic
Greenhorn

Joined: Aug 13, 2001
Posts: 3
Hope someone can help. I am having a heck of a time getting my checkbox selections to paint properly. When I try to select one, it does not show selected although it is when I retrieve it. have tried calling repaint() on itemStateChanged(), but that does not work.
Please help.
John M. Gabriele
Ranch Hand

Joined: Feb 18, 2001
Posts: 232
Sounds fishy... Are you "painting" anything else besides the little check mark in the little square?
What does your code look like?
Michelle Botic
Greenhorn

Joined: Aug 13, 2001
Posts: 3
nope...just trying to get the check to show. Here is a snippet:
(Used VisualCafe to create GUI)
At class level:
javax.swing.JCheckBox chkBean = new javax.swing.JCheckBox();
From within no-arg constructor:
getContentPane().add(chkBean);
chkBean.setFont(new Font("Dialog", Font.BOLD, 12));
chkBean.setBounds(324,300,24,40);
John M. Gabriele
Ranch Hand

Joined: Feb 18, 2001
Posts: 232
I tried the following code:

and found that the call to setBounds() didn't do a darn thing. I figure because the FlowLayout object takes control over where things go and overrides setBounds(). Take a look at your auto-generated code and see how the setBounds() call gibes with whatever layout model is in effect...

[This message has been edited by john gabriele (edited August 14, 2001).]
 
GeeCON Prague 2014
 
subject: JCheckBox