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.setName("localCellRenderer"); localCellRenderer.setFont(new Font("sansserif", 0, 12)); localCellRenderer.setBorder(LineBorder.createBlackLineBorder()); localCellRenderer.setBackground(Color.white); localCellRenderer.setForeground(Color.black); lastNameTableColumn = new javax.swing.table.TableColumn(); lastNameTableColumn.setCellRenderer(localCellRenderer); --------------------------------
the DefaultCellRenderer is a JLabel which normally it transparent (opaque == false). if you call renderer.setOpaque(true); 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. Chantal