File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes TableRow background color problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TableRow background color problem" Watch "TableRow background color problem" New topic

TableRow background color problem

Rambo Rambabu

Joined: Jul 12, 2002
Posts: 21
Hi, we are writting applet based siwng application. Once user logs in using the applet, a separate MainWindow frame is opened with a menu etc, which looks like any regular stand alone application
We are using VAJ 4.0 for developing and deploying in WebSphere4.0. For standalone testing we run the applet by selecting (within VAJ) this applet and Run Main Option. When running in this way every thing looks fine for JTable rows. ie rows have white background color and black text.
When we run the same using the browser which opens up a main window frame, the table rows have gray background.
Can anyone tell how to get white background while running under applet mode also...
I am attaching code snippets I am using for background color...
thanks in advance,
-- rambo
For table: OrderDetailsScrollPaneTable.setBackground(new java.awt.Color(204, 204, 204));

For tablecolumns:
DefaultTableCellRenderer localCellRenderer;
localCellRenderer = new DefaultTableCellRenderer();
localCellRenderer.setFont(new Font("sansserif", 0, 12));
lastNameTableColumn = new javax.swing.table.TableColumn();
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
the DefaultCellRenderer is a JLabel which normally it transparent (opaque == false). if you call
explicitely, the renderer will paint the background.

public void setOpaque(boolean isOpaque)
If true the component paints every pixel within its bounds. Otherwise, the component may not paint some or all of its pixels, allowing the underlying pixels to show through.
The default value of this property is false for JComponent. However, the default value for this property on most standard JComponent subclasses (such as JButton and JTree) is look-and-feel dependent.

I suppose, VAJ runs you app using another lokk and feel (windows look & feel?), while the browser uses motif.
I agree. Here's the link:
subject: TableRow background color problem
It's not a secret anymore!