wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPanel" Watch "JPanel" New topic
Author

JPanel

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
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


You down with OOP? Yeah you know me!
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You can make up methods to do these for you.
For intersection/collision:

For boundry–checking (staying within big JPanel):
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
thanks, ill try those out : )
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JPanel