Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-10-2007, 05:02 PM
Member
 
Join Date: Jul 2007
Posts: 5
arubin is on a distinguished road
JTable Gridline in selected row
I am trying to set up a JTable so that it looks like a JList so that I can use different colours in cells and have everything nicely arranged in columns.

I do not want any grid lines showing so I have table.setShowGrid(false);

My problem is that when I select a row I want it highlighted but I get a white vertical gridline showing in the selected line. Please help me get rid of this line. I want a solid block of background colour across the row.

The code which handles the highlighting is an implemenation of TableCellRenderer in

public Component getTableCellRendererComponent(
.............................
if(isSelected){
setBackground(Color.getHSBColor(0.6F,0.2F,0.9F));
}else {
setBackground(Color.white);
}

Last edited by arubin : 07-11-2007 at 11:20 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-10-2007, 05:31 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Can you attach a screenshot of the problem? It is difficult to understand your problem by just reading.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-10-2007, 09:47 PM
Member
 
Join Date: Jul 2007
Posts: 5
arubin is on a distinguished road
I want to get rid of the vertical white line in the highlighted blue line. I want solid colour right acrosss.

TIA
Attached Images
File Type: jpg screen.jpg (9.6 KB, 3 views)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-10-2007, 10:27 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Hi Arubin,

If you want to have a customized rendered list, why don't you use a custom cell renderer for a list. Check the following resource for more information:

How to Use Lists (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-10-2007, 11:28 PM
Member
 
Join Date: Jul 2007
Posts: 5
arubin is on a distinguished road
There is nothing in that tutorial which indicates that what I want to do can be done. What I want works nicely in JTable. I just want to be rid of that irritating white line.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-11-2007, 12:24 AM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
That is the result of having two columns. May be you can implement your own look and feel in this case
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-11-2007, 12:57 AM
Member
 
Join Date: Jul 2007
Posts: 5
arubin is on a distinguished road
In other words it cannot be done.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 07-11-2007, 11:20 AM
Member
 
Join Date: Jul 2007
Posts: 5
arubin is on a distinguished road
So how do I go about achieving what I want which is a list with items neatly arranged underneath each other and using different colours.

Actually I have managed to achieve this in a list using monospace fonts and I can control colours with html. But I do not really want to use monospace fonts. Is there another way of doing it?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 07-11-2007, 11:50 AM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Why don't you use Custom Cell Renderer described here:

How to Use Lists (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)

As far as i see, if you implement ListCellRenderer, you can return whatever component you want (in different color, shape, type ...).
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 11-06-2007, 01:02 PM
Member
 
Join Date: Nov 2007
Posts: 10
iimasd is on a distinguished road
How can I add an ICON on a JDialog's Title-Bar?
How can I add an ICON on a JDialog's Title-Bar??
TIA.
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 11-06-2007, 02:04 PM
Member
 
Join Date: Nov 2007
Posts: 10
iimasd is on a distinguished road
sorry i posted the above question in the wrong place....
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applet - Displaying an HTML page with a selected resolution Java Tip Java Tips 0 03-10-2008 04:36 PM
How to add in a new row in Jtable? Ry4n AWT / Swing 0 01-18-2008 02:26 PM
Show Text Fields on combo Box selected value smajidali26 AWT / Swing 0 11-29-2007 11:28 AM
Help with JTable fernando AWT / Swing 1 08-07-2007 08:57 AM


All times are GMT +3. The time now is 12:51 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org