• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JCheckBox

 
Michelle Botic
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic