Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5495
| X-Received | by 10.25.89.6 with SMTP id n6mr3496513lfb.8.1466577314283; Tue, 21 Jun 2016 23:35:14 -0700 (PDT) |
|---|---|
| X-Received | by 10.157.10.111 with SMTP id 102mr36482otg.14.1466577314187; Tue, 21 Jun 2016 23:35:14 -0700 (PDT) |
| Path | csiph.com!goblin1!goblin.stu.neva.ru!w10no5961128lbo.0!news-out.google.com!di11ni23245lbb.1!nntp.google.com!w10no5961125lbo.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.gui |
| Date | Tue, 21 Jun 2016 23:35:13 -0700 (PDT) |
| In-Reply-To | <12e4f4ff.0305140853.7eed19ec@posting.google.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=62.218.63.251; posting-account=0S7cAAkAAAA3bWzULLf2nF2S0PpnXz22 |
| NNTP-Posting-Host | 62.218.63.251 |
| References | <12e4f4ff.0305090118.65305e15@posting.google.com> <3EBB8559.4000904@yahoo.com> <12e4f4ff.0305140853.7eed19ec@posting.google.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <768a123f-7a71-41b8-920d-112837b3f465@googlegroups.com> (permalink) |
| Subject | Re: Identifying text truncation in JTable cells |
| From | herphan@gmail.com |
| Injection-Date | Wed, 22 Jun 2016 06:35:14 +0000 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.java.gui:5495 |
Show key headers only | View raw
Thanks for the hints on how to do this. I elaborated a little on it trying to get rid of the TableColumn. I aldready had a subclass of DefaultTableCellRenderer doing some custom coloring in getTableCellRendererComponent(). I could extend this method for doing the tooltip stuff - see this stripped down version:
public class TableCellRendererMy extends DefaultTableCellRenderer implements TableCellRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
double cellPrefWidth = getPreferredSize().getWidth();
double cellWidth= table.getCellRect(row, column, false).getWidth();
if (cellPrefWidth>cellWidth) {
try {
setToolTipText(String.valueOf(value));
} catch (Exception e) {
}
}
return this;
}
}
regerds,
stephan
Back to comp.lang.java.gui | Previous | Next | Find similar
Re: Identifying text truncation in JTable cells herphan@gmail.com - 2016-06-21 23:35 -0700
csiph-web