Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

regarding JTable

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raja.tadi@tcs.com
Hi
I have a doubt in JTable, i can create a Table using DefaultTableModel with some rows and columns.after data to be displayed in the table,i can get the mouse events for individual cell,for one particular cell i can provide hyperlink.once i clicked on that hyperlink,i want to create or open another window with JTable,in that table i want to show the previous table data in the current table window.how to pass arguments from one JTable to another JTable window ?
Thanks in advance
Raja ..
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Once you click on the hyperlink, you need to open an page with JTable, right? So you are just trying to open a new page in swing.

I beleive you can do it in many ways.

1. pass the values as a collection to the constructor of the calling class. Then just use this collection in your table model.

2. Take a static collection which will be accesible with entire application.

Please let me know if you still face this issue.
 
tadi raja
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramakanta Biswal

I got some idea but i want JTable with some rows and columns with one cell as hyperlink,once user click on that hyperlink,it will open another JDialog with previous JTable contents along with some not table data as JLabel.what shall i do it ?
 
Ramakanta Biswal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I understand that you have a jtable with somw rows and cols and last col of each row is a hyperlink. Look when you are displaying data in the jtable you must take an Object[][] of data to display, right? You should have your own table model which must override the default table model.
Once you click on any hyperlink, you should know the row no of that table by getSelectedRow() let say i. So Object[i][] are the data you want to display on the JDialog with label.

So the best way is make this Object[][] is static, pass i to the constructor of JDialog. Display Object[i][] in the jdialog as label. simple!!!
 
permaculture is largely about replacing oil with people. And one tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!