🔒 Locked
[java] JTable
Advertisement
Original Post
Hi. I have a JTable in which I disabled auto-resize and set the column widths myself. However, I want to resize the column that the user is editing, so that as he types letters, the column width increases. The column component is always a JLabel.
Thanks for the answers so far, but I got JTable to do what I wanted. I wouldn't switch now.
Quote:
Original post by Anonymous Poster Quote:
Original post by nmi
It is easier to use
Ah...only some parts. Many parts of Swing are very goodQuote:
probably less buggy than Swing
Nope - SWT is *much* more buggy than swing. Put it this way: SWT often crashes out the application trying to display standard stuff, swing NEVER does that.
SWT also works very very slow on some systems for no apparent reason. Rumour has it that only the windows version of SWT is properly optimized?Quote:
and has a shorter startup time.
Yup, and SWT could have lower memory requirements, although YMMV.
But the biggest thing about SWT is that it *can* be much "snappier", i.e. things redraw in a few milliseconds rather than a few hundred - although if you have a recent version of java, and learn how to use swing properly, you shouldn't be able to notice the difference in speed, yet still even doing everything right if you have a BIG gui, you often can tell swing is slower.
Maybe Swing improved in the meanwhile, but a test with JDK1.4.1 some time ago told me a different thing. Displaying a simple window using Swing took about 3 seconds. The same application using SWT took less than 1 second. Maybe my computer is special... ;-)
Quote:
If you do understand it, and STAY AWAY FROM JTABLE (and friends), you should be able to make something ultra-snappy.
Getting the complex widgets (tables, trees, lists, etc) to work *fast* all the time is actually very hard. In some cases, I've never managed to get it to run better than "only slightly jerky".
AP, what are your computer specs? Just out of curiosity?
Quote:
I use JTables for many things just fine. What problems are there with using a JTable?
Apparently, this problem:
Quote:
I have a JTable in which I disabled auto-resize and set the column widths myself. However, I want to resize the column that the user is editing, so that as he types letters, the column width increases. The column component is always a JLabel.
:)
Tried that, but it doesn't work because the column width doesn't change.
I also tried changing the column width itself, but the column loses focus...
I also tried changing the column width itself, but the column loses focus...
You probably have to implement some kind of new ColumnModel and then on every key event call table.fireDataChanged() or something like that. Tables can be abit messy but once you get used to them they are heaven!
@the one who wanted you to draw it on a canvas: Drawing on canvas is not more effective, if you know what you are doing with the table. Besides it will look soooo much nicer when you do it in a table than to dral black lines....
@the one who wanted you to draw it on a canvas: Drawing on canvas is not more effective, if you know what you are doing with the table. Besides it will look soooo much nicer when you do it in a table than to dral black lines....
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement