Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Applet Pop-up menu working in JDK 1.3 is not working in JDK 1.6.0_15

843807Nov 14 2009 — edited Nov 14 2009
I am a new Java developer and have been tasked to support an existing applet program that was working in JDK 1.3 since it was developed a few years ago. When the users environment was upgraded to IE7 with JDK 1.6.0_15 The applet popup menus ceased to work. The popup menus are shown when a checkbox is selected. Now when a checkbox is selected, the checkbox shows checked but no popup menus show. The following is error output to the Java Console when a checkbox is selected to view the corresponding popup menu selections:

Exception in thread "AWT-EventQueue-2" java.lang.IllegalArgumentException: origin not in parent's hierarchy
at java.awt.PopupMenu.show(Unknown Source)
at VasQuery.QryByVol.chkBoxVol2_itemStateChanged(QryByVol.java:1533)
at VasQuery.QryByVol$23.itemStateChanged(QryByVol.java:793)
at java.awt.Checkbox.processItemEvent(Unknown Source)
at java.awt.Checkbox.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-2" java.lang.IllegalArgumentException: origin not in parent's hierarchy
at java.awt.PopupMenu.show(Unknown Source)
at VasQuery.QryByVol.chkBoxVol5_itemStateChanged(QryByVol.java:1649)
at VasQuery.QryByVol$26.itemStateChanged(QryByVol.java:811)
at java.awt.Checkbox.processItemEvent(Unknown Source)
at java.awt.Checkbox.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


I've included sample code.

Thanks in advance for any assistance.

Below is code sample for the selection of a checkbox that pops up a popup menu of selection values for the checkbox that corresponds to the label "Entire Plane". Code is similar for other checkboxes.These come from the class that defines the applet these actions take place in.
PopupMenu pop = new PopupMenu();
CheckboxGroup volumes = new CheckboxGroup();
Checkbox chkBoxVol1 = new Checkbox("Entire Plane",volumes,false); 
Checkbox chkBoxVol2 = new Checkbox("Forward Fuselage",volumes,false);
Checkbox chkBoxVol3 = new Checkbox("Center Fuselage",volumes,false);
Checkbox chkBoxVol4 = new Checkbox("Wing",volumes,false);
Checkbox chkBoxVol5 = new Checkbox("Mate",volumes,false);
Checkbox chkBoxVol6 = new Checkbox("Aft Fuselage",volumes,false);
Checkbox chkBoxVol7 = new Checkbox("Empennage",volumes,false); 
Checkbox chkBoxVol8 = new Checkbox("Miscellaneous",volumes,false);
Checkbox chkBoxVol9 = new Checkbox("None",volumes,false);

.
. 

// Add Pop-Up menu object to each checkbox that has multiple volume zones to be displayed in a pop-up
chkBoxVol1.add(pop);
chkBoxVol2.add(pop);
chkBoxVol3.add(pop);
chkBoxVol4.add(pop);
chkBoxVol5.add(pop);
chkBoxVol6.add(pop);
chkBoxVol7.add(pop);
chkBoxVol8.add(pop);
.

/**************************************************************************/
/ chkBoxVol1_itemStateChanged /
/ Processes predefined volume checkbox list selection for /
/ "Entire Plane". /
/**************************************************************************/

void chkBoxVol1_itemStateChanged(ItemEvent e)
{
if (chkBoxVol1.getState())
{
MenuItem volName;
ItemHandler handler = new ItemHandler(); 
PredefinedVolume volume = new PredefinedVolume();

int len = volumeVect.size();

pop.removeAll(); 

if (chkBoxVol9.isEnabled())
{
chkBoxVol9.setEnabled(false);
}

for (int i=0; i<len; i++)
{
volume = (PredefinedVolume)volumeVect.elementAt(i);
String name = volume.getName();
if (name.equals("ENTIRE PLANE") || name.startsWith("PLANE"))
{
volName = new MenuItem(name);
pop.add(volName);
volName.addActionListener(handler);
} 
}
pop.show(chkBoxVol1,0,0);
} 
}...........
.
.
.
.
/**************************************************************************/
/ Inner Class ItemHandler /
/ Handles Pop-up menu item selections /
/**************************************************************************/
private class ItemHandler implements ActionListener
{
public void actionPerformed (ActionEvent e)
{
PredefinedVolume volume = new PredefinedVolume();

int len = volumeVect.size();

//Determine which menu item (or Volume) was selected
for (int i=len-1; i>=0; i--)
{
volume = (PredefinedVolume)volumeVect.elementAt(i);

if (volume.getName().equals(e.getActionCommand()))
break;
}

specVol = new SpecifiedVolume(volume);

// update image and volume limit text
updateZ = true;
repaint(); 
}
}

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 12 2009
Added on Nov 14 2009
1 comment
153 views