Playlist
• Java Frontend
2023 05 24 07 32 11
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.HeadlessException;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
/**
*
JDesktopPane
*/
public class dpane extends JFrame{
public dpane() throws HeadlessException {
CustomDestopPane deskpane = new CustomDestopPane();
Container cPane = getContentPane();
cPane.add(deskpane, BorderLayout.CENTER);
deskpane.display(deskpane);
setTitle("Example of JDesktopPane in Swing");
setSize(400, 450);;
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new dpane();
}
}
class CustomDestopPane extends JDesktopPane{
int numFrame = 4;
int x = 40;
int y = 40;
public void display(CustomDestopPane deskp){
for (int i = 0; i less than numFrame; i++) {
JInternalFrame javaframe = new
JInternalFrame("Internal frmae " + i,
true, true, true, true);
javaframe.setBounds(x, y, 350, 95);
Container c11 = javaframe.getContentPane();
c11.add(new JLabel("I love this world"));
deskp.add(javaframe);
javaframe.setVisible(true);
y += 95;
}
}
}
On this page of the site you can watch the video online Java Swing: JDesktopPane & creating multi-document apps, many windows with a duration of hours minute second in good quality, which was uploaded by the user Le Hoang Long Long 24 May 2023, share the link with friends and acquaintances, this video has already been watched 31 times on youtube and it was liked by 0 viewers. Enjoy your viewing!