SlideShare a Scribd company logo
/*
* Ejemplo de creación de menús usando javax.swing y Netbeans
* creado por: Gaby Nieva Paredes
* <d_codinGames />
*/
package ejemploBlog;
import java.awt.event.KeyEvent;
import javax.swing.JOptionPane;
public class VentanaPrincipal extends javax.swing.JFrame {
public VentanaPrincipal() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItemRegistro = new javax.swing.JMenuItem();
jMenuItemSaludo = new javax.swing.JMenuItem();
jMenuItemSalir = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Ejemplo de Menú");
jMenu1.setBackground(new java.awt.Color(0, 153, 153));
jMenu1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.
BevelBorder.RAISED));
jMenu1.setForeground(new java.awt.Color(204, 255, 204));
jMenu1.setText("Archivo");
jMenu1.setOpaque(true);
jMenuItemRegistro.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.eve
nt.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
jMenuItemRegistro.setMnemonic(KeyEvent.VK_A);
jMenuItemRegistro.setText("Registrarte...");
jMenuItemRegistro.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemRegistroActionPerformed(evt);
}
});
jMenu1.add(jMenuItemRegistro);
jMenuItemSaludo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event
.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
jMenuItemSaludo.setText("Saludo");
jMenuItemSaludo.setEnabled(false);
jMenuItemSaludo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemSaludoActionPerformed(evt);
}
});
jMenu1.add(jMenuItemSaludo);
jMenuItemSalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
jMenuItemSalir.setText("Salir");
jMenuItemSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemSalirActionPerformed(evt);
}
});
jMenu1.add(jMenuItemSalir);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 273, Short.MAX_VALUE)
);
pack();
}
private void jMenuItemRegistroActionPerformed(java.awt.event.ActionEvent
evt) {
// Método que responde al evento click sobre el JMenuItemRegistro
nombre = JOptionPane.showInputDialog(this, "Escribe tu nombre: ");
jMenuItemSaludo.setEnabled(true);
}
private void jMenuItemSaludoActionPerformed(java.awt.event.ActionEvent evt)
{
// Método que responde al evento click sobre el JMenuItemSaludo
JOptionPane.showMessageDialog(this, "Hola " + nombre);
}
private void jMenuItemSalirActionPerformed(java.awt.event.ActionEvent evt) {
// Método que responde al evento click sobre el JMenuItemSalir
this.dispose();
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new VentanaPrincipal().setVisible(true);
}
});
}
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItemRegistro;
private javax.swing.JMenuItem jMenuItemSalir;
private javax.swing.JMenuItem jMenuItemSaludo;
public String nombre;
}

More Related Content

Similar to codigomenu-1 (1).docx

Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
arvindarora20042013
 
This is Java, What I am creating is a multi lab pacman type game.T.pdf
This is Java, What I am creating is a multi lab pacman type game.T.pdfThis is Java, What I am creating is a multi lab pacman type game.T.pdf
This is Java, What I am creating is a multi lab pacman type game.T.pdf
fashionscollect
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
venkt12345
 
Maze
MazeMaze
Maze
yito24
 
I am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdfI am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdf
fashionfolionr
 
Resultados
ResultadosResultados
Resultadosjbersosa
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
sudhirchourasia86
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdf
forwardcom41
 
Hi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdfHi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdf
eyeonsecuritysystems
 
correct the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfcorrect the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdf
devangmittal4
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
mary772
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
mccormicknadine86
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
Thierry Wasylczenko
 
College management system.pptx
College management system.pptxCollege management system.pptx
College management system.pptx
ManujArora3
 
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdfimport java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
anupambedcovers
 
Swing_Introduction.ppt
Swing_Introduction.pptSwing_Introduction.ppt
Swing_Introduction.ppt
Satyanandaram Nandigam
 
Hacking the Codename One Source Code - Part III.pdf
Hacking the Codename One Source Code - Part III.pdfHacking the Codename One Source Code - Part III.pdf
Hacking the Codename One Source Code - Part III.pdf
ShaiAlmog1
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
Yuichi Sakuraba
 

Similar to codigomenu-1 (1).docx (20)

Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
 
DBTool
DBToolDBTool
DBTool
 
This is Java, What I am creating is a multi lab pacman type game.T.pdf
This is Java, What I am creating is a multi lab pacman type game.T.pdfThis is Java, What I am creating is a multi lab pacman type game.T.pdf
This is Java, What I am creating is a multi lab pacman type game.T.pdf
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
 
Scrollable Demo App
Scrollable Demo AppScrollable Demo App
Scrollable Demo App
 
Maze
MazeMaze
Maze
 
