• Post Reply Bookmark Topic Watch Topic
  • New Topic

repaint not working

 
S Connor
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to make a simple program that will feature some graphics. It will have a JCombobox that the user selects to draw various shapes. I can't get the repaint function to work however. Please help!



Many thanks for any sggestions
 
Carey Brown
Bartender
Posts: 2257
28
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off your case statements need a 'break' after them.
 
Carey Brown
Bartender
Posts: 2257
28
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are creating two ColorJPanels only one of which you are setting the shape number on, the other is always shape '3'. Your frame size is too small, you'll see the rectangle if you stretch the window out.
 
Carey Brown
Bartender
Posts: 2257
28
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are setting the layout in two places; should only be in one. Suggest using BorderLayout and putting the ComboBox in NORTH and the panel in CENTER.
 
S Connor
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Could you explain how I get my JComboBox class to modify the behaviour of an instance of another class (in this case the ColorJPanel class)?
When I delete the second ColorJPanel class, there is no way for the JComboBox to access the Panel it needs to communicate with.
EDIT: have resolved issues, thank you for the help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!