salve raga!
ho scaricato un applet da html.it che se cliccato crea un menu-popup, a mo di tasto destro di windows (djmenu).
Questo menu (che fra l'altro ha il vantaggio di andare sopra i frame)
ha una pecca, va solamente a 1 livello.
Esiste anche un'altra applet simile che permette di avere i menu
su + livelli, piccola pecca il popup compare troppo lontano
dai pulsanti e a differenza dell'altro non si può decidere
dove posizionarli.
Dopo ricerche sul sacro google ho trovato il sorgente del primo applet
che non ha il multilivello, permettendo che non sono un programmatore java me chiedevo:
qualche anima pia me aiuta a modificare sto applet per porlo su multilivello?
Vi posto il codice sorgente:

Example Applet

<applet code = DJmenu Archive = djcanvas.zip height = 36 width = 36 >
<param name = foregroundColor value = 0xFFFFFF>
<param name = backgroundColor value = 0xFFFFFF>
<param name = frame value = "_top" >
<param name = img value = "hotlist.gif" >
<param name = xOffset value = -30>
<param name = yOffset value = 50>
<param name = mouseEvent value = 0>
<param name = link0 value = "Java Boutique's top 100 Applets|http://www.javaboutique.internet.com/stats/top_100.html" >
<param name = link1 value = "JARS Top 25%|http://www.jars.com/listing/jars_top25_001.html" >
<param name = link2 value = "-" >
<param name = link3 value = "My Personal Applets|http://www.lonestar.texas.net/~krigoni/decaf/" >
</applet>

mouseEvent = 0 for MouseClick
mouseEvent = 1 for MouseOver

Pop-Up menu PARAM lines ( link0 - link-n ) use the "|" character to seperate the menu description from the URL
The PARAM value "-" is special, and is used to add a line seperator in the menu. No associated URL is needed.


Heres the Souce Code :

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;
import java.util.*;
import java.net.*;

public class DJmenu extends Applet implements MouseListener, MouseMotionListener, ActionListener
{
private String frame;
private Image img;
PopupMenu pu = new PopupMenu();
MediaTracker mt = new MediaTracker(this);
canvas btn = new canvas();
Hashtable hash = new Hashtable();
boolean mouseClickEvent = true;
int xOffset, yOffset;

// popup must be tied to componet. Since an image is NOT a component,
// let's place the image on a canvas the same size as the image.

public void init()
{
setLayout(null);
setSize(getSize().width,getSize().height);
mt.addImage(img = getImage( getCodeBase(),getParameter("img")),0);
setBackground(Color.decode(getParameter("backgroun dColor")));
setForeground(Color.decode(getParameter("foregroun dColor")));

// We assume you may launch to a frame, therefore checkit
if ( getParameter("frame") == null)
frame = "_top"; // no frame , just put in the main window
else
frame = getParameter("frame") ;

// Add the action listeners
btn.addMouseListener (this); // add the mouse listener
btn.addMouseMotionListener (this);
pu.addActionListener(this);

if (getParameter("xOffset") != null) xOffset = new Integer(getParameter("xOffset")).intValue();
else
xOffset = 50;
if (getParameter("yOffset") != null) yOffset = new Integer(getParameter("yOffset")).intValue();
else
yOffset = 50;
if (getParameter("mouseEvent") != null){
if (new Integer(getParameter("mouseEvent")).intValue()== 1)
mouseClickEvent = false;
}
int i = 0;
while (getParameter("link"+i) != null) {
StringTokenizer tok = new StringTokenizer(getParameter("link"+i++),"|");
String s = tok.nextToken();
pu.add(s);
if(!s.equals("-"))
hash.put(s,tok.nextToken());
}
try{
mt.waitForAll();
}catch (InterruptedException e) {}
btn.setBounds(0,0,img.getWidth(this),img.getHeight (this));
// add the pop-up event to the canvas
btn.add(pu);
//add the canvas to the applet
this.add(btn);

btn.repaint(); // show the image
}

/* Unused Interface methods **/
public void mouseClicked (MouseEvent e) {}
public void mouseReleased (MouseEvent e) {}
public void mouseExited (MouseEvent e) {}
public void mouseDragged (MouseEvent e) {}

// change the cursor to a hand when we are over the image
public void mouseMoved(MouseEvent e) {
setCursor(new Cursor(Cursor.HAND_CURSOR));
}


// both mouseEntered and mousePressed can activate the pulldown
public void mouseEntered (MouseEvent e) {
Object obj = e.getSource();
if(obj ==btn && !mouseClickEvent)
pu.show(btn,xOffset, yOffset);
}
public void mousePressed (MouseEvent e) {
Object obj = e.getSource();
if(obj ==btn && mouseClickEvent)
pu.show(btn,xOffset, yOffset);
}

// this is the menu selection event. Locate the name clicked and launch the URL
public void actionPerformed (ActionEvent e){
URL pageURL = null;
try {
pageURL = new URL(getDocumentBase(), (String)hash.get((String)e.getActionCommand()));
}catch (MalformedURLException err) {return;}
AppletContext browser = getAppletContext();
browser.showDocument(pageURL, frame);
}

// define a canvas to place the image on
public class canvas extends Canvas {
public void paint(Graphics g) {
g.drawImage(img, 0,0, this);
}
}


}