I am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdfI am getting a syntax error. I cant seem to find whats causing t.pdf
I am getting a syntax error. I cant seem to find whats causing t.pdf
 
Resultados
ResultadosResultados
Resultados
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdf
 
Hi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdfHi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdf
 
correct the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdfcorrect the error import javaxswingJFrame import javaxs.pdf
correct the error import javaxswingJFrame import javaxs.pdf
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
College management system.pptx
College management system.pptxCollege management system.pptx
College management system.pptx
 
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdfimport java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
import java.awt.event.ActionEvent; import java.awt.event.ActionLis.pdf
 
Swing_Introduction.ppt
Swing_Introduction.pptSwing_Introduction.ppt
Swing_Introduction.ppt
 
Hacking the Codename One Source Code - Part III.pdf
Hacking the Codename One Source Code - Part III.pdfHacking the Codename One Source Code - Part III.pdf
Hacking the Codename One Source Code - Part III.pdf
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
 

More from AnaLpez275

PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdfPROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdf
AnaLpez275
 
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdfPROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdf
AnaLpez275
 
UPS-CT008640.pdf
UPS-CT008640.pdfUPS-CT008640.pdf
UPS-CT008640.pdf
AnaLpez275
 
ESTRUCTURA DE ANTEPROYECTO_ (2).docx
ESTRUCTURA DE ANTEPROYECTO_ (2).docxESTRUCTURA DE ANTEPROYECTO_ (2).docx
ESTRUCTURA DE ANTEPROYECTO_ (2).docx
AnaLpez275
 
LIBRO Y SOPA LETRAS.docx
LIBRO Y SOPA LETRAS.docxLIBRO Y SOPA LETRAS.docx
LIBRO Y SOPA LETRAS.docx
AnaLpez275
 
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdfComo programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
AnaLpez275
 
AprendiendoJava.pdf
AprendiendoJava.pdfAprendiendoJava.pdf
AprendiendoJava.pdf
AnaLpez275
 
codigomenu-1.docx
codigomenu-1.docxcodigomenu-1.docx
codigomenu-1.docx
AnaLpez275
 
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdfComo programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
AnaLpez275
 
Como programar en Java - 7ma Edicion - P. J. Deitel (1).pdf
Como programar en Java - 7ma Edicion - P. J. Deitel (1).pdfComo programar en Java - 7ma Edicion - P. J. Deitel (1).pdf
Como programar en Java - 7ma Edicion - P. J. Deitel (1).pdf
AnaLpez275
 
Ejercicios_Basicos_de_netbeans.doc
Ejercicios_Basicos_de_netbeans.docEjercicios_Basicos_de_netbeans.doc
Ejercicios_Basicos_de_netbeans.doc
AnaLpez275
 
Desarrollo_de_Software_con_NetBeans_7_1.pdf
Desarrollo_de_Software_con_NetBeans_7_1.pdfDesarrollo_de_Software_con_NetBeans_7_1.pdf
Desarrollo_de_Software_con_NetBeans_7_1.pdf
AnaLpez275
 
INSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdf
INSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdfINSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdf
INSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdf
AnaLpez275
 
Ejercicios_Basicos_de_netbeans (2).doc
Ejercicios_Basicos_de_netbeans (2).docEjercicios_Basicos_de_netbeans (2).doc
Ejercicios_Basicos_de_netbeans (2).doc
AnaLpez275
 
Manual_java.pdf
Manual_java.pdfManual_java.pdf
Manual_java.pdf
AnaLpez275
 
Ejercicios_Basicos_de_netbeans (3).doc
Ejercicios_Basicos_de_netbeans (3).docEjercicios_Basicos_de_netbeans (3).doc
Ejercicios_Basicos_de_netbeans (3).doc
AnaLpez275
 
Ejercicios_Basicos_de_netbeans (1).doc
Ejercicios_Basicos_de_netbeans (1).docEjercicios_Basicos_de_netbeans (1).doc
Ejercicios_Basicos_de_netbeans (1).doc
AnaLpez275
 
Guis_en_java_6pp.pdf
Guis_en_java_6pp.pdfGuis_en_java_6pp.pdf
Guis_en_java_6pp.pdf
AnaLpez275
 

More from AnaLpez275 (18)

PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdfPROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL.pdf
 
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdfPROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdf
PROYECTO INTEGRADOR ASTINI-BELLIDO VFINAL (1).pdf
 
UPS-CT008640.pdf
UPS-CT008640.pdfUPS-CT008640.pdf
UPS-CT008640.pdf
 
