When any row in the JTable is clicked, I am trying to create a special database for that row and open a new JFrame. So actually I want to create a custom page for each row. For example, there are 5 rows in JTable, and when I click on each row, a new frame will open and a special text will be written for each row in a JLabel inside the frame (of course, the user will set what to write ). How can I do that?
#Creating a custom data when clicking row in JTable
13 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @fiery flare! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Why don't you use GridLayout with buttons
or use ActionListener
this will fire and event and each time that the cell is clicked just create a new Framwe
I already did this. What I'm trying to do is to create a database and JFrame for that row when a JTable row is clicked.
that will remember user input even after the termination of JVM
what a mean?
By a database you mean that will remember user input even if he close the aplication
yes
ok I try that one time and I figgured out that with FIleReader and FileWriter and some regex you could write the user input in a txt file and it read it back when you will reuse the program
you could implement that using next steps:
- add mouse listener on your jtable
- in listener method you figure out what row was clicked
- collect the data from that row
- create specific frame with passing collected row data as argument, and render that data on the frame
Not clear description of thecreating specific database, so you should elaborate that part