16. maj 2000 - 19:48Der er
3 kommentarer og 1 løsning
Om GUI´s and tables
Imagine that you have to print a JTable, but the outcoming data depends on a decidion made by the User in the same Frame... In my case the user selects a field in a JList (represents an Object that contains a vector of vectors). The information is now passed to the JTable´s constructor. So when the user goes back and selects another field in the JList, the table should now change it´s data... but of course it doesn´t (what a surprise in java...) Is there anyone that can help me?. Jose.
Well, It´s possible to have to different aplications. The first with the Jlist and a JButton, so when you make a selection in the table and the button is clicked you close the first aplication and starts with the second aplication, that has the table with the data you need... but this is not so smart...
Either you have to make it possible for the JTable to configure itself, each and every time the user selects a new field. I dont know if JTable has this functionality already, but instead, you could pass the newly selected field to a new JTable's constructor, and put the new JTable in the old JTable's place, and then update/repaint your frame.
It would of course involve an awful lot of object construction, which is not the fastest thing you can do, but it should be possible.
TableModel is the better solution, it takes so long to find out how it works, but is cool. Thanks.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.