Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2005

Tip: Looking for answers? Try searching our database.

Grid Layout coordinates

Thread view: 
aleicaro@libero.it - 21 Jun 2005 14:10 GMT
Hi,
I've a JPanel with a GridLayout layout.
In each cell I've another JPanel Inside. When I select a panel (the
internal panel) I would like to know the coordinates of the external
panel. e.g. I would like to know if the panel I selected with the mouse
is the cell (of the external panel) with coordinates 2,4 or what ever
else.
Is it possible?

Thank you
Alessandro
Vova Reznik - 21 Jun 2005 14:43 GMT
> Hi,
> I've a JPanel with a GridLayout layout.
[quoted text clipped - 7 lines]
> Thank you
> Alessandro

Yes, it is possible, but you should find way how to select JPanel.

Add MouseListener to each JPanel.
public void mouseEntered(MouseEvent e){
    if(e.getSource() == panel24){
        //
    }else if(.........
}
aleicaro@libero.it - 21 Jun 2005 15:09 GMT
I tried another way.
I extended JPanel and I added 2 properties: XCell and YCell to create
the internal panels.
When I add the internal panels I instanciate my class and I assign to
XCell and to Y Cell the actual "coordinates" of my GridLayout.

Isn't easier?

Thank you
Alessandro


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.