This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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