View Single Post
  #1 (permalink)  
Old 12-10-2007, 11:58 PM
SwinGirl SwinGirl is offline
Member
 
Join Date: Nov 2007
Posts: 24
SwinGirl is on a distinguished road
GlassPane problem
hi! Here again!
I have this glass panel, wich it´s not actually working...
I mean.. the panel avoid to user get the components behind, but is not showing the label, and the opacity, and the color i´ve setted on it.
Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { MyGlassPane glassPane = new MyGlassPane(); glassPane.setOpaque(true); // JFrame f = (JFrame)WindowManager.getDefault().getMainWindow(); // f.setGlassPane(glassPane); JRootPane root SwingUtilities.getRootPane(component.getPanel().getParent()); root.setGlassPane(glassPane); root.getGlassPane(); glassPane.setEnabled(true); glassPane.setVisible(true); }
Code:
class MyGlassPane extends JComponent { public MyGlassPane(){ JLabel lbl = new JLabel(); lbl.setIcon((new javax.swing.ImageIcon(getClass().getResource("/org/myorg/guimodule/images/ajax-loader3.gif")))); this.add(lbl); lbl.setVisible(true); this.setOpaque(true); } public void paint(Graphics g) { super.paintComponent(g); g.setColor(new Color (255,255,255,100)); } }
what i´m doing wrong?
Reply With Quote
Sponsored Links