wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes transparent panel in applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "transparent panel in applet" Watch "transparent panel in applet" New topic
Author

transparent panel in applet

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Hi,
I have an applet with a JScrollPane (backgroundPanel) that has a background image painted on it. To this backgroundPanel I add a panel with a button and a transparent image painted over that button (helpPanel). Now, I set helpPanel.setOpaque(false) in order for the helpPanel to be painted with the background of backgroundPanel, but all I get is gray background of the container I guess. I do add backgroundPanel to the container.
Here are bits of code:
backgroundImage = getImage(getDocumentBase(),"../generic_images/" + gne.returnB
utton(313)); // get background image
backgroundPanel = new screenPanel(backgroundImage);
container = getContentPane();
JScrollPane jspanel = new JScrollPane(backgroundPanel);
container.add(jspanel);
backgroundPanel.setLayout(new GridBagLayout());
backgroundPanel.setBackground(Color.white);
((JPanel)container).setBorder(BorderFactory.createCompoundBorder(raisedbevel, l
oweredbevel));

JPanel helpPanel = new JPanel(new GridLayout(1,1));
helpPanel.add(help);
//helpPanel.setBackground(new Color(255,255,255));
helpPanel.setPreferredSize(new Dimension(35,35));
helpPanel.setOpaque(false);
parentButtonsBox.add(logoPanel);
parentButtonsBox.add(Box.createHorizontalStrut(2));
parentButtonsRightBox.add(kwiLogoPanel);
parentButtonsRightBox.add(Box.createHorizontalStrut(2));
parentButtonsRightBox.add(helpPanel);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 9;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
backgroundPanel.add(parentButtonsRightBox, gridBagConstraints);
Does anybody know what am I doing wrong here?
thanks,
Alex


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: transparent panel in applet
 
Similar Threads
background image
Background image not loading on JPanel
Building a splash screen
urgency!!! In Japplet, how to make......
GridBagLayout background image