Tab key selects cell for edit in JTable

Hello,
I've seen extensive posts on this forum for this problem, but no solution yet.
I have a Jtable, with custom cellRenders and cellEditors. Some columns are editable, some are not.
What I want to do, is when someone tabs to an editable cell, that cell immediately goes into edit mode. This means, it acts as if someone double clicked on it, or tabbed then clicked on it. Basically, I want it to ACTUALLY go into edit mode.
Please do not respond by telling me how to make it look editable (highlighting, etc) and do not respond with mouseEvent solutions. Please do not respond by telling me to do table.editCellAt(row,col) because that does not kick in my custom editor, it uses the defaultCellEditor.
So basic question:
How to kick in editing when someone tabs to an editable cell?
If you need code examples, please request and I will post.

nmstaat,
In JTable:
Look into the processKeyBinding method. It takes a keyevent and matchs it with an InputMap, and the InputMap invokes an Action in the corresponding ActionMap.
You will have to call yourJTable.getActionMap(), then alter the action that corresponds to the 'tab' key.
For Further information, check the JTable API, its all there.
Good Luck,
Alex
Here's the current map for the Metal look and feel:
JTable (Java L&F)
Navigate out forward | Tab
Navigate out forward | Ctrl+Tab
Navigate out backward | Shift+Tab
Navigate out backward | Ctrl+Shift+Tab
Move to next cell | Tab
Move to next cell | Right Arrow
Move to previous cell | Shift+Tab
Move to previous cell | Left Arrow
Wrap to next row | Tab
Wrap to next row | Right Arrow
Wrap to previous row | Shift+Tab or Left
Wrap to previous row | Shift+Tab or Left
Block move vertical | PgUp, PgDn
Block move left | Ctrl+PgUp
Block move right | Ctrl+PgDn
Block extend vertical | Shift+PgUp/PgDn
Block extend left | Ctrl+Shift+PgUp
Block extend right | Ctrl+Shift+PgDn
Move to first cell in row | Home
Move to last cell in row | End
Move to first cell in table | Ctrl+Home
Move to last cell in table | Ctrl+End
Select all cells | Ctrl+A
Deselect current selection | Up/Down Arrow
Deselect current selection | Ctrl+Up/Down Arrow
Deselect current selection | Pgup/Pgdn
Deselect current selection | Ctrl+Pgup/Pgdn
Deselect current selection | Home/End
Deselect current selection | Ctrl+Home/End
Extend selection one row | Shift+Up/Down
Extend selection one column | Shift+Left/Right
Extend selection to beginning/end of row | Shift+Home/End
Extend selection to beginning/end of column | Ctrl+Shift+Home/End
Edit cell without overriding current contents | F2
Reset cell content prior to editing | Esc

