This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Set Table row data in to a form by action listener  RSS feed

 
Ranch Hand
Posts: 174
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers....
I'm doing a swing application.
I have a  Table and input form.What I want to do is when I click a row in the table The input form must fill with the data that table row has.
I created my own table model by extending Default table model.
this is a part of that TableModel.java





this is how I call my action listener by click a row

;

this is the setDataToInsertPanel method in Input form



 
  When I debug my prgram I found that my Arrry index bound exception is occur inside the getSelectedData(selectedRow) method.
please some one help me to get out from this problem.



 
Rancher
Posts: 3000
20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I created my own table model by extending Default table model.



The DefaultTableModel already provides data storage and methods to access the data. You typically only extend DefaultTableModel to override methods like getColumnClass(...), isCellEditable(...) to change the default behaviour of the model.

If you want to store a custom object then you should be extending AbstractTableModel and you then need to implement all the methods of the TableModel interface to access the data in your custom model.

Check out the Row Table Model for a step by step example on how to create a custom model.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!