We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › ZOrder problem with processing and eclipse
Page Index Toggle Pages: 1
ZOrder problem with processing and eclipse (Read 1379 times)
ZOrder problem with processing and eclipse
May 15th, 2006, 7:14am
 
Hi all,

I have currently been working with Eclipse primarily to gain and greater GUI control over my processing application. The integration has been moving forward but one problem is lingering over my head.

I have a JMenuBar with all of the appropriate menu components added to it and a processing script loaded into a single app. Now when I render the application all is well except when I select the menubar item which produces a drop down menu – *problem* this menu is always behind the processing application! I have tried setComponetZOrder, multiple JPanels, layered panes, JComponents, etc … but the processing component/applet is always on top of the menubar drop down list. Basically, it seems when using a processing PApplet with other components the PApplet does not follow these rules of a frame, content pane, and menubar: http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html#menubar

– Any ideas on why this is?

Thanks,

4dplane
Re: ZOrder problem with processing and eclipse
Reply #1 - May 16th, 2006, 1:10am
 
Here is a sample code of the problem:
Code:

public class Frame extends JFrame {
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
new Frame();
}
public Frame() {
super("Sequence Analyzer");
WindowUtilities.setNativeLookAndFeel();
addWindowListener(new ExitListener());
Container content = getContentPane();
content.setBackground(Color.white);
content.setPreferredSize(new Dimension(1250, 900));

JMenuBar menuBar = new JMenuBar();
menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));

JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem item = new JMenuItem("Item Label");
JMenuItem item2 = new JMenuItem("Item Label");
menu.add(item2);
JMenuItem item3 = new JMenuItem("More Item Label");
menu.add(item3);
setJMenuBar(menuBar);

// next I add the processing component
System_Series_Analyzer ssa1 = new System_Series_Analyzer();
ssa1.init();
content.add(ssa1,BorderLayout.CENTER);
pack();
setVisible(true);
}
}
Re: ZOrder problem with processing and eclipse
Reply #2 - May 16th, 2006, 3:33am
 
Got it! all I needed was this command before the new JMenuBar

JPopupMenu.setDefaultLightWeightPopupEnabled(false);

Smiley
Re: ZOrder problem with processing and eclipse
Reply #3 - May 28th, 2006, 4:04am
 
The problem is back! Basically, any component I put the PApplet in (JFrame, JLayerPane, JInternalFrame etc...) it will always be on top of all other components no matter what I do. - Except the JMenuBar as I described earlier.

Does anyone here work with processing in eclipse? If so, how do you get around this problem?

Thanks,

4dplane
Re: ZOrder problem with processing and eclipse
Reply #4 - May 28th, 2006, 9:15am
 
Here is a link the I believe explains the problem -http://java.sun.com/products/jfc/tsc/articles/mixing/

I have looked at PApplet and I see it extends Applet which makes it AWT based - right?

How hard would it be to have PApplet extend JApplet? Really hard I am sure but it can't hurt to ask

Thanks,

4dplane

Re: ZOrder problem with processing and eclipse
Reply #5 - Jun 15th, 2006, 1:49am
 
I had a very similar problem with Processing in that I was trying to paint JComponents on top of my Processing panel.

After concluding that there was no way to nicely layer JComponents on top of AWT Components, I actually checked out the Processing source and make PApplet extend JApplet just to see what would happen. The result was that it crashed every time I tried to run my application.

It may be possible to change Processing into using JComponents but it appears to be complicated.
Page Index Toggle Pages: 1