email@example.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 ..
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.
posted 11 years ago
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 ?
posted 11 years ago
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