Name: mc57594 Date: 12/05/99 java version "1.3beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O) Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode) /* Separately, opaque and Color.alpha work ok. * But a transparent (setOpaque(false)) component cannot be * placed on a panel with a background whose color's alpha!=255 * If you do it, one of the following 2 problems appear * a) in this example, * caret is not properly repainted when you move it * In the example I even place a second white opaque panel behind * the yellow panel * b) in other cases, * the color of the panel is not showed */ public class SwingApp extends JFrame{ public SwingApp(String name){ super(name); ///A white opaque background JPanel bottomPane = new JPanel(); bottomPane.setBackground(Color.white); bottomPane.setOpaque(true); getContentPane().add(bottomPane); JPanel pane = new JPanel(); bottomPane.add(pane); JTextPane t=new JTextPane(); t.setOpaque(false); //t.setBackground(Color.white); pane.setBackground(new Color(255,255,0,128)); pane.setOpaque(true); pane.add(t); pack(); setVisible(true); } public static void main(String args[]) { SwingApp t= new SwingApp("hola"); } } (Review ID: 98178) ======================================================================
|