- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set Palette Layer for JDesktopPane in Java?
At first, create a JDesktopPane −
JDesktopPane desktopPane = new JDesktopPane();
Now, create an Internal Frame −
JInternalFrame intFrame = new JInternalFrame("Our Frame", true, true, true, true); intFrame.setBounds(50, 90, 200, 250);
Set Pallette layer for JDesktopPane and add the Internal Frame to JDesktopPane −
intFrame.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); desktopPane.add(intFrame,JDesktopPane.PALETTE_LAYER);
The following is an example to set palette layer for JDesktopPane −
package my; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; public class SwingDemo { public static void main(final String[] args) { JFrame frame = new JFrame("Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktopPane = new JDesktopPane(); JInternalFrame intFrame = new JInternalFrame("Our Frame", true, true, true, true); intFrame.setBounds(50, 90, 200, 250); intFrame.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); desktopPane.add(intFrame,JDesktopPane.PALETTE_LAYER); JLabel label = new JLabel(intFrame.getTitle(), JLabel.CENTER); JButton button = new JButton("Demo Button"); intFrame.add(label, BorderLayout.CENTER); intFrame.add(button, BorderLayout.WEST); intFrame.setVisible(true); frame.add(desktopPane, BorderLayout.CENTER); frame.setSize(600, 500); frame.setVisible(true); } }
Output
Maximize the Internal Frame −
- Related Articles
- How to add Internal Frame to a JDesktopPane in Java?
- How to set FlowLayout for JFrame in Java?
- How to set style for JTextPane in Java?
- How to set JAVA_HOME for Java in Windows?
- How to set JAVA_HOME for Java in Linux?
- How to set border color for SoftBevelBorder in Java?
- How to set tooltip text for JCheckBox in Java?
- How to set default button for JFrame in Java?
- How to set JCheckBoxMenuItem for a MenuItem in Java?
- How to set Echo Char for JPasswordField in Java?
- How to set JAVA_HOME for Java in Mac OS?
- How to create scatterplot for categories with grey color palette using ggplot2 in R?
- How to create boxplot for categories with grey color palette using ggplot2 in R?
- How to create violin plot for categories with grey color palette using ggplot2 in R?
- How to create line chart for categories with grey color palette using ggplot2 in R?

Advertisements