waffe
asked on
ZOrder problem with processing and eclipse
Hi,
I am using eclipse with another application called processing. Processing is a program that aids in the creation of java programs. You can find it here - http://processing.org/ However, I don't think my problem really matters whether or not you understand processing - basically my processing script is an applet(called PApplet) that is add to a JFrame container. The integration of code works very well except for a ZOrdering problem I am having. First, I create a JMenuBar with all the appropriate menu components. Second, I add my processing applet. When I run the code and use the meunBar which creates a pop up window, the window is always underneath the processing applet. WHY?!
Example code:
[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.setNativeL ookAndFeel ();
addWindowListener(new ExitListener());
Container content = getContentPane();
content.setBackground(Colo r.white);
content.setPreferredSize(n ew Dimension(1250, 900));
JMenuBar menuBar = new JMenuBar();
menuBar.setBorder(new BevelBorder(BevelBorder.RA ISED));
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,BorderLay out.CENTER );
pack();
setVisible(true);
}
}
[\code]
I have tried putting the ssa1(processing component/applet) into other JPanels and JLayererd panes etc … nothing works, I have adjusted components with the command “setComponentZOrder” and nothing works.
I feel there is a way to do this, it is as if the processing code (ssa1) is missing something all the other components have that tell them to follow the rules of the components. Any Ideas?
Thanks,
Waffe
I am using eclipse with another application called processing. Processing is a program that aids in the creation of java programs. You can find it here - http://processing.org/ However, I don't think my problem really matters whether or not you understand processing - basically my processing script is an applet(called PApplet) that is add to a JFrame container. The integration of code works very well except for a ZOrdering problem I am having. First, I create a JMenuBar with all the appropriate menu components. Second, I add my processing applet. When I run the code and use the meunBar which creates a pop up window, the window is always underneath the processing applet. WHY?!
Example code:
[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.setNativeL
addWindowListener(new ExitListener());
Container content = getContentPane();
content.setBackground(Colo
content.setPreferredSize(n
JMenuBar menuBar = new JMenuBar();
menuBar.setBorder(new BevelBorder(BevelBorder.RA
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,BorderLay
pack();
setVisible(true);
}
}
[\code]
I have tried putting the ssa1(processing component/applet) into other JPanels and JLayererd panes etc … nothing works, I have adjusted components with the command “setComponentZOrder” and nothing works.
I feel there is a way to do this, it is as if the processing code (ssa1) is missing something all the other components have that tell them to follow the rules of the components. Any Ideas?
Thanks,
Waffe
ASKER
I do not get how you want me to implement this into my current code - can you please explain?
I have now looked into JPopupMenus and they will pop up above the PApplet! – Great, but how does that integrate into a JMenuBar?
Thanks,
waffe
I have now looked into JPopupMenus and they will pop up above the PApplet! – Great, but how does that integrate into a JMenuBar?
Thanks,
waffe
JPopupMenu.setLightWeightP
JMenuBar menuBar = new JMenuBar();
menuBar.setBorder(new BevelBorder(BevelBorder.RA
> but how does that integrate into a JMenuBar?
menu bar uses a popup menu to display its menu.
ASKER
This is the error I get in eclipse for this line - JPopupMenu.setLightWeightP opupEnable d(false);
"Cannot make a static reference to the non-static method setLightWeightPopupEnabled (boolean)
from the type JPopupMenu"
so JPopupMenu should know to point to the JMenuBar?
Thanks,
waffe
"Cannot make a static reference to the non-static method setLightWeightPopupEnabled
from the type JPopupMenu"
so JPopupMenu should know to point to the JMenuBar?
Thanks,
waffe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sweet! - Fantastic! - Assume! - I knew it was easy!
Thanks so much - I have been working on this for days trying ever combination I could think of and find. Next time, I'm asking you. LOL - thanks again!
waffe
Thanks so much - I have been working on this for days trying ever combination I could think of and find. Next time, I'm asking you. LOL - thanks again!
waffe
JPopupMenu.setLightWeightP