-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPanel.java
24 lines (22 loc) · 841 Bytes
/
Panel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
public class Panel extends JPanel{ //Extending JPanel
private static final long serialVersionUID = 1L;
private static JFrame frame;
private static JLabel label;
public static void display(BufferedImage image, String name) {
frame = new JFrame();
frame.setTitle(name);
frame.setSize(800, 800); //Set default width and height
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
label=new JLabel();
label.setIcon(new ImageIcon(image));
frame.getContentPane().add(label,BorderLayout.CENTER);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
}