Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Horizontal Scrollbar in JTables
- From: tushark@xxxxxxxxxxxxxxxx (Tushar Karnad)
- Subject: Horizontal Scrollbar in JTables
- Date: Mon, 30 Aug 1999 17:59:26 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_0043_01BEF311.65FFD050
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
In my application, a JTable requires a horizontal scrollbar. I have =
placed the JTable in a scrollpane and have overridden the getSize() of =
the JTable so that it returns the actual size of the table depending on =
the amount of data to be displayed. Although the horizontal scrollbar of =
the scroll pane appears, the columns that are initially hidden donot get =
painted even after I move the scrollbar. I am adding a piece of my code.
It would be great if somebody could send me a working sample code of a =
JTable with a horizontal scroll bar.
table =3D new JTable(tableModel)
{
public boolean isFocusTraversable()
{
return false;
}
public Dimension getSize()
{
return new Dimension(actualTableWidth, =
actualTableHeight);
}
};
...
....
...
if (hScroll)
=
tablePane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_A=
LWAYS);
else
=
tablePane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_N=
EVER);
Thanx,
Tushar
------=_NextPart_000_0043_01BEF311.65FFD050
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3612.1706"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Hi,</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>In my application, a JTable requires =
a=20
horizontal scrollbar. I have placed the JTable in a scrollpane and have=20
overridden the getSize() of the JTable so that it returns the actual =
size of the=20
table depending on the amount of data to be displayed. Although the =
horizontal=20
scrollbar of the scroll pane appears, the columns that are initially =
hidden=20
donot get painted even after I move the scrollbar. I am adding a piece =
of my=20
code.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>It would be great if somebody could send me a =
working sample=20
code of a JTable with a horizontal scroll bar.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> table =3D =
new=20
JTable(tableModel)<BR> =20
{<BR> public =
boolean=20
isFocusTraversable()<BR> &=
nbsp;=20
{<BR> &n=
bsp; =20
return false;<BR> =20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
size=3D2> &nbs=
p; public=20
Dimension=20
getSize()<BR> =
=20
{<BR> &n=
bsp; =20
return new Dimension(actualTableWidth,=20
actualTableHeight);<BR> &n=
bsp; =20
}<BR> };</FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT color=3D#000000 =
size=3D2>...</FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT color=3D#000000 =
size=3D2>....</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT =
size=3D2>...</FONT></DIV>
<DIV><FONT color=3D#000000=20
size=3D2> &nbs=
p; if=20
(hScroll)<BR> =
=20
tablePane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_A=
LWAYS);<BR> &n=
bsp;=20
else<BR>  =
; =20
tablePane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_N=
EVER);<BR></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000 size=3D2>Thanx,</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>Tushar</FONT></DIV></BODY></HTML>
------=_NextPart_000_0043_01BEF311.65FFD050--
- Prev by Date: Movin ScrollBars from Code
- Next by Date: set the system time
- Previous by thread: Movin ScrollBars from Code
- Next by thread: Horizontal Scrollbar in JTables
- Index(es):