The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by cjacobs]

Hi,

is there a way for me to disable table columns. For example, if the user click
on a column there would be no highlight or any indication that the column was
selected.

Thanks in advance,

Curtney Jacobs
import-bot (20211) [Avatar] Offline
#2
Re: JTable Column
[Originally posted by matt]

Call the following on your JTable

setRowSelectionAllowed(false)
setColumnSelectionAllowed(false)
setCellSelectionEnabled(false)
import-bot (20211) [Avatar] Offline
#3
Re: JTable Column
[Originally posted by cjacobs]

> Call the following on your JTable
>
> setRowSelectionAllowed(false)
> setColumnSelectionAllowed(false)
> setCellSelectionEnabled(false)


Thanks for your reply!

However, I did finally figure it out, but my table is still showing a Focus
border on the cell.

Is there a method I can call on my columnModel to turn off all selection
indications.
ie.
getColumnModel().getColumn(0).XXXXXXX;

I don't think there is such a method, perhaps you can offer an alternate
solution.

Thanks in advance,

Curtney Jacobs
import-bot (20211) [Avatar] Offline
#4
Re: JTable Column
[Originally posted by matt]


> Is there a method I can call on my columnModel to turn off all selection
> indications.
> ie.
> getColumnModel().getColumn(0).XXXXXXX;


Use your own cell renderer... the default table cell renderer places a
one-pixel-thick border around 'selected' cells (whether selection is enabled
or not). You need to use your own cell renderer to get rid of this behavior.