Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i have a "main" JPanel inside a JFrame, and I have two inner "little" JPanels, and when you click one it becomes enabled, and you can move it around with the directional keys..

is there a method to see if a jpanel is touching, or intersecting another, so you can do the move, test, then setBounds??

Justin
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make up methods to do these for you.
For intersection/collision:

For boundry–checking (staying within big JPanel):
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, ill try those out : )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic