[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

applet covering drop down menu

Posted on 2004-04-28
21
Medium Priority
?
1,137 Views
Last Modified: 2013-11-23
I have an application with an internal frame that opens just beneath the menu bar. when i open an applet in the internal frame and select a menu item the drop down menu dissapears behind the applet.
how do i solve this?
0
Comment
Question by:Samooramad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 5
  • 3
  • +2
21 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10939821
Make sure it's a JApplet - Swing and AWT don't mix well in this respect
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10940022
disappears behnd the applet?????? :-?
0
 

Author Comment

by:Samooramad
ID: 10940053
i did.. it still doesn't work
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.

 
LVL 86

Expert Comment

by:CEHJ
ID: 10940078
Can you show how you add the JApplet?
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10940115
can you show the code
0
 

Author Comment

by:Samooramad
ID: 10940296
package me;

import java.awt.*;
import java.lang.String;
import java.awt.event.*;
import javax.swing.border.*;
import java.util.*;
import java.io.*;
import javax.swing.*;
import javax.swing.JApplet;
import java.applet.*;
import java.applet.AudioClip;
import dsvisualizer.node;
import java.text.*;
import me.*;
import java.awt.color.*;
import com.borland.jbcl.layout.*;

public class myFrame extends JFrame {
 JDesktopPane desktop = new JDesktopPane();
Applet Spots = new Spots();//Applet declaration

JMenuBar jMenuBar1 = new JMenuBar();
    .
    .
    .
menu items and border declarations
    .
    .
}
jMenuItem8.setText(" Sort");
    jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jMenuItem8_actionPerformed(e);
      }
    });

contentPane.setBorder(border2);
    contentPane.setBackground(Color.green);
    contentPane.setOpaque(true);
    contentPane.setLayout(borderLayout1);
    desktop.setBackground(Color.white);
    desktop.setOpaque(false);
    desktop.setLayout(borderLayout2);
     .
     .
     .
add menu items
    .
     .
contentPane.add(jMenuBar1, BorderLayout.NORTH);
    contentPane.add(desktop, BorderLayout.CENTER);
    contentPane.add(jToolBar1, BorderLayout.SOUTH);
}
void jMenuItem8_actionPerformed(ActionEvent e) {
      JInternalFrame[] openFrames = desktop.getAllFrames();
       for (int i = 0; i < openFrames.length; i++) {
        openFrames[i].dispose();
        }
        createspotsFrame();
}
//create internal frame for bubble sort
  protected void createspotsFrame() {
        MyInternalFrame frame = new MyInternalFrame();

        frame.getContentPane().add(bubble,null);
        frame.setTitle("spots");
        desktop.add(frame,BorderLayout.CENTER);
        frame.setOpaque(true);
        frame.setBackground(Color.white);
        frame.setSize(200,520);
        frame.setVisible(true);
        spots.init();
        }

/////////////////////////////
package me;

import javax.swing.JInternalFrame;
import java.awt.event.*;
import java.awt.*;

public class MyInternalFrame extends JInternalFrame {
    public MyInternalFrame() {
        super("",false, //resizable
              false, //closable
              false, //maximizable
              false);//iconifiable

       setSize(300,300);
       setLocation(100, 100);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
    }
  private void jbInit() throws Exception {
  }
}

0
 

Author Comment

by:Samooramad
ID: 10940322
sorry
frame.getContentPane().add(bubble,null);
is actually:
frame.getContentPane().add(spots,null);
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10940339
Firstly, i can see from your code that the applet is an Applet, not a JApplet. Secondly i don't see where you're adding it to anything anyway
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10940357
I posted that before seeing your last. Don't you mean

frame.getContentPane().add(Spots,null);

?

If so, you must call init() on the applet before adding it
0
 

Author Comment

by:Samooramad
ID: 10940403
yes i do
0
 

Author Comment

by:Samooramad
ID: 10940430
>>If so, you must call init() on the applet before adding it
but the applet works anyway
the only problem is its hiding the drop down menus of the menubar
0
 

Author Comment

by:Samooramad
ID: 10940457
>>Firstly, i can see from your code that the applet is an Applet, not a JApplet
like i said ...i tried changing to JApplet but still had the same problem
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10940482
Hmm. What happens when you change

>>frame.getContentPane().add(spots,null);

to

frame.getContentPane().add(spots, BorderLayout.CENTER);

or something other than null?
0
 

Author Comment

by:Samooramad
ID: 10940524
still doesn't work :(
0
 
LVL 3

Expert Comment

by:JavaInTheMorning
ID: 10942895
Well...
That's an ugly solution but you can try it:
Add a listener (if you don't already have one) to your menu, so that you'd know when the user is clicking it. When the user is clicking it, do the following:
spots.resize(0,0);

Then, when the user made his choice, resize spots back to the original size.

Itsik
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 10944360
add the following call before you create your menu:

JPoupMenu.setDefaultLightWeightPopupEnabled(false);
0
 

Author Comment

by:Samooramad
ID: 10944950
JavaInTheMorning,
would you mind giving me an example?
0
 

Author Comment

by:Samooramad
ID: 10944962
object,
add the following call before you create your menu:
do you mean before I add items to the menu bar or before adding the menubar to the contentPane?
0
 

Author Comment

by:Samooramad
ID: 10944990
never mind objects that worked!
thank you
0
 
LVL 92

Expert Comment

by:objects
ID: 10944991
u can add it to your main before you create your frame.
0
 
LVL 92

Expert Comment

by:objects
ID: 10945060
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

650 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