Foros del Web » Programación para mayores de 30 ;) » Java »

desplegar menu con click derecho JTextfield

Estas en el tema de desplegar menu con click derecho JTextfield en el foro de Java en Foros del Web. hago click derecho en el JTextfield, pero no se depliega el menu de copiar, pegar, eliminar, como lo puede agregar o activar ese menu. http://i48.tinypic.com/vwy9et.png ...
  #1 (permalink)  
Antiguo 07/03/2010, 05:22
 
Fecha de Ingreso: agosto-2008
Mensajes: 587
Antigüedad: 15 años, 7 meses
Puntos: 6
desplegar menu con click derecho JTextfield

hago click derecho en el JTextfield, pero no se depliega el menu de copiar, pegar, eliminar, como lo puede agregar o activar ese menu.

http://i48.tinypic.com/vwy9et.png

este es el formulario:

http://i45.tinypic.com/dgs8xc.png

Código Java SE:
Ver original
  1. public class NewJFrame extends javax.swing.JFrame {
  2.  
  3.     /** Creates new form NewJFrame */
  4.     public NewJFrame() {
  5.         initComponents();
  6.     }
  7.  
  8.     /** This method is called from within the constructor to
  9.      * initialize the form.
  10.      * WARNING: Do NOT modify this code. The content of this method is
  11.      * always regenerated by the Form Editor.
  12.      */
  13.     @SuppressWarnings("unchecked")
  14.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  15.     private void initComponents() {
  16.  
  17.         jTextField1 = new javax.swing.JTextField();
  18.  
  19.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  20.  
  21.         jTextField1.setText("Hola mundo");
  22.  
  23.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  24.         getContentPane().setLayout(layout);
  25.         layout.setHorizontalGroup(
  26.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  27.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  28.                 .addContainerGap(33, Short.MAX_VALUE)
  29.                 .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
  30.                 .addGap(27, 27, 27))
  31.         );
  32.         layout.setVerticalGroup(
  33.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  34.             .addGroup(layout.createSequentialGroup()
  35.                 .addGap(38, 38, 38)
  36.                 .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  37.                 .addContainerGap(60, Short.MAX_VALUE))
  38.         );
  39.  
  40.         pack();
  41.     }// </editor-fold>
  42.  
  43.     /**
  44.     * @param args the command line arguments
  45.     */
  46.     public static void main(String args[]) {
  47.         java.awt.EventQueue.invokeLater(new Runnable() {
  48.             public void run() {
  49.                 new NewJFrame().setVisible(true);
  50.             }
  51.         });
  52.     }
  53.  
  54.     // Variables declaration - do not modify
  55.     private javax.swing.JTextField jTextField1;
  56.     // End of variables declaration
  57.  
  58. }
  #2 (permalink)  
Antiguo 07/03/2010, 20:38
Avatar de gasoft  
Fecha de Ingreso: abril-2009
Mensajes: 68
Antigüedad: 14 años, 11 meses
Puntos: 3
Respuesta: desplegar menu con click derecho JTextfield

hola... Mira puedes hacer esto http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html

Etiquetas: derecho, desplegar, jtextfield
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:39.