How to set a background Image to JDesktopPane?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Maideen_Batcha
Posted On:   Friday, August 26, 2005 09:21 AM

I have to create a background Image to my JDesktopPane, for that i create a panel which implements ImageObserver and i add it to my JDesktopPane , but the imagepanel is not refreshed when i am opening other JInternalFrame in that desktop. I tried with a separate thread to refresh that panel , but also the same problem continuing. Anybody can help me or inform me any other means of seting background Image to DektopPane. The code which i used is given below scroll = new JScrollPane(); panel = new JDesktopPane(); panel.setOpaque(false); scroll.getViewport().add(panel); serverFrame.add("Center",scroll); JImagePanel imgPnl = new JImagePanel(250,200, panel.getBackground());    More>>

I have to create a background Image to my JDesktopPane, for that i create a panel which implements ImageObserver and i add it to my JDesktopPane , but the imagepanel is not refreshed when i am opening other JInternalFrame in that desktop. I tried with a separate thread to refresh that panel , but also the same problem continuing. Anybody can help me or inform me any other means of seting background Image to DektopPane. The code which i used is given below


scroll = new JScrollPane();

panel = new JDesktopPane();

panel.setOpaque(false);

scroll.getViewport().add(panel);

serverFrame.add("Center",scroll);

JImagePanel imgPnl = new JImagePanel(250,200, panel.getBackground());

imgPnl.revalidate();

imgPnl.repaint();

panel.add(imgPnl);

panel.setVisible(true);

panel.revalidate();

panel.repaint();

Here JImagePane is as

final class JImagePanel extends javax.swing.JPanel implements java.awt.image.ImageObserver.

   <<Less

Re: How to set a background Image to JDesktopPane?

Posted By:   Almagest_FUTT  
Posted On:   Friday, August 26, 2005 02:21 PM

I believe the easiest way to do such things, as already stated in a few other equivalent questions, still consists in overriding the specific component's paint(Graphics) method, therein to draw the image, and then to call super.paint(Graphics).
About | Sitemap | Contact