Beans Binding with JTable Problem

Does anyone have an idea on how to make the columns of a JTable (with binded elements) not editable? I'm currently using the binding feature of NetBeans 6.0 M9.

Override the tables isCellEditable method to always return false.

Similar Messages

  • Bean Binding with Netbeans - JTable

    Hi all,
    I am using Netbeans to bind properties of my Java bean against particular fields in my UI...For example a text field is modified the bound bean property is automatically updated which is working fine.
    Now I have a JTable and within this I want to bind the first column (e.g. name) against a property in my bean...I cannot see how to do this in Netbeans, has anyone got any advice?
    Thanks,

    You didn't reply to Andre_Uhres' response in your last thread on the same topic. Why should we think things will be any different in this one?
    [http://forums.sun.com/thread.jspa?threadID=5343037]
    db

  • EJB 3.0 entity beans generation with MySql - problem

    Hi,
    I am using JDev 10.1.3 Production and using the EJB3.0 CMP wizard to generate the code from a MySQL database. No matter what type I specify for my database columns in schema, code generator always generates the properties of type String only. e.g if a column called Age is specified as Integer in schema, the generator generates setters/getters with String type.
    Can somebody please help me.
    Regards
    Vimal

    Hi,
    I'm experiencing same problems, is this a bug or an feature?

  • Selection Problem with JTable

    Hello,
    i have a selection problem with JTable. I want to allow only single cell selection and additionally limit the selection to the first column.
    I preffered the style from MS Outlook Express where you can select the email accounts to edit.
    It is a table like this:
    Account name  |   Type  |   ...
    --------------|---------|---------------------
    Hotmail       |   POP3  |
    GMX           |   IMAP  |The selection should be only avaibable at 'Hotmail' or 'GMX' - not at 'POP3', 'IMAP' or as complete row selection.
    Please help me!
    Thanks.
    Warlock

    Maybe this will helpimport java.awt.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        String[] head = {"One", "Two"};
        String[][] data = {{"R1-C1", "R1-C2"}, {"R2-C1", "R2-C2"}};
        JTable jt = new JTable(data, head);
        jt.getColumnModel().setSelectionModel(new MyTableSelectionModel());
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        jt.setCellSelectionEnabled(true);
        jt.setRowSelectionAllowed(false);
        jt.setColumnSelectionAllowed(false);
        setSize(300, 300);
        setVisible(true);
      public static void main(String[] arghs) { new Test3(); }
    class MyTableSelectionModel extends DefaultListSelectionModel {
      public void setSelectionInterval(int index0, int index1) {
        super.setSelectionInterval(0, 0);
    }

  • Any body please can solve my problem that iam facing with JTable

    Dear sir,
    Iam doing an educational product using Swing as front end in that
    iam using JTables. And back end iam using sqlserver. With jtable iam
    facing very serious problem the problem is actually iam entering the values
    in all the columns after that iam pressing the save button its not
    saving but if i click on any of the columns and try to save its saving.
    please anybody can solve my problem.Please if a piece of code is there ill
    be very thankful to you. my mailid is [email protected]
    regards
    surya

    The problem is, the cellEditor does not know that editing has stopped and therefore has not updated the model (where the data actually resides). When you click off the cell to another cell, the first cell knows it must be done editing because you are leaving it. If you click a button (or anything other than another cell), the cell being edited has no knowledge of this. You need to call stopCellEditing() on the cell editor and your problem will be solved. To do this, put the following method into your code and call it when you click the button to clear, save or whatever you need to do.
    public void ceaseEditing() {    int row = this.getEditingRow();
      int col = this.getEditingColumn();
      if (row != -1 && col != -1)
        this.getCellEditor(row,col).stopCellEditing(); 
      }Hope this helped...

  • PB with beans binding in a netbeans 6 java project with ant script existing

    Hi all,
    I am using netbeans 6.01.
    I want to use beans binding in a simple swing form created with Matisse designer. If i do beans binding in a Netbeans java project with existing ant script i have the following error :
    java.lang.UnsupportedOperationException: No PCPE/PCPMI found for classpath/compile in MasterFileObject@25 .... etc
    Beans binding works very well in normal java project ( Java Desktop App for instance ).
    How can i make it work in an existing java ant script project ?

    You need to add the Beans Binding (beansbinding-1.2.1) that come with NetBeans 6 in your projects class path.

  • Problem with WCF-Custom adapter (WS HTTP Binding with reliable messaaging) - Error event logged, even though transaction completed Sucessfully

    Hi All
    I am using WCF-Custom (WS HTTP Binding) with Message security as Windows and using Reliable messaging in the send port. Its a static Port. 
    Every thing works fine as expected for the interface. ie the transaction is success. After a min of the transaction completion. I am getting the following error
    01. I have not checked Propagate Fault message (as a solution provided in another blog)
    02. Its a static Port
    03. I am using reliable messaging
    The below error events are logged in the event viewer
    The Message Engine Encountered an error while suspending one or more Messages ( ID 5677)
    Event  ID : 5796
    The transport proxy method MoveToNextTransport() failed for adapter WCF-Custom: Reason: “Messaging engine has no record of delivering the message to the adapter. This could happen if MoveToNextTransport() is called multiple times for the same message by
    the adapter or if it is called for a message which was never delivered to the adapter by the messaging engine”. Contact the adapter vendor
    Should I have log this issue with Microsoft through Service request ? or is there any work around is there. Unfortunate is I cannot remove the reliable messaging from the service.
    Arun

    Hi,
    Is there any solution to this problem?
    I am getting the same issue "The transport proxy method MoveToNextTransport() failed for adapter WCF-NetTcp: Reason: "Messaging engine has no record of delivering the message to the adapter.
    This could happen if MoveToNextTransport() is called multiple times for the same message by the adapter or if it is called for a message which was never delivered to the adapter by the messaging engine". Contact the adapter vendor"
    I checked this link http://rajwebjunky.blogspot.be/2011/09/biztalk-dynamic-request-response-port.html, but
    in my case i am not using dynamic port.
    In my scenario, i have a number of dehydrated orchestrations that become active every Monday 6:00 AM UTC and make to calls to a WCF service, to spread out the load I have implemented a load distribution logic where orchestrations send request to service
    in every 1 minute (not at the same time). but still i get this error sometime.
    I have opened a ticket with MS support but thought that someone might have already found the root cause.
    Let me know if there is one.
    Thanks,
    Rahul
    Best Regards, Rahul Dubey MCTS BizTalk Server

  • Another problem with JTable

    Hi,
    I have encountered a problem with JTable, i am trying to display some 15 columns and their values , one of the columns value is null, then the JTable is not displaying its value from this column(which is with null value) onwards.
    Can anybody assiss me in this matter.
    Regards
    khiz_eng

    I don't know If I can fix your problem, but
    I know just that it works on my PC.... It's very very
    slow... I don't know how to insert PageSetUp option... I have to study the problem.....
    However I don't think it's a hard problem....
    I want ask to you if you have found some problems when you are in Editing mode in a cell.....
    in the jdk1.2 version I could save while was in editing mode using the editingStopped method.
    It permit to update all data .... also the data in the cell I was editing.
    in the jdk 1.3 if I use this method It doesn't work properly... It maybe destroy the content object in the Cell..... because I'm able to print all the table except the editing cell (it throw an exception...)
    What's changed????
    I don't know...
    Can u help me?

  • A problem with JTable

    Hi !
    I have a problem with JTable - would like to use this component as a simple list of rows taken from a database : don't want to be able select or set a focus to a column - want only to be able select and set focus to a row ( just like in the menus). How to disable "focusability" for a cell with JTable ? Could You help me ?
    thnx in advance

    The Border is changed by the renderer, depending on whether the cell has focus or not. So you will need to create custom renderers without a Border. Something like:
    class NoBorderRenderer extends DefaultTableCellRenderer
         public Component getTableCellRendererComponent(
              JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
              super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
              setBorder(null);
              return this;
    }

  • Problem hotspot with Jtable

    i am sorry may english, my English is not very good, my natural language is Spanish.
    I am using jtable, i beginning it with elements null and i fill it after. But when i am going to fill it i get the next error
    Java VM: Java HotSpot(TM) Client VM (1.4.0-b92 mixed mode)
    # Error ID: 434F444523414348450E43505000BE
    # Problematic Thread: prio=7 tid=0x0AB83010 nid=0x7f8 runnable
    but i use -server for running, then i don`t get the error.
    somebory can help me.

    here is the complete class.
    I call first the method
    iniciaTablaVector(
    boolean puede_editar,
    boolean puede_sortear,
    boolean puede_seleccionar)
    after i get the data from the database and add them into the vectors i call
    the method
    asignaDatosTabla(java.util.Vector vector_campos_usar,
    java.util.Vector vector_campos_usar_i,
    java.util.Vector vector_datos,
    java.util.Vector vector_datos_campos)
    package version01;
    * TITULOS: Programas Boca
    * DESCRIPCION Programas Generales
    * DERECHO RESERVADO Derechos reservado 2001
    * COMPANIA Sistemas Boca
    * @AUTORES Jos� Alberto Felipe y Jos� Luis Marte
    * @VERSION 1.0
    public class ManejoTablaVector02 //extends javax.swing.JTable
    javax.swing.JTable vista_tabla;
    miModeloTabla mimodelotabla;
    private boolean DEBUG = true;
    private boolean PUEDE_SEL_COLUMNA = false;
    private boolean PUEDE_SEL_FILA = true;
    private int fila_sel;
    java.awt.Container frame_usar;
    ManejoParametros manejoparametros;
    java.util.Vector vector_columnas, vector_campos_usar,vector_campos_usar_i;
    java.util.Vector vector_datos,vector_datos_campos ;
    javax.swing.JComponent[] campos;
    java.util.Vector vector_campos;
    java.util.TreeMap map_campos;
    ManejoPantalla manejopantalla;
    javax.swing.ListSelectionModel modelo_fila_sel;
    boolean puede_editar;
    boolean puede_sortear;
    boolean puede_seleccionar;
    //Object[] valores_largo;
    //Class[] clase_columnas;
    java.util.Vector valores_largo;
    java.util.Vector clase_columnas;
    public ManejoTablaVector02(java.awt.Container frame_usar,
    ManejoParametros manejoparametros,
    // java.util.Vector vector_datos,
    // java.util.Vector vector_datos_campos,
    // java.util.Vector vector_campos_usar,
    // java.util.Vector vector_campos_usar_i,
    javax.swing.JComponent[] campos,
    java.util.Vector vector_campos,
    java.util.TreeMap map_campos)
    this.frame_usar = frame_usar;
    this.manejoparametros = manejoparametros;
    /* this.vector_campos_usar = vector_campos_usar;
    this.vector_campos_usar_i = vector_campos_usar_i;
    if (manejoparametros.datos_leidos_tablas == null)
    manejoparametros.datos_leidos_tablas = new java.util.Vector();
    if (manejoparametros.datos_leidos_campos == null)
    manejoparametros.datos_leidos_campos = new java.util.Vector();
    // this.vector_datos =
    // manejoparametros.datos_leidos_tablas;
    // this.vector_datos_campos =
    // manejoparametros.datos_leidos_campos;
    this.campos = campos;
    this.vector_campos = vector_campos;
    this.map_campos = map_campos;
    // obtieneEncabezadoTabla();
    // asignaDatosCamposIniciales();
    // obtieneColumnasTabla();
    //public javax.swing.JTable iniciaTablaVector(
    public void iniciaTablaVector(
    boolean puede_editar,
    boolean puede_sortear,
    boolean puede_seleccionar)
    this.puede_editar = puede_editar;
    this.puede_sortear = puede_sortear;
    this.puede_seleccionar = puede_seleccionar;
    // Instead of making the table display the data as it would normally with:
    // JTable vista_tabla = new JTable(dataModel);
    // Add a sorter, by using the following three lines instead of the one above.
    //va TableSorter sorter = new TableSorter(dataModel);
    vista_tabla= new javax.swing.JTable();
    /*Desabilita el manejo de columna de la tabla para manejarlo manual*/
    vista_tabla.setAutoCreateColumnsFromModel(false);
    manejopantalla = new ManejoPantalla();
    obtieneColumnasTabla();
    this.vector_datos =
    manejoparametros.datos_leidos_tablas;
    this.vector_datos_campos =
    manejoparametros.datos_leidos_campos;
    iniciaVectorDatos();
    mimodelotabla = new miModeloTabla();
    /* mimodelotabla = new miModeloTabla(
    manejoparametros,
    vector_columnas,
    vector_datos,
    vector_datos_campos,
    campos,
    vector_campos,
    map_campos,
    manejopantalla);
    vista_tabla.setModel(mimodelotabla);
    configuraColumna(vista_tabla);
    asignaEscuchadores();
    // asignaAnchoColumnas(vista_tabla, mimodelotabla);
    // asignaEscuchadores();
    // Crear a modelo de tabla.
    class miModeloTabla extends javax.swing.table.AbstractTableModel
    java.util.Vector vector_columnas;
    java.util.Vector vector_campos_usar,
    vector_campos_usar_i;
    java.util.Vector vector_datos,vector_datos_campos;
    javax.swing.JComponent[] campos;
    java.util.Vector vector_campos;
    java.util.TreeMap map_campos;
    ManejoPantalla manejopantalla;
    ManejoParametros manejoparametros;
    public miModeloTabla(ManejoParametros manejoparametros,
    java.util.Vector vector_columnas,
    java.util.Vector vector_datos,
    java.util.Vector vector_datos_campos,
    javax.swing.JComponent[] campos,
    java.util.Vector vector_campos,
    java.util.TreeMap map_campos,
    ManejoPantalla manejopantalla)
    this.manejoparametros = manejoparametros;
    this.vector_columnas = vector_columnas;
    // this.vector_campos_usar = vector_campos_usar;
    // this.vector_campos_usar_i = vector_campos_usar_i;
    this.vector_datos = vector_datos;
    this.vector_datos_campos = vector_datos_campos;
    this.campos = campos;
    this.vector_campos = vector_campos;
    this.map_campos = map_campos;
    this.manejopantalla = manejopantalla;
    // javax.swing.table.TableModel dataModel =
    // new javax.swing.table.AbstractTableModel()
    // These methods always need to be implemented.
    /* Para asignar los anchos de la columna
    Se pueden asignar por el la columna que tenga mas tama�o
    public final Object[] valores_largo = {"Angela", "Andrews",
    "esto es mas que una prueba","prueba",
    "prueba","prueba","prueba","prueba","N"};*/
    class miModeloTabla extends javax.swing.table.AbstractTableModel
    public int getColumnCount()
    return vector_columnas.size();
    public int getRowCount()
    return vector_datos==null ? 0 : vector_datos.size();
    public Object getValueAt(int row, int col)
    int total_columna = ((java.util.Vector)
    (vector_datos.elementAt(row))).size() + 1;
    if (total_columna > col)
    return ((java.util.Vector)
    (vector_datos.elementAt(row))).elementAt(col);
    }else
    return null;
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int columna)
    String indice_str =(String)
    ((Object[])vector_columnas.elementAt(columna))[1];
    int indice_vector_campos = Integer.parseInt(indice_str);
    return (String)((Object[])
    vector_campos.elementAt(indice_vector_campos))[3];
    public Class getColumnClass(int columna)
    // {return getValueAt(0,columna).getClass();}
    String indice_str =(String)
    ((Object[])vector_columnas.elementAt(columna))[1];
    int indice_vector_campos = Integer.parseInt(indice_str);
    return (Class)obtieneTipoColumna(
    (String)((Object[])
    vector_campos.elementAt(indice_vector_campos))[29]);
    public boolean isCellEditable(int fila, int columna)
    if (puede_editar)
    String indice_str =(String)
    ((Object[])vector_columnas.elementAt(columna))[1];
    int indice_vector_campos = Integer.parseInt(indice_str);
    if (((String)
    ((Object[])
    vector_campos.elementAt(
    indice_vector_campos))[18]).equals("true"))
    return true;
    else
    return false;
    }else return false;
    /* public void setValueAt(Object aValue, int fila, int columna)
    if (puede_editar)
    ((java.util.Vector)
    (vector_datos.elementAt(fila))).elementAt(columna) = aValue;
    fireTableCellUpdated(fila, columna);
    // public static void main(String[] args) {
    // new TableExample3();
    //final de clase
    public void asignaDatosTabla(java.util.Vector vector_campos_usar,
    java.util.Vector vector_campos_usar_i,
    java.util.Vector vector_datos,
    java.util.Vector vector_datos_campos)
    this.vector_campos_usar = vector_campos_usar;
    this.vector_campos_usar_i = vector_campos_usar_i;
    this.vector_datos = vector_datos;
    this.vector_datos_campos = vector_datos_campos;
    // asignaDatosCamposIniciales();
    // mimodelotabla.fireTableDataChanged();
    // configuraColumna(vista_tabla);
    // javax.swing.table.TableModel modelo = vista_tabla.getModel();
    mimodelotabla.fireTableDataChanged();
    // vista_tabla.repaint();
    vista_tabla.requestFocus();
    javax.swing.ListSelectionModel listseleccion = vista_tabla.getSelectionModel();
    listseleccion.setLeadSelectionIndex(0);
    vista_tabla.setSelectionModel(listseleccion);
    //javax.swing.ListSelectionModel lsm =
    // (javax.swing.ListSelectionModel)e.getSource();
    // asignaEscuchadores();
    public void iniciaVectorDatos()
    java.util.Vector vectornulo;
    manejoparametros.datos_leidos_tablas.clear();
    if (!vector_columnas.isEmpty())
    for(int i=0;i<30;i++)
    vectornulo = new java.util.Vector();
    for (int j = 0;j<vector_columnas.size();j++)
    vectornulo.addElement(null);
    vector_datos.addElement(vectornulo);
    private void asignaEscuchadores()
    vista_tabla.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    if (puede_seleccionar) { // true by default
    modelo_fila_sel = vista_tabla.getSelectionModel();
    modelo_fila_sel.addListSelectionListener(
    new javax.swing.event.ListSelectionListener() {    
    public void valueChanged(
    javax.swing.event.ListSelectionEvent e)
    javax.swing.ListSelectionModel lsm =
    (javax.swing.ListSelectionModel)e.getSource();
    int fila_sel = lsm.getMinSelectionIndex();
    // DEBO BUSCAR UNA FORMA DE DETERMINAR SI EL VECTOR DE CAMPOS TIENE DATOS
    if (!vector_datos_campos.isEmpty())// !=null)
    manejopantalla.asignaDatosPantalla(
    (java.util.TreeMap)
    vector_datos_campos.elementAt(fila_sel),
    campos,
    vector_campos);
    /*Aqui funcionan para cambiar los campos de arriba de la forma
    que esta abajo
    ((javax.swing.JTextField)campos[0]).setText(
    (String)vista_tabla.getValueAt(fila_sel,0));
    ((javax.swing.JTextField)campos[1]).setText((String)vista_tabla.getValueAt(fila_sel,1));
    //v if (lsm.isSelectionEmpty()) {
    //v System.out.println("No rows are selected.");
    //v } else {
    //v int selectedRow = lsm.getMinSelectionIndex();
    //v System.out.println("Row " + selectedRow
    //v + " is now selected.");
    //v }
    } else {
    vista_tabla.setRowSelectionAllowed(false);
    vista_tabla.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent e) {
    fila_sel = vista_tabla.getSelectedRow();
    if (e.getClickCount() ==2)
    asignaDatosSeleccionados(fila_sel);
    salirPrograma();
    // System.out.println("FILA SEL --> " + fila_sel);
    /*Aqui va chequeo de seleccion
    ((javax.swing.JTextField)campos[0]).setText((String)vista_tabla.getValueAt(fila_sel,0));
    ((javax.swing.JTextField)campos[1]).setText((String)vista_tabla.getValueAt(fila_sel,1));
    vista_tabla.addKeyListener(new java.awt.event.KeyAdapter()
    public void keyPressed(java.awt.event.KeyEvent e)
    // char c = e.getKeyChar();
    int keycode = e.getKeyCode();
    if (keycode == 10)
    fila_sel = vista_tabla.getSelectedRow();
    asignaDatosSeleccionados(fila_sel);
    salirPrograma();
    // System.out.println("FILA SEL --> " + fila_sel);
    public void configuraColumna(javax.swing.JTable tabla)
    int tamano;
    for (int i=0;i<vector_columnas.size();i++)
    String indice_str =(String)
    ((Object[])vector_columnas.elementAt(i))[1];
    int indice_vector_campos = Integer.parseInt(indice_str);
    /*Aqui se asigna en render de cada celda esto permite
    fijar el font de las celdas, el borde, fijar, estado
    colores,etc. Debo crear uno propio para tener mas control*/
    javax.swing.table.DefaultTableCellRenderer
    renderer = new javax.swing.table.DefaultTableCellRenderer();
    /*Debo agregar un campo en el archivo de configuracion para
    saber como voy alinear el campo (derecha,izquierda,centro)*/
    renderer.setHorizontalAlignment(renderer.LEFT);
    //javax.swing.JLabel.LEFTNTER_ALIGNMENT);
    // renderer.setText((String)((Object[])
    // vector_campos.elementAt(
    // indice_vector_campos))[3]);
    if (!UtilitariosGenerales.isCampoBlanco(((String)((Object[])
    vector_campos.elementAt(
    indice_vector_campos))[26])))
    tamano = Integer.parseInt(((String)((Object[])
    vector_campos.elementAt(
    indice_vector_campos))[26]));
    }else
    tamano = 10;
    /*Debo crear mi propio tipo de editor de celdas, para formatear
    los datos debo llamarlo aqui, ahi tomo en cuenta el tipo de
    datos que voy a usar (JCombo, JcheckBox, JTextField)*/
    javax.swing.table.TableCellEditor editor;
    if (
    /* ((String)((Object[])
    vector_campos.elementAt(indice_vector_campos))[2]).equals("JCheckBox")
    ((String)((Object[])
    vector_campos.elementAt(indice_vector_campos))[29]).equals("Boolean")
    javax.swing.JCheckBox checkbox = new javax.swing.JCheckBox();
    editor = new javax.swing.DefaultCellEditor(checkbox);
    else
    javax.swing.JTextField jtextfield = new javax.swing.JTextField();
    editor = new javax.swing.DefaultCellEditor(jtextfield);
    javax.swing.table.TableColumn columna = new
    javax.swing.table.TableColumn(
    i,tamano,renderer,editor);
    tabla.addColumn(columna);
    public void obtieneColumnasTabla()
    vector_columnas = new java.util.Vector();
    int indice_vector;
    String[] informacion_columna;
    for (int i=0;i<vector_campos.size();i++)
    if (!
    ((String)((Object[])vector_campos.elementAt(i))[2]).equals(
    "JTable"))
    continue;
    informacion_columna = new String[2];
    informacion_columna[0] = (String)((Object[])vector_campos.elementAt(i))[3];
    informacion_columna[1] = String.valueOf(i);
    vector_columnas.addElement(informacion_columna);
    public Object obtieneTipoColumna(String tipo_columna)
    String[] arreglo_tipo = {"String","Long","Integer","Double","Boolean"};
    int i = java.util.Arrays.binarySearch(arreglo_tipo,tipo_columna);
    switch (i)
    case 0:
    return String.class;
    case 1:
    return Long.class;
    case 2:
    return Integer.class;
    case 3:
    return Double.class;
    case 4:
    return Boolean.class;
    default:
    return String.class;
    class FormattedCellRenderer extends javax.swing.table.DefaultTableCellRenderer
         protected java.text.Format m_format;
         public FormattedCellRenderer(java.text.Format format) {
              m_format = format;
         public java.awt.Component getTableCellRendererComponent(
    javax.swing.JTable table,
              Object value, boolean isSelected, boolean hasFocus,
              int nRow, int nCol)
              return super.getTableCellRendererComponent(table,
                   value==null ? null : m_format.format(value),
                   isSelected, hasFocus, nRow, nCol);
    class FormattedCellEditor extends javax.swing.DefaultCellEditor
         public FormattedCellEditor(final javax.swing.JFormattedTextField
                   formattedTextField) {
              super(formattedTextField);
    System.out.println(delegate);
              formattedTextField.removeActionListener(delegate);
              delegate = new EditorDelegate() {
                   public void setValue(Object value) {
                        formattedTextField.setValue(value);
                   public Object getCellEditorValue() {
                        return formattedTextField.getValue();
              formattedTextField.addActionListener(delegate);
              formattedTextField.setBorder(null);
    public void asignaDatosSeleccionados(int fila)
    if (fila >=0 && fila < vector_datos.size())
    manejoparametros.isSeleccionada = true;
    java.util.TreeMap map_datos_sel = new java.util.TreeMap();
    int indice_vector;
    int total_tabla=-1;
    int total_campos = -1;
    for (int i=0;i<vector_campos_usar.size();i++)
    // String[] arreglo_campo_usar = new String[2];
    // arreglo_campo_usar = (String[])vector_campos_usar.elementAt(i);
    // indice_vector = Integer.parseInt(arreglo_campo_usar[0]);
    /*AQUI DEBO CLASIFICAR SI ES FIJO O ES DE LA TABLA*/
    if (!
    ((String)((Object[])vector_campos_usar_i.elementAt(i))[2]).equals(
    "JTable"))
    if (!UtilitariosGenerales.isCampoBlanco(
    ((String)((Object[])vector_campos_usar_i.elementAt(i))[28]) ) &&
    !((String)((Object[])vector_campos_usar_i.elementAt(i))[40]).equals(
    "true"))
    if (!map_datos_sel.containsKey(
    ((Object[])vector_campos_usar_i.elementAt(i))[28]))
    total_campos++;
    Object valores = ((java.util.TreeMap)
    vector_datos_campos.elementAt(fila)).get(
    ((Object[])vector_campos_usar_i.elementAt(
    i))[28]);
    map_datos_sel.put( ((Object[])vector_campos_usar_i.elementAt(i))[28],
    valores);
    // ((java.util.Vector)
    // vector_datos_campos.elementAt(fila)).elementAt(total_campos) );
    // continue;
    for (int i =0;i<vector_campos.size();i++)
    if (
    ((String)((Object[])vector_campos.elementAt(i))[2]).equals(
    "JTable"))
    total_tabla++;
    if (!UtilitariosGenerales.isCampoBlanco(
    ((String)((Object[])vector_campos.elementAt(i))[28]) ))
    if (!map_datos_sel.containsKey(
    ((Object[])vector_campos.elementAt(i))[28]))
    map_datos_sel.put( ((Object[])vector_campos.elementAt(i))[28],
    ((java.util.Vector)
    vector_datos.elementAt(fila)).elementAt(i) );
    manejoparametros.fila_seleccionada = fila;
    manejoparametros.map_datos_seleccionados = map_datos_sel;
    public void obtieneDatosSeleccionados_ant(int fila)
    if (fila >=0 && fila < vector_datos.size())
    manejoparametros.isSeleccionada = true;
    java.util.TreeMap map_datos_sel = new java.util.TreeMap();
    int indice_vector;
    int total_tabla=-1;
    for (int i=0;i<vector_campos_usar.size();i++)
    // String[] arreglo_campo_usar = new String[2];
    // arreglo_campo_usar = (String[])vector_campos_usar.elementAt(i);
    // indice_vector = Integer.parseInt(arreglo_campo_usar[0]);
    /*AQUI DEBO CLASIFICAR SI ES FIJO O ES DE LA TABLA*/
    if (!
    ((String)((Object[])vector_campos_usar_i.elementAt(i))[2]).equals(
    "JTable"))
    continue;
    else
    total_tabla++;
    if (!UtilitariosGenerales.isCampoBlanco(
    ((String)((Object[])vector_campos_usar_i.elementAt(i))[28]) ))
    if (!map_datos_sel.containsKey(
    ((Object[])vector_campos_usar_i.elementAt(i))[28]))
    map_datos_sel.put( ((Object[])vector_campos_usar_i.elementAt(i))[28],
    ((java.util.Vector)
    vector_datos.elementAt(fila)).elementAt(total_tabla) );
    int total_campos = -1;
    for (int i=0;i<vector_campos.size();i++)
    if (!UtilitariosGenerales.isCampoBlanco(
    ((String)((Object[])vector_campos.elementAt(i))[28]) ) &&
    !((String)((Object[])vector_campos.elementAt(i))[2]).equals(
    "JEncadena"))
    if (!map_datos_sel.containsKey(
    ((Object[])vector_campos.elementAt(i))[28]))
    total_campos++;
    String valores = (String)((java.util.TreeMap)
    vector_datos_campos.elementAt(fila)).get(
    ((Object[])vector_campos.elementAt(
    i))[28]);
    map_datos_sel.put( ((Object[])vector_campos.elementAt(i))[28],
    valores);
    // ((java.util.Vector)
    // vector_datos_campos.elementAt(fila)).elementAt(total_campos) );
    manejoparametros.fila_seleccionada = fila;
    manejoparametros.map_datos_seleccionados = map_datos_sel;
    public void salirPrograma()
    try
    if (frame_usar instanceof javax.swing.JDialog)
    ((javax.swing.JDialog)frame_usar).setName("botones");
    ((javax.swing.JDialog)frame_usar).dispose();
    }else
    ((javax.swing.JFrame)frame_usar).setName("botones");
    ((javax.swing.JFrame)frame_usar).dispose();
    }catch (Exception ex)
    System.out.println(ex.toString());
    }

  • JTable problem in master detail form

    I've created a master detail form. There is only one Navigation bar for both master and detail. Detail has a JTable component. JTable doesn't get focus when it doesn't have any row and I am uanble to insert new rows. To cope with this problem I've added two new buttons in Navigation Bar to travers to the next and previous iterBinding.
    When I start my form cursor apperas in the first field of master view when I press Next Button nothing happens ( Status Bar should show the next iterbinding/view). I've addes some debug mesgs in iterBindingChanged method of NavitaionBar class and it seems by looking the mesgs that detail/Jtable's iterBinding get focus two times but at last focus has been returned to the master iterBinding.
    Is there any suggestion to solve this problem.
    Regards
    Aamir

    Hi,
    I'm using 1.4.0 for my JClient and, due to the improved focus management provided in the new JDK, I am able to properly manage master-details configuration with only one navigation bar (of course, the JTable must be able to receive the focus, but this also is much easier in 1.4.0...)
    Nevertheless, the solution I found is quite complex and I would happily discard it.
    If you could find a solution that works "naturally" on frames with only one navigation bar, it would be great! I think that the buttons in the nav bar should apply to the "current" iterator binding (the iterator binding for the control having the focus).
    Thanks,
    Adrian

  • Netbeans beans binding

    __How TO Bind The Domain object Directly To Detail View ?__
    when we create master detail table with netbeans .netbeans uses the following binding patern.bind the list to master table and master tables selected element to lists domain object
    how to use netbeans beans binding feature create a from which only have detail view (no master table )
    and bind domain (customer) object directly to GUI fields
    and i should have to the abilty to add new (create new ) domain object using the same form.
    I don’t want jtable in my form
    note:-and I have to be able to persist the old object and create new object in the same form
    ie :- add new button on the same form
    please visit following link for picture
    [http://netbeans7.blogspot.com/]

    I'll give my usual comment here:
    Take this to a NetBeans forum--since it's how to use the NetBeans GUI tool and hasn't anything to do with you coding Java--or go back and learn how to code GUI's without an auto-coder. I and many others are very reluctant to give any advice other than that to anyone that wants to use the auto-code features of a product.

  • Mouselistner is not working with jtable in the browser

    Hi
    I am having a problem with jTable.
    I added a mouselistener to table header to sort table but when i run that applet from my netbean ide it works fine but when i run that applet in my browser it doesn't work, i have tested, its not even generate mouseclick event .Please help me guys.
    I call this function after calling initComponents() method of JApplet.
    public void setTableAction()
    //set mouselistener to sort table on click of table header
    final JTableHeader head= jTable1.getTableHeader();
    head.addMouseListener(new java.awt.event.MouseAdapter()
    public void mouseClicked(java.awt.event.MouseEvent evt)
    Vector data= ((DefaultTableModel)jTable1.getModel ()).getDataVector();
    sortTable(data, head.columnAtPoint(evt.getPoint()));
    //set action map to change the default action performed for enter key pressed
    InputMap imap = jTable1.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    KeyStroke tabKey = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
    final Action oldAction= jTable1.getActionMap().get(imap.get(tabKey)); // get map to set enter key.
    imap.put(enterKey, "enter"); // set enter key
    Action newAction = new AbstractAction(){
    public void actionPerformed(ActionEvent e) {
    oldAction.actionPerformed(e);
    JTable table= (JTable)e.getSource();
    table.changeSelection(0,0,false,false);
    if(table.isCellEditable(0,0))
    String sTemp= (String)table.getValueAt(0,0);
    if(sTemp.length()>0) {
    if(bRenewItem)
    retrieveRcodeDetails("",sTemp);
    else
    processRCodeDetails(sTemp, e);
    }else
    table.editCellAt(0,0);
    jTable1.getActionMap().put("enter", newAction);
    jTable1.setPreferredScrollableViewportSize(jTable1.getPreferredSize());
    }

    Hi,
    I also am using the Bépo layout with an encrypted drive and encountered the same problem: the Return key does not work.
    It seems to work fine if you use the fr-bepo-latin9 keymap.
    # /etc/vconsole.conf
    KEYMAP=fr-bepo-latin9
    But I also looked at the files /usr/share/kbd/keymaps/i386/bepo/fr-bepo.map.gz and /usr/share/kbd/keymaps/i386/bepo/fr-bepo-latin9.map.gz (you can open gzipped files in vim directly). fr-bepo-latin9.map.gz defines keycode 28 (Return) but fr-bepo.map.gz does not.
    I modified fr-bepo.map.gz:
    # vim /usr/share/kbd/keymaps/i386/bepo/fr-bepo.map.gz # Append that line : "keycode 28 = Return".
    # mkinitcpio -p linux # Rebuild the initramfs.
    The Return key now works, but the Backspace (14, "Delete") and Shift (54) keys don’t work. I found that both the cf.map.gz (french canadian layout) and fr-bepo-latin9.map.gz files define those keycodes as well as other non-printing keys so I copied the following lines from fr-bepo-latin9.map.gz to fr-bepo.map.gz:
    keycode 1 = Escape Escape
    keycode 14 = Delete Delete
    keycode 15 = Tab Tab
    keycode 28 = Return
    keycode 29 = Control
    keycode 42 = Shift
    keycode 54 = Shift
    keycode 56 = Alt
    keycode 58 = Caps_Lock
    keycode 97 = Control
    It works! Don’t forget to rebuild the initramfs after you change the keymap file.
    # mkinitcpio -p linux
    I will send a message to the kbd and bépo projects mailing lists and report back.

  • How to insert a null value to combobox which is bind with datasource

    Hi,
    i am working on c# winforms application. I have 2 comboboxes one is CustomerCbBox and another is OrderCbBox. CustomerCbBox is bind with data source.
    on CustomerCbBox SelectedIndexChanged event data is populated in OrderCbBox from data source. 
    i want to add a null or empty field in CustomerCbBox. all I want is that when the user don't Select Customer Name and OrderNo null or empty data enter in database. but when i click Insert Button it generate error "Object reference is not "object
    reference not set to an instance of an object".
    here is my code.
      private void MainForm_Load(object sender, EventArgs e)
    production pd = new production();
    CustomerCbBox.DataSource = pd.Customer();
    CustomerCbBox.DisplayMember = "Cust";
    CustomerCbBox.ValueMember = "CustId";
     private void CustomerCbBox_SelectedIndexChanged(object sender, EventArgs e)
                      try
                          string PartyName = CustomerCbBox.SelectedIndex.ToString();
                           PONum1.DataSource = pd.GetPOnumActive(PartyName1);
                              PONum1.DisplayMember = "PONum";
                              PONum1.ValueMember = "PONum";
                      catch (Exception ex)
                          MessageBox.Show(ex.Message);
         Please help me to solve this problem thanks.      

    Hello,
    We could check whether the user has selected any items before adding that to database.
    if (CustomerCbBox.SelectedIndex > -1)
    // do something
    }else{//add dbnull to database}
    And for adding null to databse, we could pass DBNull.Value instead.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Plz tell me how to use JSpinner with JTable

    I have retrieve records from database but as the number of records(rows) are more than 1000 , i want to use JSpinner with JTable . plz solve my problem by giving the appropriate code for the same.

    hi
    check this links
    http://www.exampledepot.com/egs/javax.swing.table/CustRend.html
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    hope this will help you.. this explains exactly what you want.
    regards
    Aniruddha

Maybe you are looking for

  • Problems with my new computer

    I got my computer less then a month ago and its been working fine until a couple days ago.. the only upgrade i did was right in the beginning and I added a gig of memory. I have been using the computer for internet and gaming.. I have been playing Ca

  • Steps for  http receiver adapter communication channel

    Hi can you please specify steps for http receiver communication channel? thanks Prasad

  • VNC: no screen refresh controlling Lion Server

    Hello all. I have a Mac Mini running Lion Server. It shares a monitor with a PC using an IOGear DVI KVM switch. Usually I can use VNC remotely to control the Mac Mini when it is connected to the KVM switch. However sometimes I need to grab the cables

  • Having problems updating Adobe Reader MSI from 10.1.0 to 10.1.4

    Hello, I have read online that you can slipstream the adobe update into the original 10.1.0 installer.  Here is what I have tried. I have downloaded the original 10.1.0 MSI file and ran msiexec /a C:\Adobe\Downloads\AdbeRdr1010_en_US.msi, which durin

  • IPhoto thumbnail issue

    I have a new Mac with Snow Leopard and iPhoto 09. I transferred stuff from an older Mac and my iPhoto library transferred nicely. Now I notice that when I double-click on a thumbnail image from a recent event I get a blurry black screen with a white