Dennis McNulty

Greenhorn
+ Follow
since Apr 28, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Dennis McNulty

Rob -

(Problem resolved)

Your SSCEE had the answer to my problem. Setting the background in the table header filled in the empty space. I had thought that a JTableHeader object was merely a reorganization of data in the JTableColumnModel, and didn't have any displayable items of its own. In my large app, I am using custom table header renderers, declared as parts of TableColumns, and I had never needed to deal with table headers.

Your SCCEE also held another surprise for me. I had thought that it wasn't allowed to have a null JTableModel. About 100 lines of code in my first posting were devoted solely to building the table model.

Again, though, I'd like to know if there is some place for greenhorns like me to find existing SSCEEs. If I had known about this TableDemo2 one, I wouldn't have needed to bother anyone at CodeRanch about my problem.

Thanks - Dennis
13 years ago
I didn't know that Oracle demo programs didn't qualify as SSCCEs. I was hoping to avoid creating a lot of source code from scratch. Thank you for the example SSCCE. I'll give it a try in a little while. Is there any kind of repository of SSCCEs for new forum users like me?

Thanks - Dennis
13 years ago
I have a situation with a table that's narrower and shorter than the enclosing scroll pane's viewport, and column auto-resizing is turned off, so there's empty space below and to the right of the table. I'd like to fill the empty space with a single background color. I can fill in the bottom using scrollPane.setBackground(), and I can set most of the right side using scrollPane.getViewport().setBackground(). But I'm still left with an uncolored strip to the right of the table's column headers. I've tried using setBackground on the scroll pane's enclosing panel, and also tried using scrollPane.setColumnHeaderView() to force a new colored JPanel, but neither method has worked.

Is there any way to fill in that strip right of the table's column headers?

Below is the code I'm using, a slight variation of TableDemo.java from Oracle's Swing Example set.

Thanks in advance for any help. - Dennis


13 years ago