📄 spscreen.java
字号:
/*
* @author Reghu
* @version 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the Application : SPScreen.java
* Creation/Modification History :
*
* Reghu 17-March-2003 Created
*
*/
package oracle.otnsamples.vsm.client;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.Toolkit;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JWindow;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
/**
* This file displays the splash screen of the admin utility of the
* VSM application.
*
* @author Reghu
* @version 1.0
*/
public class SPScreen extends JWindow {
private JLabel footer = new JLabel();
private JLabel header = new JLabel();
private JLabel label = new JLabel();
private JPanel content = new JPanel();
private JProgressBar pbar = new JProgressBar();
/**
* Creates a new SPScreen object and initializes the UI.
*/
public SPScreen() {
try {
jbInit();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* Initialize all the GUI components and the layout
* @exception Exception
*/
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
this.setSize(new Dimension(300, 269));
content.setBounds(new Rectangle(0, 0, 300, 270));
content.setBorder(BorderFactory.createLineBorder(
new Color(131, 131, 87), 5));
content.setLayout(null);
footer.setText("Oracle Technology Network http://otn.oracle.com");
footer.setFont(new Font("Sans-Serif", Font.BOLD, 12));
footer.setBounds(new Rectangle(5, 240, 290, 20));
footer.setForeground(Color.blue);
footer.setHorizontalAlignment(SwingConstants.CENTER);
footer.setHorizontalTextPosition(SwingConstants.CENTER);
pbar.setBounds(new Rectangle(10, 220, 280, 10));
pbar.setForeground(new Color(162, 60, 76));
header.setBounds(new Rectangle(10, 20, 275, 160));
header.setHorizontalAlignment(SwingConstants.CENTER);
header.setIcon(new ImageIcon(getClass().getClassLoader().getResource("adminLogo.gif")));
content.add(label, null);
content.add(header, null);
content.add(pbar, null);
content.add(footer, null);
this.getContentPane().add(content, null);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
label.setFont(new Font("Book Antiqua", 1, 12));
label.setBounds(new Rectangle(10, 195, 75, 15));
label.setText("Loading...");
content.setBackground(new Color(223, 223, 191));
if(frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if(frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
this.setLocation(
(screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
for(int i = 0; i <= 100; i++) {
final int percent = i;
try {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
pbar.setValue(percent);
setVisible(true);
}
});
java.lang.Thread.sleep(20);
} catch(InterruptedException e) {
;
}
}
// Display it
setVisible(true);
// Wait a little while, maybe while loading resources
try {
Thread.sleep(800);
} catch(Exception e) {
}
this.setVisible(false);
this.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -