JTable editCellAt

Hello Javaers,
I've a question for you regarding JTable edits - hoping to save some google time.
I've a JTable that currently accepts edits by careful overriding of the standard methods, isCellEditable, and by specifying
((DefaultCellEditor)table.getDefaultEditor(String.class)).setClickCountToStart(2);     I'd like to disable click-edits at this point, and move the edit function to a context menu. How do I disable click editing?
Thanks!

Hey Camickr,
thanks for checking in as always. I actually discovered what was going on, it had me just as confused as you might have been by my post. I was firing the editCellAt from a JPopupMenu (as a context-menu action). I was puzzled when I saw that the edit wasn't occurring.
Turns out that it was indeed occurring, just that the disposal of the context menu probably momentarily stole focus from the edit, which was canceling the edit itself. I had to explicitly call dispose before initiating the action, and this solved my problem.
Thanks - I'll mark it as solved so that you can get some points.
Cheers!
Alex

Similar Messages

  • JTable.editCellAt() not working

    After using the editCellAt function of JTable I guess you should be able to just start typing in that cell (without any mouseclicks). (If this is not the case - then how to make that?). But it doesn't work! Is there something wrong with the code below? I want the last row's first column to be selected so that I can just start typing. But not even a cursor is visible.
    tuplesTM.addRow(new Vector());
    if (tuplesT.isCellEditable(tuplesTM.getRowCount() - 1, 0))
      System.out.println("TRUE");
    else
      System.out.println("FALSE");
    tuplesT.editCellAt(tuplesTM.getRowCount() - 1, 0);

    editCellAt(row, column) should work if
    1) the cell (row, column) is editable, that is isCellEditable(row, column) returns true
    2) there is an editor for the specified column
    If all these conditions are true, try to add Vector(COLUMN_COUNT) instead of simple Vector().

  • Problem About Focus transfer in swing JTable Cell

    I open a JDialog in KeyPressed Event of Cell of the JTable,when the JDialog closed, I cannot set the Focus to next Cell in my code. the focus was set on the ToolBar(I don't write it in my code).
    key pressed
    void this_keyPressed(KeyEvent e) {
    String text = this.getText().trim();
    if(e.getKeyCode()==10 && text.trim().length()>0)
    wzdlg = new JDialog();
    Dimension dlgSize = wzdlg.getPreferredSize();
    wzdlg.setLocation(0,0);
    wzdlg.setModal(true);
    wzdlg.pack();
    wzdlg.show();
    //When JDialog Closed,Focus move to next cell
                   //table.editAt(0,1); //cannot getFocus
                   //following cannot get focus too
         Component comp = ((DefaultCellEditor)table.getCellEditor(0,1)).getComponent();
         if (comp instanceof javax.swing.JTextField) comp.requestFocus();               
    Why? How Can I do?

    Try calling prepareEditor after your editCellAt method. It would be like
    JTable.editCellAt(row, col);
    JTable.prepareEditor(theTextFieldComponent, row, col);
    Here, the text field component would be from the component editor. I would recommend you holding a reference than doing a getComponent. But, both may work.

  • JTable ArrayIndexOutOfBoundsException

    Hi all,
    Pleaaase help me solve this problem...
    I get ArrayIndexOutOfBoundsException when I try to set some data in a JTable. I shall describe the scenario in detail.
    There are 2 lines in a JTable. One with data, and one without data(which means a blank row, where the user is supposed to enter data).
    The user clicks on a button(refresh). This clears off the empty rows, which leaves the JTable with only one row, the one with valid data.
    Now the user clicks on another button(Save). This tries to position the cursor in the first row with the statement
    editCellAt(0,0). Since the Jtable is having a valid entry here, I expect it to behave normally and proceed, after placing the mouse caret in the first row, first column.
    But it throws a ArrayIndexOutOfBoundsException saying java.lang.ArrayIndexOutOfBoundsException: 2 >= 2.
    I tried searching in this forum, posted also..but no help...
    I am in jdk1.3.
    Some postings here mention of something like reload() etc. in the tablemodel, but none of them are specific.
    Any help will be HIGHLY appreciated,
    Thanks...

    Here is the stackTrace
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
    at java.util.Vector.elementAt(Vector.java:417)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:674)
    at javax.swing.JTable.setValueAt(JTable.java:1734)
    at javax.swing.JTable.editingStopped(JTable.java:2989)
    at javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:112)
    at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:242)
    at javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:176)
    at javax.swing.JTable.editCellAt(JTable.java:2359)
    at javax.swing.JTable.editCellAt(JTable.java:2340)
    at SOFrame.save(SOFrame.java:843)
    at SOFrame.SaveButtonActionPerformed(SOFrame.java:815)
    at SOFrame.access$7(SOFrame.java:814)
    at SOFrame$6.actionPerformed(SOFrame.java:244)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
    at java.awt.Component.processMouseEvent(Component.java:3717)
    at java.awt.Component.processEvent(Component.java:3546)
    at java.awt.Container.processEvent(Container.java:1164)
    at java.awt.Component.dispatchEventImpl(Component.java:2595)
    at java.awt.Container.dispatchEventImpl(Container.java:1213)
    at java.awt.Component.dispatchEvent(Component.java:2499)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
    at java.awt.Container.dispatchEventImpl(Container.java:1200)
    at java.awt.Window.dispatchEventImpl(Window.java:912)
    at java.awt.Component.dispatchEvent(Component.java:2499)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
    at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
    Line number 843 where this error occurs
    if(ItemTable.isEditing()){
    ItemTable.editCellAt(0,0);
    ---the line which is executed for deleting the table rows(after which this exception occurs) has also been posted in my previous message in the same topic.

  • ComboBocCellEditor and JTable

    Hello everyone,
    I have a JInternalFrame with a JTable with 12 columns (and other components). In the third column there is a ComboBox editable with AutoCompleteDecorator (package org.jdesktop.swingx.autocomplete.*) added with the following code:
            comboBox=new JComboBox();//combobox editable
            //filling the combobox with some data
            AutoCompleteDecorator.decorate(comboBox);
            this.cbce=new ComboBoxCellEditor(comboBox);
            this.cbce.addCellEditorListener(this.tabCBKeyListener);
            jtable.getColumnModel().getColumn(3).setCellEditor(cbce);The combobox editing works fine, but i have problems at 'editingStopped' event. In other words, when i press the TAB command, the focus exit from table going to a JTextField component, but this is an error because the focus must continue to the table in the 4th column!
    I added this code (the CellEditorListener tabCBKeyListener), but doesn't function:
    tabulatoreCBKeyListener=new CellEditorListener(){
                public void editingStopped(ChangeEvent e){
                    jtable.editCellAt(jtable.getSelectedRow(), 4);
                public void editingChanged(ChangeEvent e){   
                public void editingCanceled(ChangeEvent e){   
            };Can someone help me?
    Thanks in andvance!

    [email protected] wrote:
    camickr wrote:
    You do not need custom code to set the cell selection. By default the table will go to the next cell when you use the Tab key.The table will go to the next cell when i use the normal combo box in JTable, with the DefaultCellEditor.
    If I use a combo with AutoCompleteDecorator and ComboBoxCellEditor it doesn't function...
    I'm working both with normal JComboBox and AutoCompleteDecorator JComboBox.I verified more carefully and I've seen that you have reason in case the next cell is blank (without components).
    If the next cell contains a combo box NOT editable, the tab exit from the table.
    Now I rewrite the code:
    //initialize and fill combobox and combobox2 - first is editable, the second is not editable
            comboBox.setEditable(true);
            AutoCompleteDecorator.decorate(comboBox);
            this.cbce=new ComboBoxCellEditor(comboBox);
            this.cbce.addCellEditorListener(this.tabulatoreCBKeyListener);
            table.getColumnModel().getColumn(3).setCellEditor(cbce);
            table.getColumnModel().getColumn(4).setCellEditor(new DefaultCellEditor(comboBox2));

  • Help with creating a custom table cell editor?

    hi, i was reading up on various tutorials and trying to write codes that pops up a simple calendar when clicked on text of the Date class in a table, so far, i can't seem to get my classes working.. the following is some classes i've written for this task (note, there are alot of commented out lines, those are the modifications done to the tutorial classes in http://java.sun.com/docs/books/tutorial/)
    any help would be appreciated :D
    thanks in advance!
    What i have done so far:
    /** BASIC TABLE CLASS FOR DEMONSTRATION*/
    //import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    public class TableBasic extends JFrame
         public TableBasic()
              String[] columnNames = { "Date", "String", "Integer", "Boolean" };
              Object[][] data =
                   {  { new Date(), "A", new Integer(1), Boolean.TRUE },
                        {new Date(), "B", new Integer(2), Boolean.FALSE },
                        {new Date(), "C", new Integer(9), Boolean.TRUE },
                        {new Date(), "D", new Integer(4), Boolean.FALSE}
              JTable table = new JTable(data, columnNames)
                   //Returning the Class of each column will allow different
                   //renderers to be used based on Class
                   public Class getColumnClass(int column)
                        return getValueAt(0, column).getClass();
              table.setDefaultRenderer(Date.class, new CalendarRenderer(true));
              table.setDefaultEditor(Date.class, new CalendarEditor());
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              JScrollPane scrollPane = new JScrollPane(table);
              getContentPane().add(scrollPane);
         public static void main(String[] args)
              TableBasic frame = new TableBasic();
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              frame.pack();
              //frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    * CLASS BASED ON ColorRenderer.java at http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/ColorRenderer.java
    import javax.swing.BorderFactory;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.border.Border;
    import javax.swing.table.TableCellRenderer;
    //import java.awt.Color;
    import java.awt.Component;
    public class CalendarRenderer
         extends JLabel
         implements TableCellRenderer
         Border unselectedBorder = null;
         Border selectedBorder = null;
         boolean isBordered = true;
         public CalendarRenderer(boolean isBordered)
              this.isBordered = isBordered; setOpaque(true);
              //MUST do this for background to show up.
         public Component getTableCellRendererComponent(JTable table,
                                                                     Object color,
                                                                     boolean isSelected,
                                                                     boolean hasFocus,
                                                                     int row,
                                                                     int column)
              String newDate = (String)color;
              setText(newDate);
              if (isBordered)
                   if (isSelected)
                        if (selectedBorder == null)
                             selectedBorder = BorderFactory.createMatteBorder(2,5,2,5, table.getSelectionBackground());
                        setBorder(selectedBorder);
                   else
                        if (unselectedBorder == null)
                             unselectedBorder = BorderFactory.createMatteBorder(2,5,2,5, table.getBackground());
                        setBorder(unselectedBorder);
              //setToolTipText("RGB value: " + newColor.getRed() + ", " + newColor.getGreen() + ", " + newColor.getBlue());
              return this;
    * the editor based on ColorEditor.java at http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/ColorEditor.java
    import javax.swing.AbstractCellEditor;
    import javax.swing.table.TableCellEditor;
    import javax.swing.JButton;
    import javax.swing.JColorChooser;
    import javax.swing.JDialog;
    import javax.swing.JTable;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class ColorEditor
         extends AbstractCellEditor
         implements TableCellEditor, ActionListener
         Color currentColor;
         JButton button;
         JColorChooser colorChooser;
         JDialog dialog;
         protected static final String EDIT = "edit";
         public ColorEditor()
              //Set up the editor (from the table's point of view),
              //which is a button.
              //This button brings up the color chooser dialog,
              //which is the editor from the user's point of view.
              button = new JButton();
              button.setActionCommand(EDIT);
              button.addActionListener(this);
              button.setBorderPainted(false);
              //Set up the dialog that the button brings up.
              colorChooser = new JColorChooser();
              dialog = JColorChooser.createDialog(button,
                   "Pick a Color",
                   true, //modal
                   colorChooser,
                   this, //OK button handler
                   null); //no CANCEL button handler
          * Handles events from the editor button and from
          * the dialog's OK button.
         public void actionPerformed(ActionEvent e)
              if (EDIT.equals(e.getActionCommand()))
                   //The user has clicked the cell, so
                   //bring up the dialog.
                   button.setBackground(currentColor);
                   colorChooser.setColor(currentColor);
                   dialog.setVisible(true); //Make the renderer reappear.
                   fireEditingStopped();
              else
                   //User pressed dialog's "OK" button.
                   currentColor = colorChooser.getColor();
         //Implement the one CellEditor method that AbstractCellEditor doesn't.
         public Object getCellEditorValue()
              return currentColor;
         //Implement the one method defined by TableCellEditor.
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
              currentColor = (Color)value; return button;
    /** THE SIMPLE CALENDAR WRITTEN TALIORED TO WORK WITH DIALOGS*/
    import javax.swing.*;
    import java.util.Calendar;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.SimpleDateFormat;
    //import java.beans.*; //property change stuff
    public class CalendarDialog
         extends JDialog
         //implements PropertyChangeListener
         private JButton[] btn = new JButton[49];
         private int month = Calendar.getInstance().get(Calendar.MONTH);
         private int year = Calendar.getInstance().get(Calendar.YEAR);
         private JLabel lbl = new JLabel("", JLabel.CENTER);
         private JOptionPane optionPane;
         private String curDate = null;
         private JTextArea output = new JTextArea(curDate, 1, 20);
         private String btnString1 = "Enter";
         private String btnString2 = "Cancel";
         public CalendarDialog()
              //super(aFrame, true);
              setContentPane(buildGUI());
              setDates();
         public JPanel buildGUI()
              JPanel panel = new JPanel();
              String[] header = { "Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat" };
              JPanel midPanel = new JPanel(new GridLayout(7, 7));
              for (int x = 0; x < btn.length; x++)
                   final int selection = x;
                   btn[x] = new JButton();
                   btn[x].setFocusPainted(false);
                   if (x < 7)
                        JLabel lbl = new JLabel(header[x], JLabel.CENTER);
                        lbl.setFont(new Font("Lucida", Font.PLAIN, 10));
                        midPanel.add(lbl);
                   else
                        btn[x].addActionListener(new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  displayDatePicked(btn[selection].getActionCommand());
                        midPanel.add(btn[x]);
              JPanel lowPanel = new JPanel(new GridLayout(1, 3));
              JButton prevBtn = new JButton("<< Previous");
              prevBtn.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        month--;
                        setDates();
              lowPanel.add(prevBtn);
              lowPanel.add(lbl);
              lowPanel.add(output);
              JButton nextBtn = new JButton("Next >>");
              nextBtn.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        month++;
                        setDates();
              lowPanel.add(nextBtn);
              JPanel outputPanel = new JPanel();
              Object[] options = { btnString1, btnString2 };
              optionPane =
                   new JOptionPane(
                        output,
                        JOptionPane.QUESTION_MESSAGE,
                        JOptionPane.YES_NO_OPTION,
                        null,
                        options,
                        options[0]);
              outputPanel.add(optionPane);
              panel.setLayout(new BorderLayout());
              panel.add(lowPanel, BorderLayout.NORTH);
              panel.add(midPanel, BorderLayout.CENTER);
              panel.add(outputPanel, BorderLayout.SOUTH);
              return panel;
         public void setDates()
              for (int x = 7; x < btn.length; x++)
                   btn[x].setText("");
              SimpleDateFormat sdf = new SimpleDateFormat("MMMM yyyy");
              Calendar cal = Calendar.getInstance();
              cal.set(year, month, 1);
              int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
              int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
              for (int x = 6 + dayOfWeek, day = 1; day <= daysInMonth; x++, day++)
                   btn[x].setText("" + day);
              lbl.setText(sdf.format(cal.getTime()));
         public void displayDatePicked(String day)
              if (day.equals("") == false)
                   SimpleDateFormat sdf = new SimpleDateFormat("EEEE d MMMM, yyyy");
                   Calendar cal = Calendar.getInstance();
                   cal.set(year, month, Integer.parseInt(day));
                   curDate = sdf.format(cal.getTime());
                   //JOptionPane.showMessageDialog(this, "You picked " + sdf.format(cal.getTime()));
                   output.setText(sdf.format(cal.getTime()));
         public String getDate()
              return curDate;
         public void setDate(String date)
              curDate = date;
    }

    well, i have indeed narrowed down my problem after some digging around.. one thing i discovered that i don't need CalendarRenderer.java.. and i found out i don't really know what does
    //Implement the one method defined by TableCellEditor.
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
              curDate = (String)value; return button;
         }do, as it seems to be the problem:
    java.lang.ClassCastException
         at CalendarEditor.getTableCellEditorComponent(CalendarEditor.java:78)
         at javax.swing.JTable.prepareEditor(JTable.java:3786)
         at javax.swing.JTable.editCellAt(JTable.java:2531)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.adjustFocusAndSelection(BasicTableUI.java:510)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(BasicTableUI.java:494)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3195)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    mmm.. does anyone know what i should modify for that to work?

  • NetBeans plugin broken in 3.1.0RC2

    Hi,
    I downloaded 3.1.0RC2 and installed it in my NetBeans/SunONE Studio IDE
    and am having a problem.
    It starts up OK, but when I go into Tools->Options and try to view the
    JDO->Kodo Settings, I get an exception (included below).
    I had a problem similar to this once before that you helped me work
    through, so I tried the same thing you suggested then but it had no effect.
    1. Disable the Kodo module.
    2. Exit IDE.
    3. Remove kodo-jdo.jar from the studio5_se/modules directory (was 3.0.3).
    4. Restart the IDE. Check in Tools->Options...no more JDO.
    5. Exit the IDE.
    6. Copy the 3.1.0RC2 kodo-jdo.jar into the studio5_se/modules directory.
    7. Restart the IDE.
    Any ideas?
    Thanks,
    Bill
    java.lang.IllegalArgumentException:
    java.lang.reflect.InvocationTargetException
         at
    org.openide.util.SharedClassObject.findObject(SharedClassObject.java:452)
         at
    org.openide.util.SharedClassObject$WriteReplace.readObject(SharedClassObject.java:643)
         at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
         at
    java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         at
    org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.readSerial(XMLSettingsSupport.java:522)
         at
    org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate(XMLSettingsSupport.java:550)
         at
    org.netbeans.modules.settings.convertors.SerialDataConvertor$SettingsInstance.instanceCreate(SerialDataConvertor.java:325)
         at
    org.netbeans.modules.settings.convertors.SerialDataNode$InstanceChildren.init(SerialDataNode.java:859)
         at
    org.netbeans.modules.settings.convertors.SerialDataNode$InstanceChildren.addNotify(SerialDataNode.java:837)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at
    org.openide.explorer.view.VisualizerNode.getChildren(VisualizerNode.java:169)
         at
    org.openide.explorer.view.VisualizerNode.getChildCount(VisualizerNode.java:213)
         at
    javax.swing.tree.DefaultTreeModel.getChildCount(DefaultTreeModel.java:168)
         at
    javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1461)
         at
    javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
         at
    javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(VariableHeightLayoutCache.java:966)
         at
    javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableHeightLayoutCache.java:164)
         at
    javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(BasicTreeUI.java:1494)
         at
    javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(BasicTreeUI.java:2314)
         at javax.swing.JTree.fireTreeExpanded(JTree.java:2228)
         at javax.swing.JTree.setExpandedState(JTree.java:2999)
         at javax.swing.JTree.expandPath(JTree.java:1735)
         at
    javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2095)
         at
    javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2082)
         at
    javax.swing.plaf.basic.BasicTreeUI.checkForClickInExpandControl(BasicTreeUI.java:2036)
         at
    javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(BasicTreeUI.java:2831)
         at
    javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTreeUI.java:2801)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at
    org.openide.explorer.view.TreeTable$TreeTableCellEditor.isCellEditable(TreeTable.java:519)
         at javax.swing.JTable.editCellAt(JTable.java:2530)
         at org.openide.explorer.view.TreeTable.editCellAt(TreeTable.java:204)
         at
    org.openide.explorer.view.TreeTable$TreeTableUI$TreeTableMouseInputHandler.processMouseEvent(TreeTable.java:933)
         at
    org.openide.explorer.view.TreeTable$TreeTableUI$TreeTableMouseInputHandler.mousePressed(TreeTable.java:850)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3195)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    ==>
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at
    org.openide.util.SharedClassObject.createInstancePrivileged(SharedClassObject.java:532)
         at
    org.openide.util.SharedClassObject$SetAccessibleAction.run(SharedClassObject.java:907)
         at java.security.AccessController.doPrivileged(Native Method)
         at
    org.openide.util.SharedClassObject.findObject(SharedClassObject.java:449)
         at
    org.openide.util.SharedClassObject$WriteReplace.readObject(SharedClassObject.java:643)
         at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
         at
    java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         at
    org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.readSerial(XMLSettingsSupport.java:522)
         at
    org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate(XMLSettingsSupport.java:550)
         at
    org.netbeans.modules.settings.convertors.SerialDataConvertor$SettingsInstance.instanceCreate(SerialDataConvertor.java:325)
         at
    org.netbeans.modules.settings.convertors.SerialDataNode$InstanceChildren.init(SerialDataNode.java:859)
         at
    org.netbeans.modules.settings.convertors.SerialDataNode$InstanceChildren.addNotify(SerialDataNode.java:837)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at
    org.openide.explorer.view.VisualizerNode.getChildren(VisualizerNode.java:169)
         at
    org.openide.explorer.view.VisualizerNode.getChildCount(VisualizerNode.java:213)
         at
    javax.swing.tree.DefaultTreeModel.getChildCount(DefaultTreeModel.java:168)
         at
    javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1461)
         at
    javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
         at
    javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(VariableHeightLayoutCache.java:966)
         at
    javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableHeightLayoutCache.java:164)
         at
    javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(BasicTreeUI.java:1494)
         at
    javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(BasicTreeUI.java:2314)
         at javax.swing.JTree.fireTreeExpanded(JTree.java:2228)
         at javax.swing.JTree.setExpandedState(JTree.java:2999)
         at javax.swing.JTree.expandPath(JTree.java:1735)
         at
    javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2095)
         at
    javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2082)
         at
    javax.swing.plaf.basic.BasicTreeUI.checkForClickInExpandControl(BasicTreeUI.java:2036)
         at
    javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(BasicTreeUI.java:2831)
         at
    javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTreeUI.java:2801)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at
    org.openide.explorer.view.TreeTable$TreeTableCellEditor.isCellEditable(TreeTable.java:519)
         at javax.swing.JTable.editCellAt(JTable.java:2530)
         at org.openide.explorer.view.TreeTable.editCellAt(TreeTable.java:204)
         at
    org.openide.explorer.view.TreeTable$TreeTableUI$TreeTableMouseInputHandler.processMouseEvent(TreeTable.java:933)
         at
    org.openide.explorer.view.TreeTable$TreeTableUI$TreeTableMouseInputHandler.mousePressed(TreeTable.java:850)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3195)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Caused by: java.lang.NoClassDefFoundError: javax/management/MBeanServer
         at java.lang.Class.getDeclaredMethods0(Native Method)
         at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
         at java.lang.Class.getDeclaredMethods(Class.java:1131)
         at java.beans.Introspector$1.run(Introspector.java:1126)
         at java.security.AccessController.doPrivileged(Native Method)
         at
    java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1124)
         at java.beans.Introspector.internalFindMethod(Introspector.java:1157)
         at java.beans.Introspector.findMethod(Introspector.java:1232)
         at java.beans.Introspector.findMethod(Introspector.java:1212)
         at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:55)
         at
    com.solarmetric.conf.ConfigurationImpl.getPropertyDescriptor(ConfigurationImpl.java:232)
         at
    com.solarmetric.conf.ConfigurationImpl.getPropertyDescriptors(ConfigurationImpl.java:195)
         at
    kodo.jdbc.integration.netbeans.SubSettingsHelper.generateOptions(SubSettingsHelper.java:38)
         at
    kodo.jdbc.integration.netbeans.SubSettingsHelper.generateOptions(SubSettingsHelper.java:29)
         at
    kodo.jdbc.integration.netbeans.KodoSettings.<init>(KodoSettings.java:64)
    [catch] ... 111 more
    ==>
    java.lang.NoClassDefFoundError: javax/management/MBeanServer
         at java.lang.Class.getDeclaredMethods0(Native Method)
         at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
         at java.lang.Class.getDeclaredMethods(Class.java:1131)
         at java.beans.Introspector$1.run(Introspector.java:1126)
         at java.security.AccessController.doPrivileged(Native Method)
         at
    java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1124)
         at java.beans.Introspector.internalFindMethod(Introspector.java:1157)
         at java.beans.Introspector.findMethod(Introspector.java:1232)
         at java.beans.Introspector.findMethod(Introspector.java:1212)
         at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:55)
         at
    com.solarmetric.conf.ConfigurationImpl.getPropertyDescriptor(ConfigurationImpl.java:232)
         at
    com.solarmetric.conf.ConfigurationImpl.getPropertyDescriptors(ConfigurationImpl.java:195)
         at
    kodo.jdbc.integration.netbeans.SubSettingsHelper.generateOptions(SubSettingsHelper.java:38)
         at
    kodo.jdbc.integration.netbeans.SubSettingsHelper.generateOptions(SubSettingsHelper.java:29)
         at
    kodo.jdbc.integration.netbeans.KodoSettings.<init>(KodoSettings.java:64)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at
    org.openide.util.SharedClassObject.createInstancePrivileged(SharedClassObject.java:532)
         at
    org.openide.util.SharedClassObject$SetAccessibleAction.run(SharedClassObject.java:907)
         at java.security.AccessController.doPrivileged(Native Method)
         at
    org.openide.util.SharedClassObject.findObject(SharedClassObject.java:449)
         at
    org.openide.util.SharedClassObject$WriteReplace.readObject(SharedClassObject.java:643)
         at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
         at
    java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         at
    org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.readSerial(XMLSettingsSupport.java:522)
         at
    org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate(XMLSettingsSupport.java:550)
         at
    org.netbeans.modules.settings.convertors.SerialDataConvertor$SettingsInstance.instanceCreate(SerialDataConvertor.java:325)
         at
    org.netbeans.modules.settings.convertors.SerialDataNode$InstanceChildren.init(SerialDataNode.java:859)
         at
    org.netbeans.modules.settings.convertors.SerialDataNode$InstanceChildren.addNotify(SerialDataNode.java:837)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at org.openide.nodes.FilterNode$ChildrenAdapter.run(FilterNode.java:1169)
         at org.openide.nodes.FilterNode$Children.updateKeys(FilterNode.java:1126)
         at
    org.openide.nodes.FilterNode$Children.addNotifyImpl(FilterNode.java:1023)
         at org.openide.nodes.FilterNode$Children.addNotify(FilterNode.java:1015)
         at org.openide.nodes.Children.callAddNotify(Children.java:420)
         at org.openide.nodes.Children.getArray(Children.java:463)
         at org.openide.nodes.Children.getNodes(Children.java:316)
         at
    org.openide.explorer.view.VisualizerNode.getChildren(VisualizerNode.java:169)
         at
    org.openide.explorer.view.VisualizerNode.getChildCount(VisualizerNode.java:213)
         at
    javax.swing.tree.DefaultTreeModel.getChildCount(DefaultTreeModel.java:168)
         at
    javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1461)
         at
    javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
         at
    javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(VariableHeightLayoutCache.java:966)
         at
    javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableHeightLayoutCache.java:164)
         at
    javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(BasicTreeUI.java:1494)
         at
    javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeExpanded(BasicTreeUI.java:2314)
         at javax.swing.JTree.fireTreeExpanded(JTree.java:2228)
         at javax.swing.JTree.setExpandedState(JTree.java:2999)
         at javax.swing.JTree.expandPath(JTree.java:1735)
         at
    javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2095)
         at
    javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2082)
         at
    javax.swing.plaf.basic.BasicTreeUI.checkForClickInExpandControl(BasicTreeUI.java:2036)
         at
    javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(BasicTreeUI.java:2831)
         at
    javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTreeUI.java:2801)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at
    org.openide.explorer.view.TreeTable$TreeTableCellEditor.isCellEditable(TreeTable.java:519)
         at javax.swing.JTable.editCellAt(JTable.java:2530)
         at org.openide.explorer.view.TreeTable.editCellAt(TreeTable.java:204)
         at
    org.openide.explorer.view.TreeTable$TreeTableUI$TreeTableMouseInputHandler.processMouseEvent(TreeTable.java:933)
         at
    org.openide.explorer.view.TreeTable$TreeTableUI$TreeTableMouseInputHandler.mousePressed(TreeTable.java:850)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3195)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    Abe,
    Yep, that was it. Actually, I noticed that there are actually five new
    JARs in 3.1.0 that weren't in 3.0.3:
    jline.jar
    mx4j-admb.jar
    mx4j-jmx.jar
    mx4j-tools.jar
    sqlline.jar
    I also see that jakarta-commons-logging-1.0.3.jar & log4j-1.2.6.jar which
    were in 3.0.3 are not in 3.1.0.
    Are these differences explained in the release notes (I admit, I didn't
    even look at them blush).
    Thanks!
    Bill
    Abe White wrote:
    The base exception appears to be:
    java.lang.NoClassDefFoundError: javax/management/MBeanServer
    Try including the mx4j-* jar files in your classpath.

  • MouseMotionListener Problem (Java 5&6)

    Hallo all,
    I am sorry I cannot send any codes right now but I have a problem. I have several components in my application and what I want to do is that when my cursor moves from my JTable it must set the first cell (0,0) editable so that when I try to focus on that table via TAB it can focus the first cell. I try to do this via MouseMotionListener but I want to know how I can make it know that the cursor has left the component area. I hope you could understand my problem.

    A MouseListener has mouseEntered and mouseExited methods, so you can use those, however it is a separate issue whether you wish to give focus to the table when the mouse enters it. Reminds me of some X-windows window managers that can do that with top-level windows...
    Anyway, may be you want to have a focus listener on the table and start cell editing when the table gains the focus (JTable.editCellAt()). You'll need to be careful when the editor component itself loses focus (when editing stops) as the table will gain it again at this time. May be check the component losing the focus to trap this case.

  • EditCellAt() with mouseclick is not working for first row of the jtable

    Hi All,
    I have extended JTable.changeSelection() & editCellAt() methods to force the text to select when focus is brought to the cell.
    I have a page which has both editable and non-editable columns. when I do a mouse click on FIRST ROW of the editable cell and type the value, The value is not displayed in the cell. when I click on any other editable field in the page, The typed value is displayed in the cell. In the first row of the cell, only the first attempt is not working. When I remove the editCellAt() call in changeSelection(), it works as expected.
    But, If I reach the FIRST ROW editable cell using TAB key instead of Mouse click and type the value, its working fine.
    Kindly suggest me what could be the problem in my code. I think something wrong in editcellat() or mouseclicked/released or focusgained in our versions of JTable or jtextfield.
    Kindly let me know if you need any more functions of my version of implementation.
    Thanks In advance.
    My JTable Version of editCellAt:
         public boolean editCellAt(int row, int column, EventObject e) {
              try {
                   if (getCellEditor() != null && !getCellEditor().stopCellEditing()) {
                        return false;
                   if (!isCellEditable(row, column)) {
                        return false;
                   if (isShowStarRow() /*&& !starRowAdded*/) {
                        VSDataControl ds = getDataSource();
                        if (ds != null) {
                             VSResultSet rs = ds.getResultSet();
                             if (rs != null) {
                                  if (row == rs.getRowCount()) { // This is the star row
                                       // Go to the last record
                                       if (row > 0) {
                                            try {
                                                 rs.getRowAt(row + 1, true);
                                                 rs.last();
                                            } catch (Exception ex) {
                                                 return false;
                                       if (ds.insert() == null) {
                                            return false;
                                       currentRow = row + 1;
                                       starRowAdded = true;
                   TableCellEditor editor = getCellEditor(row, column);
                   if (editor != null && editor.isCellEditable(e)) {
                        editorComp = prepareEditor(editor, row, column);
                        if ( editorComp instanceof VSGridChoice && lastKeyEvent != null ) {
                             VSGridChoice choice = (VSGridChoice) editorComp;
                             choice.handleMissingCharEvent( lastKeyEvent );
                        if (editorComp instanceof VSChoiceBase && lastKeyEvent != null ) {
                             VSChoiceBase hack = (VSChoiceBase)editorComp;
                             hack.addMissingChar(lastKeyEvent);
                        lastKeyEvent = null;
                        if (editorComp == null) {
                             removeEditor();
                             return false;
                        editorComp.setBounds(getCellRect(row, column, false));
                        add(editorComp);
                        editorComp.validate();
                        editorComp.requestFocus();
                        setCellEditor(editor);
                        setEditingRow(row);
                        setEditingColumn(column);
                        editor.addCellEditorListener(this);
                        return true;
                   return false;
              } catch (Exception ex) {
                   showValidationError(e, ex);
                   return false;
         public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
              super.changeSelection(rowIndex, columnIndex, toggle, extend);
                    editCellAt(rowIndex, columnIndex);
                           if (getEditorComponent() != null)
                   if (getEditorComponent() instanceof CustomJTextField)
                        ((CustomJTextField)getEditorComponent()).selectAll();
          }

    i will suggest you to override your requetFocus()
    like.
    public void requestFocus()
            super.requestFocus(); // may be panel or container.
            textPane.setSelectionStart(0); // textpane is the editor for the cell.
            textPane.setSelectionEnd(textPane.getText().length());
        } Gud luck.

  • Java.awt.IllegalComponentStateException in JTable

    Hi folks,
    I am trying to write a JTable cell validation. Input data in a cell, if failure, prompt message and set focus & editing back to the cell. I've tried InputVerifier() but it doesn't work since I can easily use the mouse click to shift to other cells in the same table.
    What I am trying to do now is to define my DefaultCellEditor. I record the row & index position when getting focus. In the lost focus event, do the validation and set the focus & editing back if failure. Seems it works fine. However, when I randomly click different cells in the table quickly. It prompts:
    "java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location"
    Here is my stack dump:
         at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1487)
         at java.awt.Component.getLocationOnScreen(Component.java:1461)
         at javax.swing.Autoscroller.mouseDragged(Autoscroller.java:79)
         at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2759)
         at java.awt.Component.processEvent(Component.java:4822)
         at java.awt.Container.processEvent(Container.java:1525)
         at java.awt.Component.dispatchEventImpl(Component.java:3526)
         at java.awt.Container.dispatchEventImpl(Container.java:1582)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.repostEvent(BasicTableUI.java:475)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mouseDragged(BasicTableUI.java:554)
         at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:258)
         at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:257)
         at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:257)
         at java.awt.Component.processMouseMotionEvent(Component.java:5069)
         at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2763)
         at java.awt.Component.processEvent(Component.java:4822)
         at java.awt.Container.processEvent(Container.java:1525)
         at java.awt.Component.dispatchEventImpl(Component.java:3526)
         at java.awt.Container.dispatchEventImpl(Container.java:1582)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3091)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
         at java.awt.Container.dispatchEventImpl(Container.java:1568)
         at java.awt.Window.dispatchEventImpl(Window.java:1581)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:191)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
    Also, enclosed is my modified DefaultCellEditor class. Your input will be greatly appreicated. Thanks.
    class NewDefaultCellEditor extends DefaultCellEditor {
    public NewDefaultCellEditor(JTextField jTextField) {
    super(jTextField);
    this.setClickCountToStart(1);
    jTextField.addFocusListener(new FocusAdapter() {
    JTable tbl;
    int row;
    int column;
    public void focusGained(FocusEvent e) {
    tbl = (JTable)((JTextField)e.getSource()).getParent();
    row = tbl.getEditingRow();
    column = tbl.getEditingColumn();
    public void focusLost(FocusEvent e) {
    /*** Put validation here, execute the following if failed ***/
    tbl.editCellAt(row, column);
    ((JTextField)e.getSource()).requestFocus();

    Your use in a JTable isn't too clear to me, but I feel you're overthinking the basic requirement:
    I have an extended JComboBox which is meant to display its information only. Thus it
    - does not allow any selection
    - shows the first item of the list in the TextField only and not once more in the listI don't see the need for duplicating the model and using a popup menu listener.
    import java.awt.Component;
    import javax.swing.*;
    public class DisplayOnlyComboBoxDemo {
      public static void main(String[] args) throws Exception {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            new DisplayOnlyComboBoxDemo().makeUI();
      public void makeUI() {
        JFrame frame = new JFrame();
        frame.add(new DisplayOnlyComboBox("One", new String[]{"Two", "Three", "Four", "Five"}));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    class DisplayOnlyComboBox extends JComboBox {
      private String firstItem;
      public DisplayOnlyComboBox(String firstItem, String[] items) {
        super(items);
        this.firstItem = firstItem;
        setRenderer(new DefaultListCellRenderer() {
          @Override
          public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (index == -1) {
              setText(DisplayOnlyComboBox.this.firstItem);
            return this;
    }db

  • 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.

  • Need Help: JTable POP up menu in a CellEditor to display on a right click

    This was from a previous post:
    I am trying to make a POP menu in a JTextComponent that has a assigned JEditorPane for a HTMLDocument to make use of the HTMLEditorKit to allow modifying HTML by the POP up menu.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.table.*;
    import javax.swing.text.html.*;
    import javax.swing.undo.*;
    import javax.swing.border.*;
    import javax.swing.filechooser.*;
    public class SimpleTableDemo extends JFrame {
        public SimpleTableDemo() throws Exception {
            final JTable table = new JTable(new MyTableModel());
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            TableColumn fileColumn = table.getColumnModel().getColumn(2);
            FileTableCellEditor editor = new FileTableCellEditor();
            fileColumn.setCellRenderer(editor);
            fileColumn.setCellEditor(editor);
            JScrollPane scrollPane = new JScrollPane(table);
            getContentPane().add(scrollPane, BorderLayout.CENTER);
            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                System.exit(0);
                table.setRowHeight(100);
            public static void main(String[] args) throws Exception {
                SimpleTableDemo frame = new SimpleTableDemo();
                frame.pack();
                frame.setVisible(true);
            class MyTableModel extends AbstractTableModel {
                String[] columnNames = {"First Name","Last Name","HTML File"};
                public Object[][] data;
                MyTableModel() throws Exception
                    data = createArray();
                private Object[][] createArray() throws Exception
                    Object[][] data = {{"One", "Andrews", createDoc("file1.html")}
                return data;
                private Document createDoc(String url) throws Exception
                    File file = new File(url);
                    URL baseURL = file.toURL();
                    InputStream in = baseURL.openStream();
                    InputStreamReader r = new InputStreamReader(filterTag(in));
                    HTMLEditorKit kit = new HTMLEditorKit();
                Document doc = kit.createDefaultDocument();
                kit.read(r,doc,0);
                return doc;
                } // workaround for HTMLEditorKit.Parser, cant deal with "content-encoding"
                private InputStream filterTag(InputStream in) throws IOException {
                    DataInputStream dins = new DataInputStream( in);
                    ByteArrayOutputStream bos = new ByteArrayOutputStream(10000);
                    DataInputStream din = new DataInputStream(new BufferedInputStream(in));
                    while (din.available() > 0) {
                    String line = din.readLine();
                    String lline = line.toLowerCase();
                    if (0 <= lline.indexOf("<meta ")) // skip meta tags
                    continue;
                    bos.write( line.getBytes());
                    din.close();
                    return new ByteArrayInputStream( bos.toByteArray());
                public int getColumnCount() {
                    return columnNames.length;
                public int getRowCount() {
                    return data.length;
                public String getColumnName(int col) {
                    return columnNames[col];
                public Object getValueAt(int row, int col) {
                    return data[row][col];
                public Class getColumnClass(int c) {
                    return getValueAt(0, c).getClass();
                public boolean isCellEditable(int row, int col) {
                if (col >< 1) {
                    return false;
                } else {
                    return true;
    public class FileTableCellEditor extends JScrollPane implements TableCellEditor , TableCellRenderer
        public JTextComponent jtext;
        JEditorPane editor;
        HTMLEditorKit kit = new HTMLEditorKit();
        HTMLDocument doc = new HTMLDocument();;
        private EventListenerList listenerList = new EventListenerList();
        private ChangeEvent event = new ChangeEvent(this);
        public FileTableCellEditor()
        editor = new JEditorPane();
        editor.setContentType("text/html");
        doc=new HTMLDocument();
        editor.addMouseListener(new MouseHandler());
        editor.setEditorKit(kit);
        editor.setDocument(doc);
        editor.setEditable(true);
        editor.setCaretColor(Color.RED);
        getViewport().setView(editor);
        setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column)
            // System.out.println("has focus: "+hasFocus+", isSelected: "+isSelected);
            if (isSelected)
            table.editCellAt(row,column);
        table.editCellAt(row,column);
        return getTableCellEditorComponent(table,value,isSelected, row, column);
        public Component getTableCellEditorComponent(JTable table,
        Object value, boolean isSelected, int row, int column)
        editor.setDocument((Document)value);
        return this;
        public boolean isCellEditable(EventObject anEvent)
        { return true;
        public boolean shouldSelectCell(EventObject anEvent)
        { return true;
        public void cancelCellEditing()
        { fireEditingStopped();
        public boolean stopCellEditing()
        { return true;
        public Object getCellEditorValue()
        { return null;
        public void addCellEditorListener(CellEditorListener l)
        { listenerList.add(CellEditorListener.class, l);
        public void removeCellEditorListener(CellEditorListener l)
        { listenerList.remove(CellEditorListener.class, l);
        protected void fireEditingStopped()
        { Object[] listeners = listenerList.getListenerList();
        for (int i = listeners.length - 2; i >= 0; i -= 2)
        ((CellEditorListener)listeners[i+1]).
        editingStopped(event);
        protected void fireEditingCanceled()
        { Object[] listeners = listenerList.getListenerList();
        for (int i = listeners.length - 2; i >= 0; i -= 2)
        ((CellEditorListener)listeners[i+1]).
        editingCanceled(event);
            ///////////createPopupMenu///////////////
            protected JPopupMenu createPopupMenu()
            JPopupMenu popup =new JPopupMenu();
            popup.add(getTextComponent().getActionMap().get(HTMLEditorKit.cutAction)).setAccelerator(null);
            popup.add(getTextComponent().getActionMap().get(HTMLEditorKit.copyAction)).setAccelerator(null);
            popup.add(getTextComponent().getActionMap().get(HTMLEditorKit.pasteAction)).setAccelerator(null);
            popup.addSeparator();
            popup.add(getTextComponent().getActionMap().get("font-bold"));
            popup.add(getTextComponent().getActionMap().get("font-italic"));
            popup.add(getTextComponent().getActionMap().get("font-underline"));
            //popup.add(getTextComponent().getActionMap().get("break"));
            return popup;
        public JTextComponent getTextComponent()
             return jtext;
        protected class MouseHandler extends MouseAdapter{
           public void mouseReleased(MouseEvent me){
               if(me.getButton()==MouseEvent.BUTTON3){
               Point p=me.getPoint();
               createPopupMenu().show((Component)me.getSource(),p.x,p.y);
    }

    I got the pop up to work, I had to go back to and add a createActionTable editor that is a JEditorPane, vs the JTextComponent!
    Here is the latest version:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.HashMap;
    import javax.swing.*;
    import javax.swing.undo.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.table.*;
    import javax.swing.text.html.*;
    import javax.swing.undo.*;
    import javax.swing.border.*;
    import javax.swing.filechooser.*;
    public class SimpleTableDemo extends JFrame {
        public SimpleTableDemo() throws Exception {
            final JTable table = new JTable(new MyTableModel());
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            TableColumn fileColumn = table.getColumnModel().getColumn(2);
            FileTableCellEditor editor = new FileTableCellEditor();
            fileColumn.setCellRenderer(editor);
            fileColumn.setCellEditor(editor);
            JScrollPane scrollPane = new JScrollPane(table);
            getContentPane().add(scrollPane, BorderLayout.CENTER);
            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                System.exit(0);
                table.setRowHeight(100);
            public static void main(String[] args) throws Exception {
                SimpleTableDemo frame = new SimpleTableDemo();
                frame.pack();
                frame.setVisible(true);
            class MyTableModel extends AbstractTableModel {
                String[] columnNames = {"First Name","Last Name","HTML File"};
                public Object[][] data;
                MyTableModel() throws Exception
                    data = createArray();
                private Object[][] createArray() throws Exception
                    Object[][] data = {{"One", "Andrews", createDoc("file1.html")}
                return data;
                private Document createDoc(String url) throws Exception
                    File file = new File(url);
                    URL baseURL = file.toURL();
                    InputStream in = baseURL.openStream();
                    InputStreamReader r = new InputStreamReader(filterTag(in));
                    HTMLEditorKit kit = new HTMLEditorKit();
                Document doc = kit.createDefaultDocument();
                kit.read(r,doc,0);
                return doc;
                } // workaround for HTMLEditorKit.Parser, cant deal with "content-encoding"
                private InputStream filterTag(InputStream in) throws IOException {
                    DataInputStream dins = new DataInputStream( in);
                    ByteArrayOutputStream bos = new ByteArrayOutputStream(10000);
                    DataInputStream din = new DataInputStream(new BufferedInputStream(in));
                    while (din.available() > 0) {
                    String line = din.readLine();
                    String lline = line.toLowerCase();
                    if (0 <= lline.indexOf("<meta ")) // skip meta tags
                    continue;
                    bos.write( line.getBytes());
                    din.close();
                    return new ByteArrayInputStream( bos.toByteArray());
                public int getColumnCount() {
                    return columnNames.length;
                public int getRowCount() {
                    return data.length;
                public String getColumnName(int col) {
                    return columnNames[col];
                public Object getValueAt(int row, int col) {
                    return data[row][col];
                public Class getColumnClass(int c) {
                    return getValueAt(0, c).getClass();
                public boolean isCellEditable(int row, int col) {
                if (col < 1) {
                    return false;
                } else {
                    return true;
    public class FileTableCellEditor extends JScrollPane implements TableCellEditor , TableCellRenderer
        JEditorPane editor = new JEditorPane();
        HTMLEditorKit kit = new HTMLEditorKit();
        HTMLDocument doc = new HTMLDocument();;
        private EventListenerList listenerList = new EventListenerList();
        private ChangeEvent event = new ChangeEvent(this);
        HashMap<Object, Action> actions;
        public FileTableCellEditor()
        getContentPane();
        editor.setContentType("text/html");
        doc=new HTMLDocument();
        editor.addMouseListener(new MouseHandler());
        editor.setEditorKit(kit);
        editor.setDocument(doc);
        editor.setEditable(true);
        editor.setCaretColor(Color.RED);
        getViewport().setView(editor);
        createActionTable(editor);
        makeActionsPretty();
        setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        public void makeActionsPretty(){
             Action a;
                      a=editor.getActionMap().get(HTMLEditorKit.cutAction);
                      a.putValue(Action.SHORT_DESCRIPTION,"Cut");
                      a.putValue(Action.ACCELERATOR_KEY,KeyStroke.getKeyStroke('X',Event.CTRL_MASK));
                      a=editor.getActionMap().get(HTMLEditorKit.copyAction);
                      a.putValue(Action.NAME,"Copy");
                      a.putValue(Action.SHORT_DESCRIPTION,"Copy");
                      a.putValue(Action.ACCELERATOR_KEY,KeyStroke.getKeyStroke('C',Event.CTRL_MASK));
                      a=editor.getActionMap().get(HTMLEditorKit.pasteAction);
                      a.putValue(Action.NAME,"Paste");
                      a.putValue(Action.SHORT_DESCRIPTION,"Paste");
                      a.putValue(Action.ACCELERATOR_KEY,KeyStroke.getKeyStroke('V',Event.CTRL_MASK));
        public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column)
            if (isSelected)
            table.editCellAt(row,column);
        table.editCellAt(row,column);
        return getTableCellEditorComponent(table,value,isSelected, row, column);
        public Component getTableCellEditorComponent(JTable table,
        Object value, boolean isSelected, int row, int column)
        editor.setDocument((Document)value);
        return this;
        public boolean isCellEditable(EventObject anEvent)
        { return true;
        public boolean shouldSelectCell(EventObject anEvent)
        { return true;
        public void cancelCellEditing()
        { fireEditingStopped();
        public boolean stopCellEditing()
        { return true;
        public Object getCellEditorValue()
        { return null;
        public void addCellEditorListener(CellEditorListener l)
        { listenerList.add(CellEditorListener.class, l);
        public void removeCellEditorListener(CellEditorListener l)
        { listenerList.remove(CellEditorListener.class, l);
        protected void fireEditingStopped()
        { Object[] listeners = listenerList.getListenerList();
        for (int i = listeners.length - 2; i >= 0; i -= 2)
        ((CellEditorListener)listeners[i+1]).
        editingStopped(event);
        protected JPopupMenu createPopupMenu()
            JPopupMenu popup =new JPopupMenu();
            popup.add(getActionByName(DefaultEditorKit.cutAction));
            return popup;
        protected class MouseHandler extends MouseAdapter{
           public void mouseReleased(MouseEvent me){
               if(me.getButton()==MouseEvent.BUTTON3){
               Point p=me.getPoint();
               createPopupMenu().show((Component)me.getSource(),p.x,p.y);
        private void createActionTable(JTextComponent textComponent) {
            actions = new HashMap<Object, Action>();
            Action[] actionsArray = textComponent.getActions();
            for (int i = 0; i < actionsArray.length; i++) {
                Action a = actionsArray;
    actions.put(a.getValue(Action.NAME), a);
    private Action getActionByName(String name) {
    return actions.get(name);

  • Intercepting editing start and stop/cancel in a JTable

    Hi,
    I've been seaching the forum for days but could not find anything that solved my problem.
    Problem:
    I'm writing a multiclient server. The data of the server is displayed in a JTable. The rows(cells) in the table is editable and to make sure no two clients edit the same row at the same time I've implemented a locking mechanism in the server and would like to lock a row whenever a user starts editing and release the lock when the user either stops or cancels editing.
    The JTable is 'hooked up' with a TableModel class that I've written to handle the locking and notification of the lock and unlock events from the server.
    I've tried a couple of things but non worked very good. It would be nice if the CellEditorListener implemented a startEditing but it does not so letting my model implement the interface was no good.
    Any ideas? If anyone knows how to solve this, please reply
    Yours, Johan

    Playing around with some methods in JTable, and some minimal testing, I came up with:
    table = new JTable(...)
         private int editingRow = -1;
         public  boolean editCellAt(int row, int column, EventObject e)
              boolean editingCell = super.editCellAt(row, column, e);
              if (isEditing())
                   editingRow = row;
                   System.out.println("started");
              return editingCell;
         public void removeEditor()
              if (isEditing())
                   editingRow = -1;
                   System.out.println("stopped");
              super.removeEditor();
    };

  • Using a JPanel as cell editor in JTable

    I have a composite component (JPanel that contains a JTextField and a
    JButton) that I would like to use as the a cell editor in a JTable.The JButton instantiates a UI editor component that I have designed. Example would be date editor for dates, tet editor for strings etc. This editor allows the user to select a date to populate the JTextField (the date may also be manually entered).
    I have no problem with the rendering of the component within the table.However, I would like for the JTextField embedded within the JPanel to receive focus and a visible caret, when using the tab key to navigate to the cell. After reading through some of the posts here , I was able to transfer the focus. But I dont see a visible caret. I am unable to edit. I have to click on the text box and then start typing. Its a great pain in the ass.
    I have a custom designed table and custom designed editor. Code is attached...
    <pre>
    protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,int condition, boolean pressed) {
    final int selRow = getSelectedRow();
    final int rowCount = getRowCount();
    final int selCol = getSelectedColumn();
    final EventObject obj = (EventObject) e;
    if (selRow == -1) {
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {           
    changeSelection(0, 1, false, false);
    editCellAt(0, 1, obj);
    boolean isSelected = false;
    if ((ks == KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0)) ||
    (ks == KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0))) {     
    if (selCol == 1) {
    isSelected= getCellEditor(selRow,selCol).stopCellEditing();
    targetRow = (selRow + 1) % rowCount;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {           
    if (editCellAt(targetRow, 1, obj)) {
    changeSelection(targetRow, 1, false, false);
    getComponentAt(targetRow, 1).requestFocus();
    } else {
    getCellEditor(selRow, selCol).shouldSelectCell(obj);
    return super.processKeyBinding(ks,e,condition,pressed);
    </pre>
    Relevant code of my custom editor is below....
    public Component getTableCellEditorComponent(JTable table,
    Object value, boolean isSelected, int row, int column) {
    lastEditedRow = row;
    lastEditedCol = column;
    lastEditedTable = table;
    lastEditedValue = value;
    val = value;
    ((JTextField)editorComponent).
    setText(val == null ? "" : val.toString());
    setClickCountToStart(1);
    if (value instanceof CycCollectionChooserModel) {
    String collection = ((CycCollectionChooserModel)value).
    getCollection().cyclify();
    button.setVisible(EditorForCollectionMap.hasUIEditor(collection));
    button.setMargin (new Insets (1,1,1,1));
    button.setIconTextGap(0);
    buttonListener.model = (CycCollectionChooserModel)value;
    buttonListener.rowIndex = row;
    buttonListener.localTable = table;
    return panel;
    public boolean isCellEditable(EventObject evt) {
    if (evt instanceof MouseEvent) {
    int clickCount;
    clickCount = 1;
    return ((MouseEvent)evt).getClickCount() >= clickCount;
    return super.isCellEditable(evt);
    public boolean stopCellEditing() {   
    if (super.stopCellEditing()) {
    final int targetRow = (lastEditedRow+1)%lastEditedTable.getRowCount();
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {           
    lastEditedTable.changeSelection(targetRow, 1, false, false);
    lastEditedTable.getComponentAt(targetRow, 1).requestFocus();
    return true;
    return false;
    Does any one know why I am not able to see the caret? Any insights you have will be most welcome.
    Thanks in advance,
    Praveen.

    Almost solved the problem. Navigation through Tab key, up/ down arrow, Enter key works for text boxes. Navigation through Tab Key, Up/down arrow works for combo boxes. But for "Enter" key it doesnt. Changes in code ....
    (I have added a key listener to my editor class)
    <pre>
    protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,int condition, boolean pressed) {
    final int selRow = getSelectedRow();
    final int rowCount = getRowCount();
    final int selCol = getSelectedColumn();
    final EventObject obj = (EventObject) e;
    if (selRow == -1) {
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {           
    changeSelection(0, 1, false, false);
    editCellAt(0, 1, obj);
    boolean isSelected = false;
    if ((ks == KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0)) ||
    (ks == KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0)) ||
    (ks == KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0))) {     
    if (selCol == 1) {
    final int targetRow = (selRow + 1) % rowCount;
    getCellEditor(selRow,selCol).stopCellEditing();
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    editCellAt(targetRow, 1, obj);
    changeSelection(targetRow, 1, false, false);
    getComponentAt(targetRow, 1).requestFocus();
    if ((ks == KeyStroke.getKeyStroke(KeyEvent.VK_UP,0))||
    (ks == KeyStroke.getKeyStroke(KeyEvent.VK_TAB,1))) {
    if (selCol == 1) {
    final int targetRow = (selRow - 1) % rowCount;
    getCellEditor(selRow,selCol).stopCellEditing();
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    editCellAt(targetRow, 1, obj);
    changeSelection(targetRow, 1, false, false);
    getComponentAt(targetRow, 1).requestFocus();
    return super.processKeyBinding(ks,e,condition,pressed);
    public class FactEditorComboBoxTableEditor extends DefaultCellEditor implements KeyListener{
    //// Constructors
    /** Creates a new instance of FactEditorComboBoxTableEditor. */
    public FactEditorComboBoxTableEditor(JComboBox comboBox) {
    super(comboBox);
    JTextField TF =(JTextField)((ComboBoxEditor)comboBox.getEditor()).
    getEditorComponent();
    TF.addKeyListener(this);
    public class FactEditorComboBoxTableEditor extends DefaultCellEditor implements KeyListener{
    //// Constructors
    /** Creates a new instance of FactEditorComboBoxTableEditor. */
    public FactEditorComboBoxTableEditor(JComboBox comboBox) {
    super(comboBox);
    JTextField TF =(JTextField)((ComboBoxEditor)comboBox.getEditor()).
    getEditorComponent();
    TF.addKeyListener(this);
    </pre>
    P.S : viravan, help me solve this problem and you will get the rest of the dukes LOL

  • How to capture the data entered in a textfield in a JTable

    How to capture the data entered in a textfield present in a cell of a textfield or how to add listener to this textfield

    A sample of my code is:
              model = new GridDisplayTableModel(gridDisp,columnName,getRows(),getCols());
              final ComboRenderer cRenderer = new ComboRenderer();
              final TextFieldRenderer tRenderer = new TextFieldRenderer();
              combo.addItem("one");
              combo.addItem("two");
              combo.addItem("three");
              final JTextField textfield = new JTextField();
              final DefaultCellEditor cmbEditor = new DefaultCellEditor(combo);
         //     final JEnterDataCellEditor textEditor = new JEnterDataCellEditor(12);
              final DefaultCellEditor textEditor = new DefaultCellEditor(textfield);
              rm = new RowEditorModel();
              table = new JTable(model){
         public TableCellRenderer getCellRenderer(int row, int column) {
              int posx = 0;
                   int posy = 0;
                   TableCellRenderer renderer = null;
         for(int l=0;l<getDataVec().size();l++)
                   beanObj =(Helperbean)dataVec.elementAt(l);
                   posx = beanObj.getPosx();
                   posy = beanObj.getPosy();
                   if(row==posx && column==posy)
                             if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
                                  rm.addEditorForRow(row,textEditor);
                                  renderer = tRenderer;
                             else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
                                  rm.addEditorForRow(row,cmbEditor);
                                  renderer = cRenderer;
                             break;
                        renderer = super.getCellRenderer(row, column);
              //     System.out.println("getEditor"+rm.getEditor(1));
         return renderer;
    public TableCellEditor getCellEditor(int row, int col) {   
         int posx = 0;
         int posy = 0;
         TableCellEditor tmpEditor = null;
    for(int l=0;l<getDataVec().size();l++)
         beanObj =(Helperbean)dataVec.elementAt(l);
         posx = beanObj.getPosx();
         posy = beanObj.getPosy();
         if(row==posx && col==posy)
                   if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
                        System.out.println("celleditorval "+textEditor.getCellEditorValue());
                        tmpEditor = textEditor;
                   else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
                        tmpEditor = cmbEditor;
                   break;
              tmpEditor = super.getCellEditor(row, col);
    return tmpEditor;
    public boolean isCellEditable(int row,int col){
         boolean isEditable = false;
         int posx = 0;
         int posy = 0;
    for(int l=0;l<getDataVec().size();l++)
         beanObj =(Helperbean)dataVec.elementAt(l);
         posx = beanObj.getPosx();
         posy = beanObj.getPosy();
         if(row==posx && col==posy)
              if(beanObj.getModeofDisplay() != null )     
                        isEditable = true;     
                   else
                        isEditable = false;     
                   break;
         isEditable = false;
         return isEditable;
    public void changeSelection(final int row, final int column, boolean toggle, boolean extend) {
         super.changeSelection(row, column, toggle, extend);
         //my attempt to avoid editCellAt from being called twice in a row
         if (getModel().isCellEditable(row, column) && !(isEditing() && getEditingRow() == row && getEditingColumn() == column))
              if (editCellAt(row, column)) {
                   getEditorComponent().requestFocus();
         // Select the text when the cell starts editing
    public boolean editCellAt(int row, int column) {       
         boolean result = super.editCellAt(row, column);
         final Component editor = getEditorComponent();
         if (editor != null && editor instanceof JTextField) {           
              SwingUtilities.invokeLater(new Runnable() {               
                   public void run() {                   
                        ((JTextField)editor).selectAll();
              return result;
         public boolean hasFocus()
              Component editorComponent = getEditorComponent();
              // Try to install the editor
              int anchorRow = getSelectionModel().getAnchorSelectionIndex();
              int anchorColumn = getColumnModel().getSelectionModel().
              getAnchorSelectionIndex();
              if (anchorRow != -1 && anchorColumn != -1 && !isEditing())
              if ((this.getSelectedRow() == anchorRow) && (this.getSelectedColumn() == anchorColumn))
              if (!editCellAt(anchorRow, anchorColumn)) {}
              return super.hasFocus();
         public void valueChanged(ListSelectionEvent e)
              super.valueChanged(e);
              if ((this.getSelectedRow() == 2) && (this.getSelectedColumn() == 3))
                   DefaultFocusManager focusManager = new DefaultFocusManager();
                   focusManager.focusNextComponent(this);
                   model.fireTableStructureChanged();
         

Maybe you are looking for

  • Address Book behaves very strange

    Hello members and outside viewers, First thing: My Address Book behaves very strange. - After startup, the window freezes. Only if I minimize and click again, works OK. I began used to it, BUT - Since yesterday, Addresses gone, disappeared from every

  • How to Populate long text(item text)  from BOM CS01 to CJ20N transaction

    I have requiremnt  in which i need to Populate long text/item text  of  BOM  from CS01 to CJ20N transaction(PS network)

  • Bugs in calendar and alert in new software Anna fo...

    I use my E7 for business. I think it is a good smart phone. My previous one was an HTC with Windows Phone 6.5. But windows decided to shut down 6.5 to develop 7 so deceided to go back to symbiam. I found some problem after I successfully upgraded my

  • Forms 6.0 Trigger firing order

    Hi, I have a master-detail form where I "execute_query" during new_form_instance. I display 5 master records and for the current master all detail records with one detail being current. The cursor focus is in the master block. I'm looking for the las

  • Discoverer 11g error: dis51usr.exe not found

    Installing Discoverer 11g (11.1.1.3) on a Windows XP SP3 Dewsktop. Logged on as Administrator and installed the software. Selected both Admin and Desktop. According to the software installer, the software was installed successfully. I tested it by op