-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSwingLabelImage.java
More file actions
31 lines (24 loc) · 823 Bytes
/
SwingLabelImage.java
File metadata and controls
31 lines (24 loc) · 823 Bytes
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
package src.uni.lessons.jswing;
import javax.swing.*;
public class SwingLabelImage extends JFrame {
private JLabel jLabel;
private ImageIcon imageIcon;
public SwingLabelImage(String title) {
super(title);
}
public void createWindow() {
setSize(320, 250);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
imageIcon = new ImageIcon("/Users/harshitkrvishwakarma/Desktop/Java-Programs/src/resources/images/nodejs.png");
jLabel = new JLabel("NodeJS", imageIcon, JLabel.CENTER);
add(jLabel);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new SwingLabelImage("Label Icon with Text").createWindow();
}
});
}
}