📄 splash.java
字号:
//import the packages for using the classes in them into the program
import javax.swing.*;
import java.awt.*;
public class Splash {
// A simple little method to show a title screen in the
// center of the screen for a given amount of time.
public static void showSplash(int duration) {
JWindow splash = new JWindow();
JPanel content = (JPanel) splash.getContentPane();
// set the window's bounds, centering the window
int width =593;
int height = 272;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width - width) / 2;
int y = (screen.height - height) / 2;
splash.setBounds(x, y, width, height);
// build the splash screen
JLabel label = new JLabel(new ImageIcon(ClassLoader.getSystemResource("images/splash.JPG")));
JLabel copyrt = new JLabel("AL SALAH ver 1.0 By USMAN ALI", JLabel.CENTER);
copyrt.setFont(new Font("Tahoma", Font.BOLD, 10));
//copyrt.setBorder(BorderFactory.createEtchedBorder());
content.setBackground(new java.awt.Color (180,180, 150));
//content.setBackground(new Color(232, 232, 228));
content.add(label, BorderLayout.CENTER);
content.add(copyrt, BorderLayout.SOUTH);
content.setBorder(BorderFactory.createLineBorder(new java.awt.Color (20,80, 20), 5));
// display it
splash.setVisible(true);
// Wait a little while, maybe while loading resources
try {
Thread.sleep(duration);
}
catch (Exception e) {
}
splash.setVisible(false);
}
public static void main(String[] args) {
new Splash().showSplash(3000);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -