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 transparent panel in applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "transparent panel in applet" Watch "transparent panel in applet" New topic

transparent panel in applet

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
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);
backgroundPanel.setLayout(new GridBagLayout());
((JPanel)container).setBorder(BorderFactory.createCompoundBorder(raisedbevel, l

JPanel helpPanel = new JPanel(new GridLayout(1,1));
//helpPanel.setBackground(new Color(255,255,255));
helpPanel.setPreferredSize(new Dimension(35,35));
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?

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:
subject: transparent panel in applet
It's not a secret anymore!