-
Notifications
You must be signed in to change notification settings - Fork 0
/
AcademicCalender.java
57 lines (42 loc) · 1.8 KB
/
AcademicCalender.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
class AcademicCalender extends JFrame {
public AcademicCalender() {
setTitle("SZABIST Academic Calendar Fall 2024");
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
ImageIcon originalIcon = new ImageIcon("AcademicCalender.jpg");
if (originalIcon.getIconWidth() == -1 || originalIcon.getIconHeight() == -1) {
System.out.println("Failed to load the image. Using default size.");
setSize(500, 400);
} else {
int scaledWidth = 900;
int scaledHeight = 600;
Image scaledImage = originalIcon.getImage().getScaledInstance(scaledWidth, scaledHeight, Image.SCALE_SMOOTH);
ImageIcon scaledIcon = new ImageIcon(scaledImage);
JLabel imageLabel = new JLabel(scaledIcon);
imageLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 5));
add(imageLabel, BorderLayout.CENTER);
setSize(scaledWidth + 10, scaledHeight + 10);
}
setResizable(false);
setLocationRelativeTo(null);
setVisible(true);
}
public static void main(String[] args) {
MainCalender.AcademicCalender();
}
}
class MainCalender {
public static void AcademicCalender() {
SwingUtilities.invokeLater(() -> {
AcademicCalender frame = new AcademicCalender();
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
}
});
});
}
}