Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:31:53+00:00 2026-06-15T20:31:53+00:00

How to change jdesktoppane background image in MDI (Multiple Documents interface) using java netbeans?

  • 0

How to change jdesktoppane background image in MDI (Multiple Documents interface) using java netbeans? Means I added the jdesktoppane to java MDI so now I want to change default background image of that jdesktoppane which I’m using in java MDI. Any easy way?

Check attached snapshot link may be you will better understand my question what I want.

http://i50.tinypic.com/iml1e9.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:31:54+00:00Added an answer on June 15, 2026 at 8:31 pm

    +1 to MadProgrammers comment.

    Simply override JDesktopPane paintComponent(..) and call drawImage(Image img,int x,int y,ImageObserver io) to draw an image.

    Dont forget to honor the paint chain and call super.paintComponent(g) as first call in overridden paintComponent(..) method

    Here is an example:

    enter image description here

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.JDesktopPane;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.SwingUtilities;
    
    public class JInternalFrameDemo {
    
        private JDesktopPane jdpDesktop;
        private static int openFrameCount = 0;
        private BufferedImage img;
    
        public JInternalFrameDemo() {
            JFrame frame = new JFrame("JInternalFrame Usage Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
            try {
                img = ImageIO.read(new URL("http://images1.wikia.nocookie.net/__cb20120817224359/villains/images/6/6a/Nine-Tailed_Fox_(Naruto).jpg"));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
    
            // A specialized layered pane to be used with JInternalFrames
            jdpDesktop = new JDesktopPane() {
                @Override
                protected void paintComponent(Graphics grphcs) {
                    super.paintComponent(grphcs);
                    grphcs.drawImage(img, 0, 0, null);
                }
    
                @Override
                public Dimension getPreferredSize() {
                    return new Dimension(img.getWidth(), img.getHeight());
                }
            };
    
    
    
            createFrame(); // Create first window
    
            frame.setContentPane(jdpDesktop);
    
            frame.setJMenuBar(createMenuBar());
    
            // Make dragging faster by setting drag mode to Outline
            jdpDesktop.putClientProperty("JDesktopPane.dragMode", "outline");
    
            frame.pack();
            frame.setVisible(true);
        }
    
        protected JMenuBar createMenuBar() {
            JMenuBar menuBar = new JMenuBar();
            JMenu menu = new JMenu("Frame");
            menu.setMnemonic(KeyEvent.VK_N);
            JMenuItem menuItem = new JMenuItem("New IFrame");
            menuItem.setMnemonic(KeyEvent.VK_N);
            menuItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    createFrame();
                }
            });
            menu.add(menuItem);
            menuBar.add(menu);
            return menuBar;
        }
    
        protected void createFrame() {
            MyInternalFrame frame = new MyInternalFrame();
            frame.setVisible(true);
            // Every JInternalFrame must be added to content pane using JDesktopPane
            jdpDesktop.add(frame);
            try {
                frame.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {
            }
        }
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    new JInternalFrameDemo();
                }
            });
        }
    
        class MyInternalFrame extends JInternalFrame {
    
            static final int xPosition = 30, yPosition = 30;
    
            public MyInternalFrame() {
                super("IFrame #" + (++openFrameCount), true, // resizable
                        true, // closable
                        true, // maximizable
                        true);// iconifiable
                setSize(300, 300);
                // Set the window's location.
                setLocation(xPosition * openFrameCount, yPosition
                        * openFrameCount);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I change UINavigationBar background image with overloaded method @implementation UINavigationBar (Background) -(void) drawRect:(CGRect)rect {
Change all links that have an image in it to: javascript(alert(thehref)); eg. <a href=/galleries/anna-leah-111827/image01.html><img
To change the language on my website I've been using ressources and this code:
To change the appearance (background color and text foreground color) of a MFC checkbox
How change a type of call programmatically using Content Providers? From missed call to
To change whole row background color we can use getRowClass, but how to do
Change 12-16-23-some-words-now to 12/16/23/some-words-now thanks!! Your help is much appreciated.
change button image onclick then return to original image after click <style> img.button-send {
To change all TitledBorder fonts, I am using UIManager: UIManager.put(TitledBorder.font, new Font(Tahoma, Font.BOLD, 11));
I change some values of a tree node programmatically and want to show the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.