30/11/2006, 03:51
|
| | | Fecha de Ingreso: enero-2006 Ubicación: ¿Atlantida, Hesperides, Islas afortunadas?
Mensajes: 2.231
Antigüedad: 19 años Puntos: 19 | |
Hola te mando un menú hecho en un applet, que abre ventanas de el navegador, espero te sirva.
Código:
//http://club.idecnet.com/~ccastano/femepa/281105/281105.htm
/*
* Menu1.java
*
* Created on 24 de noviembre de 2005, 21:36
*/
/**
*
* @author [email protected]
* http://javcasta.bounceme.net
*/
import java.net.URL;
import javax.swing.JOptionPane;
public class Menu1 extends javax.swing.JApplet {
/** Initializes the applet Menu1 */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JSeparator();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JSeparator();
jMenuItem4 = new javax.swing.JMenuItem();
addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
formMouseClicked(evt);
}
});
jLabel1.setFont(new java.awt.Font("Times New Roman", 3, 14));
jLabel1.setText(" [email protected]");
jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel1MouseClicked(evt);
}
});
getContentPane().add(jLabel1, java.awt.BorderLayout.CENTER);
jMenu1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(255, 51, 0), null, null));
jMenu1.setText(" Web Sun");
jMenuItem1.setText("Ir a la pag principal");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenuItem1MouseClicked(evt);
}
});
jMenu1.add(jMenuItem1);
jMenu1.add(jSeparator1);
jMenuItem2.setText("API de Java 2 V5.0");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem2);
jMenuBar1.add(jMenu1);
jMenu2.setText(" Web Personal");
jMenuItem3.setText("P\u00e1gina principal");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem3);
jMenu2.add(jSeparator2);
jMenuItem4.setText("Curso de Java");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem4);
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
}
// </editor-fold>
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{
getAppletContext().showDocument(new URL("http://club.idecnet.com/~ccastano/femepa/femepa.htm"), "_blank");
} catch(Exception e){}
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{
getAppletContext().showDocument(new URL("http://javcasta.bounceme.net"), "_blank");
} catch(Exception e){}
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{
getAppletContext().showDocument(new URL("http://java.sun.com"), "_blank");
} catch(Exception e){}
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//
try{
getAppletContext().showDocument(new URL("http://java.sun.com/j2se/1.5.0/docs/api"), "_blank");
} catch(Exception e){}
}
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
try{
getAppletContext().showDocument(new URL ("mailto:[email protected]"), "_blank");
JOptionPane.showMessageDialog(
null, "Powered by NetBeans 4.1 \n [email protected] \n Curso de Java - Femepa 2.005", "Acerca de",
JOptionPane.PLAIN_MESSAGE );
}
catch(Exception e){}
}
private void formMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
this.getAppletInfo();
}
public String getAppletInfo(){
return "http://club.idecnet.com/~ccastano/femepa/femepa.htm";
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
// End of variables declaration
}
Aunque esos que planteas yo lo intentaria con JavaScript.
Salu2 |