Mouse Double Click on an editable cell of JTable

Hi Pros:
Maybe this is an old question but no answser from Forum.
I have a JTable with adding MouseListener. I tried to put double click behavior on nay row in the table. The problem was that this action can obly work on the uneditable cell and do not work on editable cell.
Anyone have ideas and help me.
Thank you!

Hi Wang,
I have a problem similar to the one you have some time back.
I have a query for which I need to use PreparedStatement .The query runs likes this :-
String str = " Select ? , ename from emp where deptno ? ";
The values of ? need to be assigned dynamically.
But I cannot create Prepared Statement from this query .
If you have got answer to your questions can you inform me at
[email protected]
Thanks in advance

Similar Messages

  • Double click does not edit cell

    One of my users: double-clicking a cell is expected to place the focus into the cell for editing, but the expected behavior isn't happening. Cursor remains unchanged.
    It's not the mouse; I tried a couple. It's not plist, deleted both.
    It is something totally simple but what?

    Complementary questions :
    (1) How is the app behaving if you run it in an other user account ?
    (2) Was Mac Os updated to 10.6.2 thru "Applications Update" ?
    If it was, it may be a good idea to apply the combo updater available from:
    http://support.apple.com/kb/dl959
    Yvan KOENIG (VALLAURIS, France) mercredi 24 mars 2010 16:17:34

  • FRM-40735 when mouse double click trigger raised unhandled exceptiORA-01722

    I am using Forms 10g.
    i am writting a procedure in When mouse double click trigger that will display all the values available for ip address from this procedure.
    The procedure is
    DECLARE
    CURSOR cr
    IS
    SELECT LEVEL NUM
    FROM DUAL
    CONNECT BY LEVEL<=(Select max_range from t_ip_address_dtl where category_name=:t_item_cpu.category and block_name =:block_head.block)
    MINUS
    SELECT TO_NUMBER(SUBSTR(IP_address, 12))
    FROM T_item_cpu;
    abc number(4);
    abc1 number(4):=null;
    BEGIN
    FOR rec IN cr LOOP
         abc1 := abc1 || ',' || rec.num;
    END LOOP;
    Message('You can use between these nos: '||abc1);
    Message('You can use between these nos: '||abc1);
    END;
    It is showing this error :-

    Yes bye mistakly i posted ,, due to internet problem..

  • Why can't I minimise itunes with mouse double click?

    why can't I minimise itunes with mouse double click?

    I do not know if you can ..
    Try -
    Command + M .

  • How to capturing Mouse double click action?

    Hi all,
    how can we identify the "mouse double click" action?
    MouseListener has methods for only mousePressed,released,clicked (single).
    Thanks in advance..
    Regards
    Sojan

    Hi,
    Thanks it worked ..
    e.getClickCount() value increases if we keep on clicking on the component, is there anythning wrong by interpreting double click as
    "e.getClickCount() >=2 "?
    Regards
    Sojan

  • Distinguishing b/t two single mouse-click and mouse-double-click

    Hi,
    I am curious to find out how Forms will distinguish between two single when-mouse-click events and a single when-mouse-doubleclick event. Is it simply a timing issue or is there more involved i.e. the 'co-ordinates' of the mouse. Thanks in advance for any opinions given,
    regards,
    Kevin.

    The difference is same as the difference of Apple and Orange.
    Its depends on O/S and event management within OS kernel.
    You can change the timing in Control panel of mouse double click.

  • MOUSE DOUBLE CLICKING

    I have an hp mouse...however it says product of china on the back..It does look like an hp mouse though..
    Anyhow..it's doubleclicking..it's driving me crazy..
    I've had the mouse for a few years..
    It just starting doing this..
    I"m running XP
    It is a USB..with a red light under it...with an optical eye?...Not sure if that's what they call it..
    Please help..Are there drivers I can use to fix this...
    I"m not sure if a windows update..might have done this..
    Many thanks..

    Hi kittylondon,
    I understand your mouse is acting like you are double-clicking even though you are only clicking. Take a look at the following, Troubleshoot mouse double-clicking when you single-click. The document also applies to Windows 7 and Windows Vista, so you will have to make sure you are referencing only the portions that apply to Windows XP. I hope this is of help to you. Best of luck. Have a wonderful day.
    Ryan1216
    I work on behalf of HP
    The advice and opinions given here are my own and not those of HP

  • Keypressed event for a particular  edited cell of jtable

    hi friend,
    how to write the key pressed event for the edited cell of jtable which having focus on that particular cell.
    pls help me out.

    [http://catb.org/~esr/faqs/smart-questions.html]
    [http://mindprod.com/jgloss/sscce.html]
    db

  • Detecting mouse clicks in editable cell of JTable

    Hi everyone :)
    I thought that this question might have been asked before, but I have searched the forums extensively and have not been able to find the solution.
    What I want to achieve is to detect single and double mouse clicks on JTable cells (that are editable).
    For example, I have a JTable and there exists within it an editable cell. If the user clicks on it once then that cell goes into edit mode, and the user can type directly into the cell. I have already successfully implemented this.
    However, what I also want to do is detect a double-click so that I can pop up a dilaog that shows a list of default values that the user can select.
    So here is what I want;
    1. User clicks on the cell once.
    2. Cell moves into edit mode.
    3. If the user clicks again within a certain time interval then cancel edit mode and pop up a dialog containing values that the user can select from.
    I think that to do this I need to be able to detect mouse clicks on the cell that is currently being edited. So far I have been unable to discover how this is done. I have even tried extending JTextField to get what I want, but with no luck.
    Any help would be greatly appreciated.
    Kind regards,
    Ben Deany

    Thanks for the reply.
    Unfortunately, it is not possible to call 'AddMouseListener()' on a cell editor. You are only able to call 'addCellEditorListener()' and that only allows two events to the broadcast (edit cancel, and edit stop).
    Ben

  • Needs double click to edit cell in JTable

    I know this is bad design but there's no other way that I could possibly meet the requirement which is to have dynamic components. Anyhow, the requirement is to have any kind of components(e.g. TextFields, Combobox, Regular expression fields, a panel with a number of checkboxes) in a table cell in the same column. It would have been easier to do this by using the the DefaultCellEditor, with the 'panel containing a number of checkboxes' I cannot use it.
    I already have an implementation for this requirement. There was no problem with it when we used Java 1.5. But when we shifted to Java 1.6, I noticed that I need to double-click on a cell so that I can edit it. I did not notice this behavior at all with 1.5. What could have changed in 1.6?
    Below, are my (trimmed-down) codes:
    //TestComponent.java
    public class TestComponent extends JPanel{
    private int componentHeight=16;
    public TestComponent(int i){
    this.setPreferredSize(new Dimension(90, this.componentHeight));
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    switch (i){
    case 0: createTextField(); break;
    case 1: createCheckBox(); break;
    case 2: createCombo(); break;
    private void createTextField(){
    String text = null;
    int textFieldMaxLength = 5;
    JTextField oText = new JTextField(textFieldMaxLength);
    // add it to this Panel:
    this.add(oText);
    // set the data:
    text = "test";
    oText.setText(text);
    // set size for this TextField:
    Dimension fieldSize = new Dimension(
    textFieldMaxLength * 13, this.componentHeight);
              oText.setPreferredSize(fieldSize);
              oText.setMinimumSize(fieldSize);
              oText.setMaximumSize(fieldSize);     
    private void createCheckBox(){
    JCheckBox chkbox = new JCheckBox();
    this.add(chkbox);
    private void createCombo(){
    JComboBox combo = new JComboBox(new String[]{"apple", "orange", "plum", "grapefruit"});
    Dimension fieldSize = new Dimension(                    5 * 13, this.componentHeight);
              combo.setPreferredSize(fieldSize);
              combo.setMinimumSize(fieldSize);
              combo.setMaximumSize(fieldSize);
    this.add(combo);
    //ComponentCellEditor.java
    public class ComponentCellEditor extends AbstractCellEditor
         implements TableCellEditor, Serializable{
    protected JComponent editorComponent = null;     
    public Component getComponent() {
    return editorComponent;
    public Object getCellEditorValue() {
    return editorComponent;
    public boolean isCellEditable(EventObject anEvent) {
    return true;
    public boolean shouldSelectCell(EventObject anEvent) {
    return true;
    public boolean stopCellEditing() {
    fireEditingStopped();
    return true;
    // Implementing the TreeCellEditor Interface
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    this.editorComponent = (TestComponent)value;
    return editorComponent;
    //ComponentCellRenderer.java
    public class ComponentCellRenderer implements TableCellRenderer
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    TestComponent oComp = (TestComponent) value;
    if (isSelected) {
    oComp.setForeground(table.getSelectionForeground());
    oComp.setBackground(table.getSelectionBackground());
    } else {
    oComp.setForeground(table.getForeground());
    oComp.setBackground(table.getBackground());     
    return oComp;
    //TestTable.java
    public class TestTable
    public static void main(String []args){
    String columns[] = {"Text", "Value"};          
    Class types[] = {String.class, TestComponent.class};
    boolean editable[] = {false, true};
    AsrTable table = new AsrTable(new Dimension(200, 150), columns, types, editable);
    table.addRow(new Object[]{"Field1", new TestComponent(0)});
    table.addRow(new Object[]{"Field2", new TestComponent(1)});
    table.addRow(new Object[]{"Field3", new TestComponent(2)});
    table.setDefaultEditor(TestComponent.class, new ComponentCellEditor());
    table.setDefaultRenderer(TestComponent.class, new ComponentCellRenderer());
    table.setShowGrid(false);
    table.setRowHeight(20);
    table.setRowSelectionAllowed(false);
    JFrame frame = new JFrame();
    frame.addWindowListener( new WindowAdapter() {
         public void windowClosing(WindowEvent e)
         Window win = e.getWindow();
         win.setVisible(false);
         win.dispose();
         System.exit(0);
    JScrollPane pane = new JScrollPane(table);
    frame.getContentPane().add(pane);
    frame.pack();
    frame.setVisible(true);
    }

    My last post doesn't have Code Formatting.
    // TestComponent.java
    public class TestComponent extends JPanel{
         private int componentHeight=16;
         public TestComponent(int i){
              this.setPreferredSize(new Dimension(90, this.componentHeight));
              setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
              switch (i){
                   case 0: createTextField(); break;
                   case 1: createCheckBox(); break;
              case 2: createCombo(); break;
         private void createTextField(){
              String text = null;
              int textFieldMaxLength = 5;
              JTextField oText = new JTextField(textFieldMaxLength);
              // add it to this Panel:
              this.add(oText);
              // set the data:
              text = "test";
              oText.setText(text);
              // set size for this TextField:
              Dimension fieldSize = new Dimension(
                        textFieldMaxLength * 13, this.componentHeight);
              oText.setPreferredSize(fieldSize);
              oText.setMinimumSize(fieldSize);
              oText.setMaximumSize(fieldSize);
         private void createCheckBox(){
              JCheckBox chkbox = new JCheckBox();
              this.add(chkbox);
         private void createCombo(){
              JComboBox combo = new JComboBox(new String[]{"apple", "orange", "plum", "grapefruit"});
              Dimension fieldSize = new Dimension( 5 * 13, this.componentHeight);
              combo.setPreferredSize(fieldSize);
              combo.setMinimumSize(fieldSize);
              combo.setMaximumSize(fieldSize);
              this.add(combo);
    // ComponentCellEditor.java
    public class ComponentCellEditor extends AbstractCellEditor 
         implements TableCellEditor, Serializable
         protected JComponent editorComponent = null;     
         public Component getComponent() {
              return editorComponent;
         public Object getCellEditorValue() {
              return editorComponent;     
         public boolean isCellEditable(EventObject anEvent) {
              return true;
         public boolean shouldSelectCell(EventObject anEvent) {
              return true;
         public boolean stopCellEditing() {
              fireEditingStopped();
              return true;
    //  Implementing the TreeCellEditor Interface
        public Component getTableCellEditorComponent(JTable table, Object value,
              boolean isSelected, int row, int column) {
              this.editorComponent = (TestComponent)value;
              return editorComponent;
    // ComponentCellRenderer.java
    public class ComponentCellRenderer implements TableCellRenderer
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
                   int column) {
              TestComponent oComp = (TestComponent) value;
              if (isSelected) {
                   oComp.setForeground(table.getSelectionForeground());
                   oComp.setBackground(table.getSelectionBackground());
              } else {
                   oComp.setForeground(table.getForeground());
                   oComp.setBackground(table.getBackground());
              return oComp;
    // TestTable.java
    public class TestTable
         public static void main(String []args){
              String columns[] = {"Text", "Value"};          
              Class types[] = {String.class, TestComponent.class};
              boolean editable[] = {false, true};
              AsrTable table = new AsrTable(new Dimension(200, 150), columns, types, editable);
              table.addRow(new Object[]{"Field1", new TestComponent(0)});
              table.addRow(new Object[]{"Field2", new TestComponent(1)});
              table.addRow(new Object[]{"Field3", new TestComponent(2)});
              table.setDefaultEditor(TestComponent.class, new ComponentCellEditor());
              table.setDefaultRenderer(TestComponent.class, new ComponentCellRenderer());
              table.setShowGrid(false);
              table.setRowHeight(20);
              table.setRowSelectionAllowed(false);
              JFrame frame = new JFrame();
              frame.addWindowListener( new WindowAdapter() {
                   public void windowClosing(WindowEvent e)
                        Window win = e.getWindow();
                        win.setVisible(false);
                        win.dispose();
                        System.exit(0);
              JScrollPane pane = new JScrollPane(table);
              frame.getContentPane().add(pane);
              frame.pack();
              frame.setVisible(true);
    }

  • Unable to edit cells in JTable on single click of the cell.

    Hi,
    I am unable to edit a cell in JTable on single click of the cell. If I double click on the cell, I am able to edit it. Please help me.
    Thanks
    Subbu

    Thanks for all replies. Now, i am able to edit the cell on single click.

  • Usb mouse double click

    Hi,
    Im using fluxbox as window manager and after some upgrades the mouse very often doing double click, if I click only once. On touchpad is all right, so I dont know where is the problem. I tryed change xorg configuration - other protocol and some options, but nothing helped. I also tryed change speed double click, but nothing changed too.
    My xorg config is now:
    Section "InputDevice"
    Identifier "USB Mouse"
    Driver "mouse"
    Option "Device" "/dev/input/mice"
    Option "SendCoreEvents" "true"
    Option "Protocol" "IMPS/2"
    Option "ZAxisMapping" "4 5"
    Option "Buttons" "5"
    EndSection
    generated by hwd
    Thanks for all replies
    edit: I have kernel 2.6.33.4 and before in kernel 2.6.33.3 "mouse bug" was there too.
    Last edited by aivi (2010-05-15 11:47:40)

    edit: So Its not working well, xev show still that I pressed and released twice button, any ideas?
    In blackbox too. Its somewhere else.
    --------So it was by .fluxbox/keys I tried move them somewhere else and restart X and Its working right now. -------
    Last edited by aivi (2010-05-15 13:25:12)

  • Magic Mouse: Double-click function

    I have "secondary-click"(right) activated on the "magic mouse" and it's great if I want to open a drop-down list on a page.
    However, on the "mighty-mouse" which I had before, the "right-click" was set up to act as a "double-click" which was very handy for opening documents and folders etc.
    Is there any way to set up the "magic-mouse" so that a "right-click" will act as a "double-click"?

    You could try a third-party driver like BetterTouchTool (http://blog.boastr.net/?page_id=1722)

  • In Yosemite, Magic Mouse double-click function doesn't work

    On my iMac running Yosemite 10.10.2, the double-click function on the Magic Mouse no longer works. So to open a folder, or anything for that matter, I must always do click-control ---and that doesn't work for everything. For example, I can't double click on a character in Glyphs, so this renders Glyphs useless. And so on... I have gone into preferences to see if anything was amiss in the settings, but everything checked out fine. Is there a fix for this, or do I have to wait for the next upgrade for Yosemite? Help! Thanks... --Royce

    What's the answer to this mouse problem, please? Why does my double-click no longer work on my magic mouse since downloading Yosemite 10.10.2 to my iMac? 
    What's up Apple?
    Mark

  • Trying to catch mouse double click

    Using come code in the API 1.3 documentation, I created a JList and am trying to catch when a user double clicks on an item in the list. I have the following snippet of code:
    public void mouseClicked(MouseEvent e) {
    if ((e.getClickCount() == 3) && (e.getSource() == list1)) {
    int index1 = list1.locationToIndex(e.getPoint());
    System.out.println("Double clicked from the left list on Item " + index1);
    When I double click on an item in list1, it prints out the output line twice as in:
    Double clicked from the left list on Item 1
    Double clicked from the left list on Item 1
    How can I get it to run the code only once. I'm not sure why it's running it twice. Any Ideas would be helpful. Thanks....
    Matt Menard

    I've used similar procedure with success in JDK1.3.1. Without seeing the rest of your code, the only thing left for you to experiment with is to call the consume() method if the count is greater than 1. I did notice that Java mouse event handler leaves much to be desired. For example, the mouseentered and mouseexited events kept getting fired even tho the mouse has entered and never leave.
    V.V.

Maybe you are looking for

  • My 1st generation ipod is giving me troubles.

    When I try to connect to the internet, I type in my password and it says unable to join. But if I try it again slowly, it will join. The IP address, Subnet Mask, Router, and DNS codes show up. I can then access the internet. When I access the interne

  • Project wise cost comparision report

    Hi Gurus, Is there any report which include different cost i.e Budgeted value, actual value, actual revenue for projects (all wbs) executed in perticular time period. If i want to customize report which table and field required for the same pls provi

  • Please help me find solution to my BB Z10

    Please help me findout solution on what im gonna do to use again my BB Z10. Its totaly blackout when it opens its just the logo. I bought it 2ndhand only.this was the 2nd tym situation i dont know why other cp tech here in bicol dont know what soluti

  • Halfway through my update phone update my phone froze

    i was connecting and updating my 4 phone and it got almost all the way done but stopped and froze the phone. it is stuck on the black screenand apple symbol with the progress bar. the phone wont turn off and itunes wont recognize the device. other de

  • Installing Flash Player with new Google Chrome

    hello, i need help. i decided to try out the new google chrome and it works really well, but the flash player is not updated...so i've been trying to do so but its either my computer won't let me or somethings wrong. i can put the "install flash driv