Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ZOrder problem with processing and eclipse

Posted on 2006-05-15
6
Medium Priority
?
925 Views
Last Modified: 2008-02-01
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
Comment
Question by:waffe
  • 3
  • 3
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16686551
try:

JPopupMenu.setLightWeightPopupEnabled(false);
0
 

Author Comment

by:waffe
ID: 16686679
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
 
LVL 92

Expert Comment

by:objects
ID: 16686704

          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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:waffe
ID: 16686837
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
 
LVL 92

Accepted Solution

by:
objects earned 1300 total points
ID: 16686869
sorry that should have been:

          JPopupMenu.setDefaultLightWeightPopupEnabled(false);
0
 

Author Comment

by:waffe
ID: 16687077
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question