aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Graying out entire table. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Graying out entire table." Watch "Graying out entire table." New topic
Author

Graying out entire table.

Rio Reva
Greenhorn

Joined: Nov 19, 2006
Posts: 14
Hi,

I am having an option to gray out all the components in a panel, if the FTP service is not running.I am able to gray out all the components in the panel except the table in the panel.
I used setEnabled(false), for all these components, but doesn't seem to be working with table.Table still shows to be an active component.Can somebody help me so that I can give this table a grayed out look?
The table is put in a scroll pane, i am disabling scrollpane too.

Thanks in advance.
Reva.
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 863
    
    1
Originally posted by Rio Reva:
I used setEnabled(false), for all these components, but doesn't seem to be working with table.Table still shows to be an active component.Can somebody help me so that I can give this table a grayed out look?


The cell renderer that JTable uses by default doesn't pay attention
to whether the JTable is enabled or not. You can try something like


This should work if (1) you're using the default renderers, and
(2) the column type isn't Number/Date/Icon. If those don't hold,
you can do something similar but will have to make adaptations.

[edit: The column type list in (2) above should include Boolean.]
[ April 28, 2008: Message edited by: Brian Cole ]

bitguru blog
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Originally posted by Rio Reva:
Hi,

I am having an option to gray out all the components in a panel, if the FTP service is not running.I am able to gray out all the components in the panel except the table in the panel.


Other than the solution mentioned by Brian, there is another way to do this. You can extend a JPanel, set it to be translucent, add listeners to trap mouse events, and the set it as the glass pane. I had taken this approach in one of my previous swing applications.

Of course, this can work only if you want to disable all the components in the existing frame (well not really, there is a work around, but your requirement doesn't seem to be that complicated)


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graying out entire table.