Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

Jtable Scrollbar, table Background color, JLabel issues.

Thread view: 
v796 - 23 Jan 2004 16:47 GMT
Hi,
I am implementing a JTable. Using TableModel and JScrollPane( the
usual).

JTable(32*3)
Vertical scroll bar ALWAYS
Horizontal scroll bar AS NEEDED

Problems:

1: Vertical scroll bar doesnt show up! What do i do?

2: I want to change the color of the table (not grid lines); its
background
i.e of all the individual cells. How?

3: For column 0 -- values are hardcoded(0 thru 31)
  For column 1 -- will keep changing
  For column 2 -- will keep changing

How do I do that? I know have to override getValueAt(), but what are
the first steps?

I do not want to make it user editable though.

Is Jtable right for the above?

4: Consider a JLabel. If I want to display a message to user and
depending on the action taken replace that by another message, 1 way
to do that is replace the old label by blank string then put in the
new message. Can't this be done in 1 step? Should i use anything else
that JLabel?

I am returning to Swing after 2 years. Thats why such newbie
questions. Have forgotten everything. :-(

Any help/comments are appreciated.

Sincerely,
v796
Jan Vettenburg - 25 Jan 2004 20:23 GMT
For your first question : myTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF).

For question 2 : create your own CellRenderer which is colored to your
preferred colour. Than ensure that all columns are painted with this cell
renderen

> Hi,
> I am implementing a JTable. Using TableModel and JScrollPane( the
[quoted text clipped - 36 lines]
> Sincerely,
> v796


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.