Java Swing: JLayeredPane

Published: 21 May 2023
on channel: Le Hoang Long Long
387
2

Playlist
   • Java Frontend  

2023 05 21 03 34 21


import java.awt.Color;
import java.awt.HeadlessException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;

public class layeredpane extends JFrame {

public layeredpane() throws HeadlessException {

super("Example of LayeredPane");
setSize(300, 300);

JLayeredPane panel1 = getLayeredPane();

JButton Press = new JButton();
Press.setBackground(Color.red);
Press.setBounds(30, 30, 60, 60);

JButton middlestate = new JButton();
middlestate.setBackground(Color.white);
middlestate.setBounds(50, 50, 60, 60);

JButton bottomstate = new JButton();
bottomstate.setBackground(Color.cyan);
bottomstate.setBounds(70, 70, 60, 60);

//adding buttons to the pane
panel1.add(bottomstate, new Integer(3));
panel1.add(middlestate, new Integer(1));
panel1.add(Press, new Integer(2));

}

public static void main(String[] args) {
layeredpane p = new layeredpane();
p.setVisible(true);
p.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

}


On this page of the site you can watch the video online Java Swing: JLayeredPane with a duration of hours minute second in good quality, which was uploaded by the user Le Hoang Long Long 21 May 2023, share the link with friends and acquaintances, this video has already been watched 387 times on youtube and it was liked by 2 viewers. Enjoy your viewing!