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

807588
Google found this.

[http://java.sun.com/developer/technicalArticles/javame/add_ons/]
807588
re,

I found this too but there you need the Java Web Server ... and I don't use this.
I got a Tomcat server who I want to connect to using webdav and Netbeans...

thanks anyway ...

Olek
807588
Olek wrote:
I got a Tomcat server who I want to connect to using webdav and Netbeans...
It would've been a lot easier if you said that in your first post.
thanks anyway ...
You're welcome.
807588
re again,

I found now the dialog "mobility deployment" at the tools menu.
There I setup the webdav instance but what next???
I don't be able to store a class via webdav at this server ...

Anyone know how to use this webdav instance?

regards,

Olek
807588
Hi Olek

I Have a working WebDAV setup with tomcat 6.0
the only problem is this only works on windows XP

anyway here is the code,
    <servlet>
    <servlet-name>webdav</servlet-name>
    <servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>true</param-value>
    </init-param>
    <!-- Uncomment this to enable read and write access -->

    <init-param>
      <param-name>readonly</param-name>
      <param-value>false</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <!-- The mapping for the webdav servlet -->
  <!-- Using /* as the mapping ensures that jasper, welcome files etc are
       over-ridden and all requests are processed by the webdav servlet.
       This also overcomes a number of issues with some webdav clients
       (including MS Webfolders) that do not respond correctly
 to the
       redirects (302) that result from using a mapping of / -->
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
put that in your web.xml file
and here is a basic example of how to use it in a jsp.
<%
String networkPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
<body onload="document.getElementById('anchor').click();">
    <a id="anchor" href="<%= networkPath %>Temp/Test/file.doc" folder= "<%= networkPath/Temp/Test/">
           Open in Web Folder View
    </a>
</body>
Hope this helps you
807588
hi epoch,

Thanks for your help. I guess this work ...
The problem is, that I don't want to edit any file ...
I want to click on a file in the file tree of netbeans and then export this
via WebDav into the server... like its possible via eclipse ...
If its possible there it should be possible in netbeans too !?

thanks,

Olek
807588
ok I registerd at the netbeans forum ... hope they know a solution...

Olek
1 - 7
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
164 views