• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

transparent panel in applet

 
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic