Article View: borland.public.jbuilder.java.swing
Article #1446Re: Column Headers Don't Show in Table
From: Matthew Sweet
Date: Thu, 20 Nov 2003 20:45
Date: Thu, 20 Nov 2003 20:45
45 lines
2911 bytes
2911 bytes
Thanks. It's pretty obvious now. I think I was just looking at it too long
and the IDE was causing confusion.
Originally I had everything except for the
agentScrollPane.setViewportView(agentTable) and couldn't see my table at
all. Then I added the viewport part and could see the table when I ran my
application, but no header. For some reason I didn't think that I might have
to remove something rather than add something.
Thanks for your help.
Matthew Sweet
"Gillmer J. Derge (TeamB)" <spam@gillmerderge.com> wrote in message
news:3fbcfb74@newsgroups.borland.com...
> "Matthew Sweet" <matthew.sweet@sed.redstone.army.mil> wrote in message
> news:3fbcf8fd@newsgroups.borland.com...
> > agentTable.setToolTipText("");
> > agentTable.setTableHeader(null);
> > agentTable.setPreferredScrollableViewportSize(new
> Dimension(50,
> > 50));
> > agentScrollPane.add(agentTable, null);
> > agentScrollPane.setViewportView(agentTable);
> > agentScrollPane.setAutoscrolls(true);
> > agentScrollPane.setOpaque(true);
> > agentScrollPane.setBounds(new Rectangle(24, 73, 315, 99));
> > buildingAgentPanel.add(agentScrollPane, null);
>
> The table headers are displayed by a separate component, and there are
> two reasons why it isn't displaying (not sure why it shows in the
> designer).
>
> First, you're not adding the table header component to your UI. You
> should probably add it as the scroll pane's column header.
>
> agentScrollPane.setColumnView(agentTable.getTableHeader());
>
> Second, you're setting the table header to null, so in this case there
> isn't actually a table header to add to the scroll pane. You should
> remove the line where you set the table header to null.
>
> --
> Gillmer J. Derge (TeamB)
>
Technical Details
Message-ID:
<3fbd2842@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3fbcf8fd@newsgroups.borland.com> <3fbcfb74@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,6f2d4b99ec92edf9 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-11-20 13:11:00 PST Reply-To: "Matthew Sweet" <matthew.sweet@sed.redstone.army.mil> From: "Matthew Sweet" <matthew.sweet@sed.redstone.army.mil> Newsgroups: borland.public.jbuilder.java.swing References: <3fbcf8fd@newsgroups.borland.com> <3fbcfb74@newsgroups.borland.com> Subject: Re: Column Headers Don't Show in Table Date: Thu, 20 Nov 2003 14:45:33 -0600 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 136.205.73.67 Message-ID: <3fbd2842@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1069361218 136.205.73.67 (20 Nov 2003 12:46:58 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail