Manipulating the size of the track and knob in a scrollbar of a JTable
From: Dave (Davel*removethistosendemail*_at_superstar.demon.nl)
Date: 11/15/03
- Next message: Dave: "Re: changing an int value across classes,kind of working :s"
- Previous message: kevinc: "Re: making a modal progressdialog with SWING"
- Next in thread: Dave: "Re: Manipulating the size of the track and knob in a scrollbar of a JTable"
- Reply: Dave: "Re: Manipulating the size of the track and knob in a scrollbar of a JTable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 15 Nov 2003 20:28:39 +0100
Hello there,
I have a JTable added to a JScrollPane. The JTable shows the contents of a
databasetable. I only want to load the datarows from the database when they
are needed (meaning: when they are in the visible area of the JTable),
because the JTable could show only 10 rows, while the databasetable could
contain thousands of rows. I have accomplished this by overriding the
getScrollableBlockIncrement and getScrollableUnitIncrement methods of
JTable, from where data is loaded from the database. The size of JTable's
datamodel is therefore always the size of the rows visible. I have set the
vertical scrollbar to be always visible. Furthermore, the datamodel holds a
datastructure with the primary key values for all the rows in the
databasetable; this allows me to fetch the complete datarow when I need it.
Now I have the following problem: the size of the knob on the vertical
scrollbar in relation to the size of the track is based on the number of
rows visible and the number of rows in the datamodel of JTable (at least,
that's my conclusion), and this is obvious not what I want. I want the size
of the knob and the size of the track to be related to the rowcount of the
databasetable and not to the rowcount of the datamodel.
I hope there is someone out there who can give me some pointers in how to
accomplish this? Also suggestions that take a completely different approach,
but prove to be working, are much appreciated.
Thanks in advance.
Dave
---------------------------------------------------------------------
Computers, you can't live with them and you can't live without them.
---------------------------------------------------------------------
- Next message: Dave: "Re: changing an int value across classes,kind of working :s"
- Previous message: kevinc: "Re: making a modal progressdialog with SWING"
- Next in thread: Dave: "Re: Manipulating the size of the track and knob in a scrollbar of a JTable"
- Reply: Dave: "Re: Manipulating the size of the track and knob in a scrollbar of a JTable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|