Link to home
Start Free TrialLog in
Avatar of Rushii
Rushii

asked on

Display JPanel on top of MapBean. (arcobjects)

I am working on creating a GUI that has a map and some menues in the form of buttons. This needs to be done in java and the map will be displayed in Esri arcobject MapBean control and the menues need to be overlaying the map so the map extends behind the menue pallete.The tricky part is obviously making menu pallete overlay the MapBean. I have attempted to tackle the problem using JLayeredPane but even though I set map panel index lower than menu index the map appears on top of menu taking up all the space in the window.
User generated image
Here is relevant code:
MapBean mapBean=Map.getMapBean() //custom function to get map bean
JPanel pnlForMap=new JPanel();
pnlForMap.setLayout(new BorderLayout());
pnlForMap.setBounds(0,36,1280,768);
pnlForMap.add(mapBean, Borderlayout.CENTER);

PnlMainBtns pnlMainBtns=new PnlMainBtns(); // class extends JPanel
pnlMainBtns.setBounds(1035,36,235,978);

JLayeredPane lydpane=new JLayeredPane();
lydpane.setBounds(0,0,1280,768);
lydpane.add(pnlForMap, new Integer(0));
lydpane.add(pnlMainBtns, new Integer(1));
application.getContentpane().add(lydpane);

MapBean is of type JComponent but since whole java arcobject thing is a wrapper around COM/C++ there are probably nuances I don't know about.
Any ideas?
Avatar of for_yan
for_yan
Flag of United States of America image

check this siolution which claims to overlay with JLayeredPane correctly:
http://stackoverflow.com/questions/852631/java-swing-how-to-show-a-panel-on-top-of-another-panel
Avatar of Rushii
Rushii

ASKER

Thanks for responce gudii9 but I already saw those links.
 for_yan good article but I guess I need someone to give an advice how to mix MapBean specifically and make other components appear on top of it, my application draws correctly if I use a JButton instead of MapBean, JButton appears behind the menu panel and MapBean does not. Why? How to fix that?
ASKER CERTIFIED SOLUTION
Avatar of Rushii
Rushii

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I actually had such thought, but looked at the API page and it says it extends JComponent - yes, I was misled, actually I forgot - it can extend JComponet but be AWT, it is true
Avatar of Rushii

ASKER

Explained my problem.