ESTRUCTURA DE ANTEPROYECTO_ (2).docx
ESTRUCTURA DE ANTEPROYECTO_ (2).docxESTRUCTURA DE ANTEPROYECTO_ (2).docx
ESTRUCTURA DE ANTEPROYECTO_ (2).docx
 
LIBRO Y SOPA LETRAS.docx
LIBRO Y SOPA LETRAS.docxLIBRO Y SOPA LETRAS.docx
LIBRO Y SOPA LETRAS.docx
 
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdfComo programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
 
AprendiendoJava.pdf
AprendiendoJava.pdfAprendiendoJava.pdf
AprendiendoJava.pdf
 
codigomenu-1.docx
codigomenu-1.docxcodigomenu-1.docx
codigomenu-1.docx
 
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdfComo programar en Java - 7ma Edicion - P. J. Deitel.pdf
Como programar en Java - 7ma Edicion - P. J. Deitel.pdf
 
Como programar en Java - 7ma Edicion - P. J. Deitel (1).pdf
Como programar en Java - 7ma Edicion - P. J. Deitel (1).pdfComo programar en Java - 7ma Edicion - P. J. Deitel (1).pdf
Como programar en Java - 7ma Edicion - P. J. Deitel (1).pdf
 
Ejercicios_Basicos_de_netbeans.doc
Ejercicios_Basicos_de_netbeans.docEjercicios_Basicos_de_netbeans.doc
Ejercicios_Basicos_de_netbeans.doc
 
Desarrollo_de_Software_con_NetBeans_7_1.pdf
Desarrollo_de_Software_con_NetBeans_7_1.pdfDesarrollo_de_Software_con_NetBeans_7_1.pdf
Desarrollo_de_Software_con_NetBeans_7_1.pdf
 
INSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdf
INSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdfINSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdf
INSTITUTO_TECNOLOGICO_DE_MORELIA_PROGRAM.pdf
 
Ejercicios_Basicos_de_netbeans (2).doc
Ejercicios_Basicos_de_netbeans (2).docEjercicios_Basicos_de_netbeans (2).doc
Ejercicios_Basicos_de_netbeans (2).doc
 
Manual_java.pdf
Manual_java.pdfManual_java.pdf
Manual_java.pdf
 
Ejercicios_Basicos_de_netbeans (3).doc
Ejercicios_Basicos_de_netbeans (3).docEjercicios_Basicos_de_netbeans (3).doc
Ejercicios_Basicos_de_netbeans (3).doc
 
Ejercicios_Basicos_de_netbeans (1).doc
Ejercicios_Basicos_de_netbeans (1).docEjercicios_Basicos_de_netbeans (1).doc
Ejercicios_Basicos_de_netbeans (1).doc
 
Guis_en_java_6pp.pdf
Guis_en_java_6pp.pdfGuis_en_java_6pp.pdf
Guis_en_java_6pp.pdf
 

Recently uploaded

263778731218 Abortion Clinic /Pills In Harare ,
263778731218 Abortion Clinic /Pills In Harare ,263778731218 Abortion Clinic /Pills In Harare ,
263778731218 Abortion Clinic /Pills In Harare ,
sisternakatoto
 
Ocular injury ppt Upendra pal optometrist upums saifai etawah
Ocular injury  ppt  Upendra pal  optometrist upums saifai etawahOcular injury  ppt  Upendra pal  optometrist upums saifai etawah
Ocular injury ppt Upendra pal optometrist upums saifai etawah
pal078100
 
Hemodialysis: Chapter 3, Dialysis Water Unit - Dr.Gawad
Hemodialysis: Chapter 3, Dialysis Water Unit - Dr.GawadHemodialysis: Chapter 3, Dialysis Water Unit - Dr.Gawad
Hemodialysis: Chapter 3, Dialysis Water Unit - Dr.Gawad
NephroTube - Dr.Gawad
 
New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...
New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...
New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...
i3 Health
 
HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...
HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...
HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...
GL Anaacs
 
Couples presenting to the infertility clinic- Do they really have infertility...
Couples presenting to the infertility clinic- Do they really have infertility...Couples presenting to the infertility clinic- Do they really have infertility...
Couples presenting to the infertility clinic- Do they really have infertility...
Sujoy Dasgupta
 
Knee anatomy and clinical tests 2024.pdf
Knee anatomy and clinical tests 2024.pdfKnee anatomy and clinical tests 2024.pdf
Knee anatomy and clinical tests 2024.pdf
vimalpl1234
 
ACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIOND
ACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIONDACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIOND
ACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIOND
DR SETH JOTHAM
 
