Article View: borland.public.jbuilder.java.swing
Article #642JScrollPane for JTable in a GridBagLayout
From: Oliver
Date: Fri, 01 Apr 2005 14:26
Date: Fri, 01 Apr 2005 14:26
24 lines
2047 bytes
2047 bytes
Hello, i am having some trouble in implementing a JScrollPane for a JTable (im showing database records there via SQL). The JScrollPane is placed on a JPanel which in turn resides on my main frame. My main Frame has a GridBagLayout.The JPanel has also a GridBagLayout. I am using table.setSize(...) to make the JTable bigger than the screen. This works ok. Now im using table.setPreferredScrollableViewportSize(t); where t is a region inside the screen (smaller than the JTable). Now: how big do i have to make the JScrollPane? 1) if i make the JScrollPane as big as the JTable, then there appears a horizontal ScrollBar (scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); but it has no knob for scrolling (i assume because they have the same size, the system thinks its not necessary) 2) if i make the JScrollPane as big as t (inside the screen), the JTable becomes also smaller (which i do not want - i want the JTable to be bigger than the screen). Does somebody have a hint how i can get a horizontal scrollbar which works for a JTable which is bigger than the screen? thanks Oliver
Technical Details
Message-ID:
<424d5a0c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,85f8a271796300bf,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Oliver" <o.maas@nospam_metrohm.de> Sender: "Oliver" <o.maas@nospam_metrohm.de> Reply-To: "Oliver" <o.maas@nospam_metrohm.de> Subject: JScrollPane for JTable in a GridBagLayout Newsgroups: borland.public.jbuilder.java.swing X-User-Info: 81.90.37.2 X-Forwarded-For: 192.168.103.10, 127.0.0.1 NNTP-Posting-Host: 207.105.83.66 Message-ID: <424d5a0c$1@newsgroups.borland.com> Date: 1 Apr 2005 06:26:20 -0800 X-Trace: newsgroups.borland.com 1112365580 207.105.83.66 (1 Apr 2005 06:26:20 -0800) Lines: 24 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail