-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInternal_Resource_JavaTutorial.java
More file actions
34 lines (32 loc) · 1.22 KB
/
Copy pathInternal_Resource_JavaTutorial.java
File metadata and controls
34 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.awt.BorderLayout;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
*@author Vincent
*/
public class InternalResource_JavaTutorial {
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame window = new JFrame("Internal Resource: Java Tutorial");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel_1 = new JPanel();
BufferedImage img = ImageIO.read(InternalResource_JavaTutorial.class.getResource("bluebert.png"));
ImageIcon p = new ImageIcon();
JLabel lbl = new JLabel();
p.setImage(img);
lbl.setIcon(p);
panel_1.add(lbl);
window.add(BorderLayout.CENTER, panel_1);
window.setSize(500, 300);
window.setVisible(true);
window.setLocationRelativeTo(null);
}
}