Triangles of Neck and Clinical Correlation by Dr. RIG.pptx
Triangles of Neck and Clinical Correlation by Dr. RIG.pptxTriangles of Neck and Clinical Correlation by Dr. RIG.pptx
Triangles of Neck and Clinical Correlation by Dr. RIG.pptx
Dr. Rabia Inam Gandapore
 
Physiology of Chemical Sensation of smell.pdf
Physiology of Chemical Sensation of smell.pdfPhysiology of Chemical Sensation of smell.pdf
Physiology of Chemical Sensation of smell.pdf
MedicoseAcademics
 
Evaluation of antidepressant activity of clitoris ternatea in animals
Evaluation of antidepressant activity of clitoris ternatea in animalsEvaluation of antidepressant activity of clitoris ternatea in animals
Evaluation of antidepressant activity of clitoris ternatea in animals
Shweta
 
KDIGO 2024 guidelines for diabetologists
KDIGO 2024 guidelines for diabetologistsKDIGO 2024 guidelines for diabetologists
KDIGO 2024 guidelines for diabetologists
د.محمود نجيب
 
Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...
Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...
Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...
VarunMahajani
 
Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...
Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...
Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...
Savita Shen $i11
 
NVBDCP.pptx Nation vector borne disease control program
NVBDCP.pptx Nation vector borne disease control programNVBDCP.pptx Nation vector borne disease control program
NVBDCP.pptx Nation vector borne disease control program
Sapna Thakur
 
Novas diretrizes da OMS para os cuidados perinatais de mais qualidade
Novas diretrizes da OMS para os cuidados perinatais de mais qualidadeNovas diretrizes da OMS para os cuidados perinatais de mais qualidade
Novas diretrizes da OMS para os cuidados perinatais de mais qualidade
Prof. Marcus Renato de Carvalho
 
Report Back from SGO 2024: What’s the Latest in Cervical Cancer?
Report Back from SGO 2024: What’s the Latest in Cervical Cancer?Report Back from SGO 2024: What’s the Latest in Cervical Cancer?
Report Back from SGO 2024: What’s the Latest in Cervical Cancer?
bkling
 
Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists
Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists  Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists
Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists
Saeid Safari
 
For Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #Girls
For Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #GirlsFor Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #Girls
For Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #Girls
Savita Shen $i11
 
Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...
Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...
Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...
Oleg Kshivets
 

Recently uploaded (20)

263778731218 Abortion Clinic /Pills In Harare ,
263778731218 Abortion Clinic /Pills In Harare ,263778731218 Abortion Clinic /Pills In Harare ,
263778731218 Abortion Clinic /Pills In Harare ,
 
Ocular injury ppt Upendra pal optometrist upums saifai etawah
Ocular injury  ppt  Upendra pal  optometrist upums saifai etawahOcular injury  ppt  Upendra pal  optometrist upums saifai etawah
Ocular injury ppt Upendra pal optometrist upums saifai etawah
 
Hemodialysis: Chapter 3, Dialysis Water Unit - Dr.Gawad
Hemodialysis: Chapter 3, Dialysis Water Unit - Dr.GawadHemodialysis: Chapter 3, Dialysis Water Unit - Dr.Gawad
Hemodialysis: Chapter 3, Dialysis Water Unit - Dr.Gawad
 
New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...
New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...
New Directions in Targeted Therapeutic Approaches for Older Adults With Mantl...
 
HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...
HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...
HOT NEW PRODUCT! BIG SALES FAST SHIPPING NOW FROM CHINA!! EU KU DB BK substit...
 
Couples presenting to the infertility clinic- Do they really have infertility...
Couples presenting to the infertility clinic- Do they really have infertility...Couples presenting to the infertility clinic- Do they really have infertility...
Couples presenting to the infertility clinic- Do they really have infertility...
 
Knee anatomy and clinical tests 2024.pdf
Knee anatomy and clinical tests 2024.pdfKnee anatomy and clinical tests 2024.pdf
Knee anatomy and clinical tests 2024.pdf
 
ACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIOND
ACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIONDACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIOND
ACUTE SCROTUM.....pdf. ACUTE SCROTAL CONDITIOND
 
Triangles of Neck and Clinical Correlation by Dr. RIG.pptx
Triangles of Neck and Clinical Correlation by Dr. RIG.pptxTriangles of Neck and Clinical Correlation by Dr. RIG.pptx
Triangles of Neck and Clinical Correlation by Dr. RIG.pptx
 
Physiology of Chemical Sensation of smell.pdf
Physiology of Chemical Sensation of smell.pdfPhysiology of Chemical Sensation of smell.pdf
Physiology of Chemical Sensation of smell.pdf
 
