CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > Swing > JDesktopPane in Java Swing

Swing Tutorial

  • What Is Java Swing
  • First Program
  • What is AWT
  • Advantages of Swing Over AWT
  • JFrame
  • Swing Components
  • JLabel
  • JTextField
  • JPasswordField
  • JButton
  • Event Handling
  • FlowLayout
  • BorderLayout
  • GridLayout
  • GridBagLayout
  • BoxLayout
  • JPanel
  • JCheckBox
  • JRadioButton
  • Border Component
  • JComboBox
  • JList
  • JList with MVC
  • Mouse Event
  • Key Event
  • JMenuBar
  • JTextArea
  • Using Color
  • Use Font
  • Display Image/Icon
  • Dialog Box
  • JTable
  • JDesktopPane and JInternalFrame
  • JDesktopPane
  • JInternalFrame
  • Adapter Classes
  • Swing Timer
  • JScrollPane
  • JSlider
  • JProgressBar
  • JSeparator
  • JToolBar
  • ActionListener
  • ItemListener
  • Worker Thread
  • Nimbus Look and Feel
  • Home

JDesktopPane in Java Swing

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Last updated: July 1, 2026 · 1 min read · 0 Comments
Share: in X

JDesktopPane in Java Swing is a container that allows us to create an MDI (Multiple Document Interface) application in Java. An MDI application is an application that can have multiple child windows within the main window. Each child window represents a different document or task, and the user can switch between them.

JDesktopPane is a container used to hold multiple internal frames. It acts as a workspace for internal frames, allowing them to be managed and displayed within its bounds. It provides a platform for arranging internal frames, enabling overlapping, minimizing, maximizing, and tiling of these frames.

JDesktopPane Example

Following is aa basic example of how we can create and use a JDesktopPane:

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;

public class JDesktopPaneDemo {
	public static void main(String[] args) {
		JFrame frame = new JFrame("Desktop Demo");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JDesktopPane desktopPane = new JDesktopPane();
		frame.add(desktopPane);

		JInternalFrame internalFrame = new JInternalFrame("Internal Frame", true, true, true, true);
		internalFrame.setSize(200, 200);
		internalFrame.setVisible(true);

		desktopPane.add(internalFrame);

		frame.setSize(400, 400);
		frame.setVisible(true);
	}
}

Output:

JDesktop Pane in java swing

Reference: Internal Frame

Related Posts:

  • Control Statements in Java
  • Switch Statement with Strings in Java
  • What Is Java Swing? A Complete Guide to Java’s GUI Toolkit
  • Java Swing Tutorial
  • Update MongoDB Document
  • How to create Windows Task Scheduler and run a Java…
Tags:javaswing
Was this article helpful?
← Previous ArticleJTable in Java Swing
Next Article →What is JVM (Java Virtual Machine)? Architecture, Working, and Key Features

Recent Posts

  • How to implement Passwordless Authentication in Spring Boot: A Step-by-Step Guide
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Linkedin

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
© 2026 CoderSathi. All rights reserved. Privacy Policy · Sitemap