• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Java » Swing » JDesktopPane in Java Swing Example
Next →
← Prev

JDesktopPane in Java Swing Example

By Dinesh Thakur

Many of today’s applications provide a facility wherein the users can open multiple documents without having to close current document. They can then switch between the documents and update them. For this purpose, applications use the multiple-document interface to manage these multiple open documents being processed in parallel (This is a main window, often called parent window, which contains several other windows, which also called child window.) JDesktopPane and JlnternalFrame classes of the Swing package help to create these multiple-document interfaces.

                       Constructors and methods in the JDesktopPane class.

 

Constructors and Methods

Description

JDesktopPane()

Constructs a new JDesktopPane object.

JlnternalFrame()

Constructs a new JlnternalFrame object, which is a non-resizable, non-closable, non-maximizable, non iconifiable internal frame.

JlnternalFrame(String title)

Constructs a new JlnternalFrame object with the specified title, which is non-resizable, non-maximizable, non- closable, non-iconifiable internal frame.

JInternalFrame(String title, boolean resizable)

Constructs a new JlnternalFrame object with the specified title and if resizable is set true, then it is resizable internal frame, which is non-maximizable, non-closable and non iconifiable.

JInternalFrame(String title, boolean resizeable, boolean closable)

Constructs a new JlnternalFrame object with the specified title and if resizable and closable are set true, then this internal frame is both resizable and closable but non maximizable and non-iconifiable.

JInternalFrame(String title, boolean resizable, boolean dosable, boolean maximizable)

Constructs a new JlnternalFrame object with the specified title and if resizable closable and maximizable are set true, then this internal frame is resizable, closable and maximizable but non-iconifiable.

JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)

Constructs a new JlnternalFrame object with the specified title and if resizable, closable, maximizable and iconifiable are set true, then this internal frame is resizable, closable, maximizable and iconifiable.

Container getContentPane()

Returns the content pane of this internal frame.

JMenuBar getJMenuBar()

Returns the current jMenuBar object for this internal frame or returns null if no menu bar is set.

String get Title()

Returns the title of this internal frame.

protected void paintComponent(Graphics g)

Paints the current component in internal frame.

Void remove(Component component)

Removes the specified component from this internal frame.

void reshape(int x, int y, int width, int height)

Moves and resizes the internal frame to the size specified by the parameters.

void show()

Displays the internal frame as well as brings it to front.

                                 

Program demonstrates the use of jDesktopPane.

import java.awt.*; 
import javax.swing.*;
import java.awt.event.*;
public class JavaExampleInternalFrameInAppletSwing extends JApplet implements ActionListener
 {
    JDesktopPane Dsktppn = new JDesktopPane();
    static int FrmNmbr = 1;
    public void init()
    {
        JPanel Pnl = new JPanel();
        Container Cntnr = getContentPane();
        JButton BtnFrme = new JButton("Click For Internal Frame");
        Pnl.add(BtnFrme);
        Cntnr.add(Pnl,BorderLayout.SOUTH);
        Cntnr.add(Dsktppn,BorderLayout.CENTER);
        BtnFrme.addActionListener(this);
    }
        public void actionPerformed(ActionEvent Evnt)
         {
            JInternalFrame Intrnlfrm = new JInternalFrame();
            Container Cntnr = Intrnlfrm.getContentPane();
            Intrnlfrm.setLocation(5,5);
            Intrnlfrm.setTitle("Internal Frame"+FrmNmbr);
            FrmNmbr++;
            Intrnlfrm.setClosable(true);
            Intrnlfrm.setResizable(true);
            Intrnlfrm.setMaximizable(true);
            Intrnlfrm.setIconifiable(true);
            Intrnlfrm.setVisible(true);
            Cntnr.setLayout(new FlowLayout());
            Cntnr.add(new JTextArea(5,10),"Center");
            Intrnlfrm.pack();
            Dsktppn.add(Intrnlfrm,2); 
        }
 }
/*<APPLET CODE =JavaExampleInternalFrameInAppletSwing.class WIDTH=370 HEIGHT=300></APPLET>*/

 JDesktopPane in Java Swing Example

You’ll also like:

  1. JList in Java Swing Example
  2. SpringLayout in Java Swing Example
  3. FocusListener in Java Swing Example
  4. CheckerBoard Java Swing Example
  5. Gradient in Java Swing Example
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

SQL Tutorials

SQL Tutorials

  • SQL - Home
  • SQL - Select
  • SQL - Create
  • SQL - View
  • SQL - Sub Queries
  • SQL - Update
  • SQL - Delete
  • SQL - Order By
  • SQL - Select Distinct
  • SQL - Group By
  • SQL - Where Clause
  • SQL - Select Into
  • SQL - Insert Into
  • SQL - Sequence
  • SQL - Constraints
  • SQL - Alter
  • SQL - Date
  • SQL - Foreign Key
  • SQL - Like Operator
  • SQL - CHECK Constraint
  • SQL - Exists Operator
  • SQL - Drop Table
  • SQL - Alias Syntax
  • SQL - Primary Key
  • SQL - Not Null
  • SQL - Union Operator
  • SQL - Unique Constraint
  • SQL - Between Operator
  • SQL - Having Clause
  • SQL - Isnull() Function
  • SQL - IN Operator
  • SQL - Default Constraint
  • SQL - Minus Operator
  • SQL - Intersect Operator
  • SQL - Triggers
  • SQL - Cursors

Advanced SQL

  • SQL - Joins
  • SQL - Index
  • SQL - Self Join
  • SQL - Outer Join
  • SQL - Join Types
  • SQL - Cross Join
  • SQL - Left Outer Join
  • SQL - Right Join
  • SQL - Drop Index
  • SQL - Inner Join
  • SQL - Datediff() Function
  • SQL - NVL Function
  • SQL - Decode Function
  • SQL - Datepart() Function
  • SQL - Count Function
  • SQL - Getdate() Function
  • SQL - Cast() Function
  • SQL - Round() Function

Other Links

  • SQL - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW