• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 927
  • Last Modified:

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.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);
      }
}
[\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
0
waffe
Asked:
waffe
  • 3
  • 3
1 Solution
 
objectsCommented:
try:

JPopupMenu.setLightWeightPopupEnabled(false);
0
 
waffeAuthor Commented:
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
0
 
objectsCommented:

          JPopupMenu.setLightWeightPopupEnabled(false);
          JMenuBar menuBar = new JMenuBar();
          menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));

> but how does that integrate into a JMenuBar?

menu bar uses a popup menu to display its menu.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
waffeAuthor Commented:
This is the error I get in eclipse for this line - JPopupMenu.setLightWeightPopupEnabled(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
0
 
objectsCommented:
sorry that should have been:

          JPopupMenu.setDefaultLightWeightPopupEnabled(false);
0
 
waffeAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now