File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPanel" Watch "JPanel" New topic


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??


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 : )
I agree. Here's the link:
subject: JPanel
It's not a secret anymore!