This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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 : )
Don't get me started about those stupid light bulbs.
subject: JPanel
Similar Threads
JInternalFrame title bar
Obtaining Current Layout for JPanel
labels on swing components
Jpanel inside another JPanel