Similar Messages

  • How to disable/enable the cells for editing column wise in JTable in java?

    Hi All,
    Can any one tell me how to disable the cells for editing by column wise in JTable?
    Here depending upon the radio button selected, I need 2 disable some columns for editing
    and enable some columns for editing?
    how can I do tat using JAVA?
    Any sample code is of great help to me.
    Thanks in Advance

    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    ~

  • How to programatically select text for editing in an af:inputText control?

    Hello, I am new to jdeveloper 11.1.1.3.0 and have searched and searched for info. I must be using the wrong terms as I cannot find any info or example on how to programatically select text for editing in an inputText field.
    My request is to change an existing app so when the user presses a button, control should go to the inputText control (this part works, see existing backing bean code from another developer below) but automatically select the text within for editing by the user (saving the user from having to select the text first before editing).
    Backing bean code to set the focus to an inputText field:
    * sets the cursor to the given component id
    * @param  componentId of item on page
      public void setFocusOnUIComponent(String componentId) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ExtendedRenderKitService service =
          Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
        UIComponent uiComponent = facesContext.getViewRoot().findComponent(componentId);
        service.addScript(facesContext,
          "Component = AdfPage.PAGE.findComponentByAbsoluteId('" + componentId + "'); Component.focus();");
      } I hope this isn't a dumb question and would appreciate it if someone can steer me in the right direction.
    Thank you for any info,
    Gary

    Hi,
    not a dumb question at all. Before answering it, here some comments on the code you pasted in your question
    1. UIComponent uiComponent = facesContext.getViewRoot().findComponent(componentId);
    This code line is not used at all in your method. So it seems you can get rid of it
    2. "Component = AdfPage.PAGE.findComponentByAbsoluteId('" + componentId + "'); Component.focus();");
    I suggest to change it to
    "var component = AdfPage.PAGE.findComponentByAbsoluteId('" + componentId + "'); component.focus();");
    as it is better coding practice to have variable names starting with a lower case letter and being flagged with the "var" identifier
    For pre-selecting text in an an input component, there is no API available in ADF Faces, which means you need to reach out to the rendered HTML ouput. To access the markup for the rendered component, you can try
    var markup = AdfRichUIPeer.getDomContentElementForComponent(component)
    If this markup returns the HTML input component then you can use JavaScript you find on the Internet to select the area of it. If it does not return the input component then you may have to use
    document.getElementById(componentId+'::content')
    Note however that working directly with generated HTML output bears the risk that your code breaks when - for whatever reason - the ADF Faces component rendering changes in the future
    Frank
    Frank

  • Curious question about tab key selecting?

    I'm not sure how to word this query so try to bare with me.
    I sometimes use the tab key to select the next file or folder instead of the arrow keys, but I've noticed that when I have a series of folders and/or files that are in numerical order, the tab key doesn't select the files and folders in the order that they are listed it selects them in a order that is similar to alphabetical order.
    Such as this:
    This is an example of the file names and the numerical order they're listed in:
    9
    28
    29
    30
    40
    300
    2006
    2025
    A
    This is the order the tab selects the same files:
    2006
    2025
    28
    29
    30
    300
    40
    9
    A
    If the 9 file is selected then I hit tab key to select the next file, the next files selected is A it will skip over the other files. The arrow Keys don't do this.
    My question is why is this the case?
    Not really a big deal but I was curious why it does that.

    You are correct for the use you've described - using tab in list view, also in icon view. The tab key moves in alpha-numeric sequence but the numeric is by 1st numeral, 2nd numeral, etc if two or more have the same first numeral not by total number size.
    The arrow keys are essentially directional. In icon view you use L/R to move to the next item and up/down to move vertically.
    This is the standard use but individual applications use these keys differently. In a table/database it's common for the tab to move from cell to cell and the arrow keys to move through the characters in a cell but even these can depend on the particular software package.
    This is all part of the learning curve for computer users!
    Neville

  • Error message: "Unable to prepare the selected file for editing"

    There is another similar post. <br /><br />I have imported a bunch of Nikon NEF raw files into Lightroom. I can work them without any problem, but when I right-click the image to edit it further in Photoshop CS3. I get this message:<br /><br />i "Lightroom was unable to prepare the selected file <filename.NEF> for editing. It will not be opened."<br /><br />Photoshop has no trouble opening these NEF files by itself, but Lightroom can't hand it them off. Anyone know why this is? Nothing I can find in the help file or elsewhere here.<br /><br />Stan

    Sean, if they are off-line, would any of this Xmp stuff make any difference? Don't they need to be brought On-lie to edit? And where would the Xmp's go with them off-line?
    Don
    Don Ricklin, MacBook 1.83Ghz Duo 2 Core, Pentax *ist D
    http://donricklin.blogspot.com/

  • How to change a selected cell background color in JTable?

    Hi all,
    I am trying to change the background color of a selected cell by clicking on that particular cell. DefaultTableCellRenderer class provides setBackground(Color c) to change the background color of unselected cells. Is there a way to change a selected cell background color?
    Thank you,
    Arthur

    Write your own renderer (eg. extending DefaultTableRenderer) and put in getTableCellRendererComponent method something like this:
    if( isSelected && hasFocus )
        setBackground( Color.RED );
        setForeground( Color.GREEN );
    }

  • After importing spread sheet,unable to select cells for linking components

    I am not sure what causes this. Some times the spreadsheet gets locked after i import it to excelcius. I am not sure what i am missing.
    Also when a new version of the spread sheet with minor changes is imported for carrying out the changes in XLF, the new spreadsheet in the excelcius gets locked and i can select any cells.
    There should be a simple trick to over come this and please help!

    Thanks for the prompt response Amit>
    I have checked the spread sheet and it not protected. It used to happen once in while earlier but now i am stuck with this.
    Also, on the similar lines, can we import a new excel spread sheet of an XLF and modify the XLF to re link some of the cells? It is not allowig me to select the cells in the spread sheet in this situation also and every thing gets locked up and i can not do any thing!

  • Tab transversal while using JTextArea as a JTable cell editor..

    I'm working on a project that will use a JTable with a JTextArea cell editor to create a chart for classroom scheduling. Searching on Google, I found a way to use a JTextArea as a cell editor and render the cell properly. However, when editing a cell, pressing the Tab key inserts a tab, rather than leaving the cell and going to the next one, as happens with just a regular JTable. In fact, none of the keyboard shortcuts that work on a JTable work once the JTextArea cell editor is used. Does anyone know of any way to resolve this? Below is some code I'm using to create a sample GUI, just to verify that I can do this. Another question is would it be easier to use a bunch of JLabels and JTextAreas, remove the padding from those JTextAreas, and try to allow for Tab transversals between stand-alone JTextAreas, rather than JTextAreas as JTable cell editors?
    Thanks!
    package edu.elon.table;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class GUI
         private JFrame frame;
         private String[] columnNames = {"Classroom", "8:00-9:10", "9:25-10:35",
              "10:50-12:00", "12:15-1:25", "1:40-2:50", "1:40-3:20 (MW)",
              "3:35-5:15 (MW)", "5:30-7:10 (MW)"};
         private Object[][] data = {columnNames,
              {"ALAM 201 (42)\nENG 110 LAB", "", "", "", "", "", "", "", ""},
              {"ALAM 202 (42)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 203 (38)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 205 (40)\n", "", "", "", "", "", "", "", ""},
              {"ALAM 206 (39)\nSINK, TV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 207 (40+)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 214 (38)\nTV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 215 (42)\nTV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 216 (42)\n", "", "", "", "", "", "", "", ""},
              {"ALAM 301 (40)\nTV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 302 (38)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 304 (35)\nFRENCH", "", "", "", "", "", "", "", ""},
              {"ALAM 314 (30)\nDP, PSY, COMPUTER ASSISTED", "", "", "", "", "", "",
              {"ALAM 315 (40)\nPC LAB, DP/DVD", "", "", "", "", "", "", "", ""}};
         private JTable table;
         public GUI()
              frame = new JFrame();
              table = new JTable(data, columnNames);
              table.setRowHeight(table.getRowHeight()*2);
              TableColumnModel cModel = table.getColumnModel();
              TextAreaRenderer renderer = new TextAreaRenderer();
              TextAreaEditor editor = new TextAreaEditor();
              for (int i = 0; i < cModel.getColumnCount(); i++)
                   cModel.getColumn(i).setCellRenderer(renderer);
                   cModel.getColumn(i).setCellEditor(editor);
              frame.setLayout(new GridLayout(1,0));
              frame.add(table);
              frame.pack();
              frame.setVisible(true);
    public static void main (String[] args)
    GUI gui = new gui();
    * Written by Dr. Heinz Kabutz, found through online newsletter via Google.
    class TextAreaRenderer extends JTextArea
    implements TableCellRenderer {
    private final DefaultTableCellRenderer adaptee =
    new DefaultTableCellRenderer();
    /** map from table to map of rows to map of column heights */
    private final Map cellSizes = new HashMap();
    public TextAreaRenderer() {
    setLineWrap(true);
    setWrapStyleWord(true);
    public Component getTableCellRendererComponent(//
    JTable table, Object obj, boolean isSelected,
    boolean hasFocus, int row, int column) {
    // set the colours, etc. using the standard for that platform
    adaptee.getTableCellRendererComponent(table, obj,
    isSelected, hasFocus, row, column);
    setForeground(adaptee.getForeground());
    setBackground(adaptee.getBackground());
    setBorder(adaptee.getBorder());
    setFont(adaptee.getFont());
    setText(adaptee.getText());
    // This line was very important to get it working with JDK1.4
    TableColumnModel columnModel = table.getColumnModel();
    setSize(columnModel.getColumn(column).getWidth(), 100000);
    int height_wanted = (int) getPreferredSize().getHeight();
    addSize(table, row, column, height_wanted);
    height_wanted = findTotalMaximumRowSize(table, row);
    if (height_wanted != table.getRowHeight(row)) {
    table.setRowHeight(row, height_wanted);
    return this;
    private void addSize(JTable table, int row, int column,
    int height) {
    Map rows = (Map) cellSizes.get(table);
    if (rows == null) {
    cellSizes.put(table, rows = new HashMap());
    Map rowheights = (Map) rows.get(new Integer(row));
    if (rowheights == null) {
    rows.put(new Integer(row), rowheights = new HashMap());
    rowheights.put(new Integer(column), new Integer(height));
    * Look through all columns and get the renderer. If it is
    * also a TextAreaRenderer, we look at the maximum height in
    * its hash table for this row.
    private int findTotalMaximumRowSize(JTable table, int row) {
    int maximum_height = 0;
    Enumeration columns = table.getColumnModel().getColumns();
    while (columns.hasMoreElements()) {
    TableColumn tc = (TableColumn) columns.nextElement();
    TableCellRenderer cellRenderer = tc.getCellRenderer();
    if (cellRenderer instanceof TextAreaRenderer) {
    TextAreaRenderer tar = (TextAreaRenderer) cellRenderer;
    maximum_height = Math.max(maximum_height,
    tar.findMaximumRowSize(table, row));
    return maximum_height;
    private int findMaximumRowSize(JTable table, int row) {
    Map rows = (Map) cellSizes.get(table);
    if (rows == null) return 0;
    Map rowheights = (Map) rows.get(new Integer(row));
    if (rowheights == null) return 0;
    int maximum_height = 0;
    for (Iterator it = rowheights.entrySet().iterator();
    it.hasNext();) {
    Map.Entry entry = (Map.Entry) it.next();
    int cellHeight = ((Integer) entry.getValue()).intValue();
    maximum_height = Math.max(maximum_height, cellHeight);
    return maximum_height;
    * Written by Dr. Heinz Kabutz, found through online newsletter via Google.
    class TextAreaEditor extends DefaultCellEditor
    public TextAreaEditor() {
         super(new JTextField());
    final JTextArea textArea = new JTextArea();
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setBorder(null);
    editorComponent = scrollPane;
    delegate = new DefaultCellEditor.EditorDelegate() {
    public void setValue(Object value)
    textArea.setText((value != null) ? value.toString() : "");
    public Object getCellEditorValue()
    return textArea.getText();
    }

    Using the KeyEvent manager and playing around with the JTextArea, I was able to get a JTable using JTextAreas as the cell editors that worked very close to the way the regular JTable works. You have to hit Tab twice to shift focus to another cell, or hit Tab once and then an arrow key. Also, Alt-Enter will allow you to enter a cell for editing. All of the changes were made to the TextAreaEditor class, which should now read as follows:
    class TextAreaEditor extends DefaultCellEditor implements KeyListener
         private int lastKeyCode;
         public TextAreaEditor(final JTable table) {
              super(new JTextField());
              lastKeyCode = KeyEvent.CTRL_DOWN_MASK;
              final JTextArea textArea = new JTextArea();
              textArea.setWrapStyleWord(true);
              textArea.setLineWrap(true);
              textArea.addKeyListener(this);
              textArea.setFocusable(true);
              textArea.setFocusAccelerator((char) KeyEvent.VK_ENTER);
              JScrollPane scrollPane = new JScrollPane(textArea);
              scrollPane.setBorder(null);
              scrollPane.setFocusable(false);
              editorComponent = scrollPane;
              delegate = new DefaultCellEditor.EditorDelegate() {
                   public void setValue(Object value) {
                        textArea.setText((value != null) ? value.toString() : "");
                   public Object getCellEditorValue() {
                        return textArea.getText();
         public void keyTyped(KeyEvent ke)
              // TODO Auto-generated method stub
         public void keyPressed(KeyEvent ke)
              if (ke.getKeyCode() == KeyEvent.VK_TAB)
                   ke.consume();
                   KeyboardFocusManager.getCurrentKeyboardFocusManager()
                             .focusNextComponent();
                   return;
              if (ke.getKeyCode() == KeyEvent.VK_TAB && ke.isShiftDown())
                   ke.consume();
                   KeyboardFocusManager.getCurrentKeyboardFocusManager()
                             .focusPreviousComponent();
                   return;
              if ((lastKeyCode == KeyEvent.CTRL_DOWN_MASK) &&
                        (ke.getKeyCode() == KeyEvent.VK_ENTER))
                   ke.consume();
                   editorComponent.requestFocus();
              else
                   lastKeyCode = ke.getKeyCode();
         public void keyReleased(KeyEvent ke)
              // TODO Auto-generated method stub
         }

  • Tab in selection screen

    Dear All,
    I have to developed a new report in which I have to diplay two different report.For that two different report there are two different selection screen.I have developed two tabs in selection screen for two different report.
    There are some mandatory fields in each screen,Now problem is that I can't go second tab unless I fill value in mandatory field.
    But my requirment is when I want to go for second report then I will go for second tab without filling any value in tab 1 selection screen
    Please give a sollution.
    Regards,
    Amar

    Hi Amar,
    <li>You can achieve the same using Dialog program . Instead of selection-screen, use dialog programming, use MODULE mod_name AT EXIT-COMMAND to navigate one tab to another tab. Once you give input on any tab and want to display data use LEAVE TO LIST PROCESSING AND RETURN TO SCREEN 0.
    <li>Check the link: http://help.sap.com/saphelp_47x200/helpdata/en/9f/dbaa9535c111d1829f0000e829fbfe/content.htm
    <li>Normally AT EXIT-COMMAND is used to exit without giving mandatory fields. We can use for this situation.
    Thanks
    Venkat.O

  • How to recognize the tab key in a JTextField

    I have a drawing program with a main window and a tools palette, which is a JDialog. The tools palette has JToggleButtons and one JTextField. When you have the focus in the JTextField and you press tab repeatedly, it tabs through all the JToggleButtons and then back into the JTextField.
    However I would like to recognize the pressing of the tab key and ask for the focus to go back to the main window.
    I subclassed the JTextField, added a KeyAdapter, but it does not recognize the tab key. I also added the processKeyBinding method, but it doesn't recognize the tab key either.
    How can I recognize the tab key?
    Here is a self-contained test program that illustrates the problem:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class AnanyaCurves extends JFrame
      Tools tools;
      public AnanyaCurves(Dimension windowSize)
        Basics.ananyaCurves = this;
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        setTitle("Ananya Curves");
        tools = new Tools(this);
      public static void main(String[] args)
        int toolsWidth;
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        toolsWidth = 200;
        Dimension windowSize = new Dimension(screenSize.width - toolsWidth, screenSize.height - 58);
        AnanyaCurves ananyaCurves = new AnanyaCurves(windowSize);
        ananyaCurves.pack();
        ananyaCurves.setBounds(toolsWidth, 0, windowSize.width, windowSize.height);
        ananyaCurves.setVisible(true);
        ananyaCurves.requestFocus();
      public void setVisible(boolean b)
        tools.setVisible(b);
        super.setVisible(b);
    class Basics extends java.lang.Object
      public static AnanyaCurves ananyaCurves;
      public Basics()
    class Tools extends JDialog
      JToggleButton btnGrid;
      JTextField textGrid;
      JPanel panel;
      public Tools(JFrame frame)
        super(frame, "Tools", false);
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        btnGrid = makeBtn("Grid");
        textGrid = makeTextField();
        panel = makePanel();
        pack();
      public JToggleButton makeBtn(String name)
        JToggleButton btn = new JToggleButton();
        btn.setMaximumSize(new Dimension(108, 24));
        btn.setPreferredSize(new Dimension(108, 24));
        btn.setText(name);
        btn.setFont(new Font("Verdana", Font.PLAIN, 11));
        btn.setMargin(new Insets(5, 10, 5, 10));
        btn.setOpaque(true);
        return btn;
      public ACJTextField makeTextField()
        ACJTextField textField = new ACJTextField();
        textField.setFont(new Font("Verdana", Font.PLAIN, 12));
        textField.setMaximumSize(new Dimension(108, 20));
        textField.setPreferredSize(new Dimension(108, 20));
        textField.setText("0.25");
        textField.setEnabled(true);
        return textField;
      public JPanel makePanel()
        JPanel panel = new JPanel();
        panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        panel.add(btnGrid);
        panel.add(textGrid);
        getContentPane().add(panel);
        return panel;
    class ACJTextField extends JTextField
      KeyAdaption keyAdaption;
      public ACJTextField()
        super();
        keyAdaption = new KeyAdaption();
        this.addKeyListener(keyAdaption);
      class KeyAdaption extends KeyAdapter
        public void keyPressed(KeyEvent event)
          int keyCode = event.getKeyCode();
          if (keyCode == KeyEvent.VK_TAB)
            Basics.ananyaCurves.requestFocus();
      protected boolean processKeyBinding(KeyStroke keyStroke, KeyEvent keyEvent, int int2, boolean boolean3)
        int keyCode = keyEvent.getKeyCode();
        if (keyCode == KeyEvent.VK_TAB)
          Basics.ananyaCurves.requestFocus();
          return false;
        return super.processKeyBinding(keyStroke, keyEvent, int2, boolean3);
    }Thanks for looking at this.

    Wow, Michael, you work like magic! Thanks so much! I would be happy to give you a commercial key to my Ananya Curves program also once the second release is on my website. It's a program for drawing curves in an easier way without pulling on tangent lines, with all control points right on the curve. Just send me an email to [email protected] if you are interested!

  • Tab key to indent

    Is it possible to make the Tab key indent in a text box, instead of moving to the next item.
    I was thinking it would be possible using a customer format script or a custome keystroke script.
    Thanks for any help.

    No, it's not possible. The tab key is reserved for moving from field to
    field.

  • I'm having problems exporting files for editing from LR 4.3 into photoshop elements 9.

    This problem only occurs with files that I have been imported from cd's/dvd's into the libraryand I get the msg "Lightroom was unable to prepare the selected file for editing. It will not be opened."
    Files that are stored on my hard drive have NO PROBLEM in being edited. .
    I am new to Lightroom and currently using it on the 30 day trial I have been using PSE for a long time and have over 90,000 images in Organizer and all of my images are on cd's/dvd's, very few are stored on the hard drive.
    Thanks in advance for any feedback and suggestions.
    Ken

    Do you mean they are still on the CD/DVD and you want to export them directly from CD/DVD?
    That's not possible since the CD/DVD is not writeable. You have to move the photos to your hard drive first.

  • Unable to receive Tab key press event

    Hello,
    I have written a component which extends JComponent.
    For that , when Tab key is pressed I need to process something.
    I have overridden the function processKeyBinding in my class.
    But I am not getting any event for tab key press. For all the other key press events, the function is being called.
    I also tried to create a action and add it to the action map. But that is also not working.
    Can anyone explain me why it is not working and give me the solution.
    Thanks in advance,
    Anu

    public static void removeTabFromFocusTraverval(Component c) {
         int id = KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS;
         Set strokes = c.getFocusTraversalKeys(id);
         Set newStrokes = new HashSet(strokes);
         newStrokes.remove(KeyStroke.getKeyStroke("TAB"));
         c.setFocusTraversalKeys(id, newStrokes);
    }

  • Spark datagrid - how can i open entire row for editing?

    Hi,
    I want to create a datagrid with add button. The user can add a row and i want all the editable columns to be opened for editing.
    I can open a single cell for editing by using startItemEditorSession, but how can i do it for multiple columns in the same time?

    redskyventures wrote:
    it seems mine has automatically done so...
    I recommend you turn off the automatic update feature -- It can really cause you a lot of trouble.
    Have you already determined that your coauthor cannot open your file?  If so, I suggest you go backwards, get a copy of the old iBA from him to put on your machine, so you both use the same version.  There's no way to convert iba files to anything, as far as I know.

  • JTable tab key navigation with JComboBox Cell Editors in Java 1.3 & 1.4

    Hello - this is one for the experts!
    I have a JTable which has an editable JComboBox as one of the cell editors for a particular column. Users must be able to navigate through the table using the tab key. After editing a cell a single tab should advance the cell selection to the next column and then the user should just be able to start typing to populate the cell.
    However, i've come across some really frustrating differences between the Swing implementation of JDK1.3.1_09 and JDK 1.4.2_04 which means this behaviour is very different between versions!....
    1. Editing Cells and then advancing to the next column using tab.
    Using standard cell editors (based around JTextFields) in 1.3.1 the user has to press tab twice to traverse to the next column after editing. However, in 1.4.2 a single tab key is enough to move to the next column after editing.
    2. Editable JComboBox editors and and advancing to the next column using tab.
    Using JDK 1.3.1, having entered some text in the editable combo it takes 2 tabs to transfer the selected cell to the next column. With 1.4.2 a single tab while editing the editable combo ends editing and transfers the selection out of the table completely?!?
    With these 2 issues I don't know how to make a single tab key reliably transfer to the next cell, between java versions. Can anyone please help me?!??!
    (i've attached test code below which can be run in both 1.3 and 1.4 and demonstrates the above behaviour.)
    package com.test;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TableTest4 extends JFrame {
         private JTable table;
         private DefaultTableModel tableModel;
         public TableTest4() {
              initFrame();
          * Initialises the test frame.
         public void initFrame() {
              // initialise table
              table = new JTable(10, 5);
              tableModel = (DefaultTableModel) table.getModel();
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              table.setRowHeight(22);
              JScrollPane scrollPane = new JScrollPane(table);
              getContentPane().add(scrollPane);
              JButton dummyBtn1 = new JButton("Dummy Button 1");
              JButton dummyBtn2 = new JButton("Dummy Button 2");
              // initialise frame
              JPanel btnPanel = new JPanel(new GridLayout(2, 1));
              btnPanel.add(dummyBtn1);
              btnPanel.add(dummyBtn2);
              getContentPane().add(btnPanel, BorderLayout.SOUTH);
              // set renderer of first table column to be an editable combobox
              JComboBox editableCombo = new JComboBox();
              editableCombo.setEditable(true);
              TableColumn firstColumn = table.getColumnModel().getColumn(0);
              firstColumn.setCellEditor(new DefaultCellEditor(editableCombo));
         public static void main(String[] args) {
              TableTest4 frame = new TableTest4();
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              frame.pack();
              frame.setVisible(true);

    Run the above code in 1.3 and 1.4 and you can see that after editing a cell, the tab key behaviour works differently between versions.
    I don't believe by adding a key listener to the cell editors will have the desired effect.
    I've read other posts and from what i've read it looks like the processKeyBinding method of the JTable can be overridden to manually handle key events.
    Has anyone done this to handle tab key presses so that the same java app running under 1.3 and 1.4 works in the same way ??? I would really appreciate some advice on this as its very frustrating !

Maybe you are looking for

  • FRM-92101 when trying to run forms from Forms Builder 10g

    I have been struggling with this for a few days now and have tried multiple solutions around on these forums without any resolution yet! Trying to run Forms Builder on a Windows XP machine with Oracle Development Suite 10.1.2.0.2 installed in its own

  • Hard drive suddenly not showing up

    Hi. I have a 1.5ghz 17" PB with 1GB of RAM. I got it in June '04. Today, I attempted to wake it from sleep after having used it all morning. I typed in my password, and then the box went grey and didn't respond for long time. I force-restarted, and w

  • Can't open or move file - In use by Mac OS X

    I have a file (movie) I am trying to move to a new external hard drive. I can't move it cause it says it is used by Mac OS X and cannot be moved or if I try to open it says it can't be opened. The permissions are set correctly on this file and it pla

  • Enabling BlueTooth Radio - Not showing up in FnF5 screen

    When I hit the FnF5 button, I only get the Wireless LAN Radio option and not the BlueTooth. What should I do or check to enable my Bluetooth radio? When I first got my new laptop the radio was on by default and working. Since then I have turned off a

  • Oracle XE Functionality Question

    Hello, I am here trying to get the opinion of Oracle XE users regarding a project I am considering. Currently, my employer uses Access databases, with the master on a corporate server, and 4 slaves on local servers at warehouses. At each warehouse, t