Evaluation of antidepressant activity of clitoris ternatea in animals
Evaluation of antidepressant activity of clitoris ternatea in animalsEvaluation of antidepressant activity of clitoris ternatea in animals
Evaluation of antidepressant activity of clitoris ternatea in animals
 
KDIGO 2024 guidelines for diabetologists
KDIGO 2024 guidelines for diabetologistsKDIGO 2024 guidelines for diabetologists
KDIGO 2024 guidelines for diabetologists
 
Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...
Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...
Pulmonary Thromboembolism - etilogy, types, medical- Surgical and nursing man...
 
Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...
Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...
Phone Us ❤85270-49040❤ #ℂall #gIRLS In Surat By Surat @ℂall @Girls Hotel With...
 
NVBDCP.pptx Nation vector borne disease control program
NVBDCP.pptx Nation vector borne disease control programNVBDCP.pptx Nation vector borne disease control program
NVBDCP.pptx Nation vector borne disease control program
 
Novas diretrizes da OMS para os cuidados perinatais de mais qualidade
Novas diretrizes da OMS para os cuidados perinatais de mais qualidadeNovas diretrizes da OMS para os cuidados perinatais de mais qualidade
Novas diretrizes da OMS para os cuidados perinatais de mais qualidade
 
Report Back from SGO 2024: What’s the Latest in Cervical Cancer?
Report Back from SGO 2024: What’s the Latest in Cervical Cancer?Report Back from SGO 2024: What’s the Latest in Cervical Cancer?
Report Back from SGO 2024: What’s the Latest in Cervical Cancer?
 
Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists
Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists  Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists
Ozempic: Preoperative Management of Patients on GLP-1 Receptor Agonists
 
For Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #Girls
For Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #GirlsFor Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #Girls
For Better Surat #ℂall #Girl Service ❤85270-49040❤ Surat #ℂall #Girls
 
Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...
Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...
Lung Cancer: Artificial Intelligence, Synergetics, Complex System Analysis, S...
 

codigomenu-1 (1).docx

  • 1. /* * Ejemplo de creación de menús usando javax.swing y Netbeans * creado por: Gaby Nieva Paredes * <d_codinGames /> */ package ejemploBlog; import java.awt.event.KeyEvent; import javax.swing.JOptionPane; public class VentanaPrincipal extends javax.swing.JFrame { public VentanaPrincipal() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItemRegistro = new javax.swing.JMenuItem(); jMenuItemSaludo = new javax.swing.JMenuItem(); jMenuItemSalir = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Ejemplo de Menú"); jMenu1.setBackground(new java.awt.Color(0, 153, 153)); jMenu1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border. BevelBorder.RAISED)); jMenu1.setForeground(new java.awt.Color(204, 255, 204)); jMenu1.setText("Archivo"); jMenu1.setOpaque(true); jMenuItemRegistro.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.eve nt.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK)); jMenuItemRegistro.setMnemonic(KeyEvent.VK_A); jMenuItemRegistro.setText("Registrarte..."); jMenuItemRegistro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemRegistroActionPerformed(evt); } }); jMenu1.add(jMenuItemRegistro); jMenuItemSaludo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event .KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); jMenuItemSaludo.setText("Saludo"); jMenuItemSaludo.setEnabled(false);
  • 2. jMenuItemSaludo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemSaludoActionPerformed(evt); } }); jMenu1.add(jMenuItemSaludo); jMenuItemSalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event. KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK)); jMenuItemSalir.setText("Salir"); jMenuItemSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemSalirActionPerformed(evt); } }); jMenu1.add(jMenuItemSalir); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 273, Short.MAX_VALUE) ); pack(); } private void jMenuItemRegistroActionPerformed(java.awt.event.ActionEvent evt) { // Método que responde al evento click sobre el JMenuItemRegistro nombre = JOptionPane.showInputDialog(this, "Escribe tu nombre: "); jMenuItemSaludo.setEnabled(true); } private void jMenuItemSaludoActionPerformed(java.awt.event.ActionEvent evt) { // Método que responde al evento click sobre el JMenuItemSaludo JOptionPane.showMessageDialog(this, "Hola " + nombre); } private void jMenuItemSalirActionPerformed(java.awt.event.ActionEvent evt) { // Método que responde al evento click sobre el JMenuItemSalir this.dispose();
  • 3. } public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut il.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut il.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut il.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.ut il.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new VentanaPrincipal().setVisible(true); } }); } private javax.swing.JMenu jMenu1; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItemRegistro; private javax.swing.JMenuItem jMenuItemSalir; private javax.swing.JMenuItem jMenuItemSaludo; public String nombre; }