Results 1 to 2 of 2
  1. #1
    asai is offline Member
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    96
    Rep Power
    0

    Default Gain focus in JTable

    Hi,

    I am trying to get a selected column from a jTable.
    Here is my code:
    Java Code:
     private void ledgerTableFocusGained(java.awt.event.FocusEvent evt) {
    int selectedRow = ledgerTable.getSelectedRow();
    int account = Integer.parseInt(ledgerTable.getModel().getValueAt(selectedRow, 0).toString());
    Ledger ledger = new Ledger();           
    ledger = LedgerTable.select(account);
    ledger.getaccount();
    String konto = Integer.toString(account);
    testLabel.setText(konto);
    And I want the first column(0) to be displayed in a label (testLabel)
    But something is wrong, but I don't see it. Can anyone tell me whats missing?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,947
    Rep Power
    16

    Default Re: Gain focus in JTable

    Quote Originally Posted by asai View Post
    But something is wrong, but I don't see it. Can anyone tell me whats missing?
    1. A clear description of what is wrong. We're not mid readers here.

    2. A SSCCE (Short, Self Contained, Correct (Compilable), Example) that members here can compile and execute to identify the problem.

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. Replies: 1
    Last Post: 02-27-2012, 03:01 PM
  2. How to change the focus order of JTable
    By chyrl in forum AWT / Swing
    Replies: 0
    Last Post: 05-05-2010, 02:00 PM
  3. JTable Cell Focus Listener
    By Manfizy in forum New To Java
    Replies: 1
    Last Post: 07-21-2009, 08:08 AM
  4. JComboBox in JTable and Cant get Focus...
    By markw8500 in forum New To Java
    Replies: 1
    Last Post: 03-29-2009, 11:35 PM
  5. JTable Focus Traversal
    By helios_lie in forum AWT / Swing
    Replies: 1
    Last Post: 12-20-2007, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •