This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes ListSelectionListener getting cell value and assigning it to a variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "ListSelectionListener getting cell value and assigning it to a variable" Watch "ListSelectionListener getting cell value and assigning it to a variable" New topic
Author

ListSelectionListener getting cell value and assigning it to a variable

Liam McTavish
Greenhorn

Joined: Aug 23, 2012
Posts: 2
i have set up a selectionListener on a JTable to select an id of a particular row. ID is a column in the row (col 0). i checked this within the ListCustPanel class that follows by having it printout the selectedID, it worked. but ive added the method getSelectedID() to get the selectedID for other classes that use the Panel, and it seems that the variable never gets assigned. whats the problem here?



so what im trying to say is i have another JFrame class as such, and im getting a null pointer exception from where i use the getSelectedID() method:
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 925
    
    2

Liam McTavish wrote:

this means, no row has been selected by the user yet. This code is present in the constructor of the frame. How would the user select a row before the JFrame, JPanel are constructed and shown to the user?


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ListSelectionListener getting cell value and assigning it to a variable
 
Similar Threads
JTable will not clear
JTable switching
Get data filter in JTable
JTable question
JTable not reflecting cell edit