📄 realeditor.java
字号:
package com.ecust.mainframe;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class RealEditor {
public static void main( String[] args ) {
RegistrationDetails rd = new RegistrationDetails();
if ( !Registration.getRegistrationFile().exists() ) {
Registration.saveRegistrationDetails( rd );
}
RegistrationDetails savedRd = Registration.getRegistrationDetails();
if ( !savedRd.getStarted() ) {
Registration.setStarted( true );
String vers = System.getProperty("java.version");
if ( vers.compareTo( "1.5.0" ) < 0) {
JOptionPane.showMessageDialog(
null, "!!!WARNING: This Program must be run with a " +
"1.5.0 or higher version VM!!!",
"WARNING", JOptionPane.WARNING_MESSAGE );
}
SplashWindow splashWindow = new SplashWindow();
Thread splashThread = splashWindow.getSplashThread();
splashWindow.start();
try {
splashThread.join();
} catch ( InterruptedException e ) {
e.printStackTrace( System.err );
}
Registration.register();
} else {
JOptionPane.showMessageDialog(
null, "RealEditor Has Been Started.",
"INFORMATION", JOptionPane.INFORMATION_MESSAGE );
}
}
}
class SplashWindow extends JWindow implements Runnable {
/**
*
*/
private static final long serialVersionUID = 875207297597770299L;
private Thread splashThread = new Thread(this);
private JProgressBar progressBar;
public SplashWindow() {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
JPanel splashPanel = new JPanel(new BorderLayout());
URL url = getClass().getResource("WELCOME.jpg");
if(url != null) {
JButton button = new JButton(new ImageIcon(url) );
splashPanel.add( button, BorderLayout.CENTER);
button.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e ) {
Registration.setStarted( false );
System.exit( 0 );
}
}
);
}
progressBar = new JProgressBar(0, 500);
progressBar.setStringPainted(true);
progressBar.setBorderPainted(false);
progressBar.setString("Program Is Loading, please wait...");
progressBar.setBackground(Color.white);
splashPanel.add(progressBar, BorderLayout.SOUTH);
setContentPane(splashPanel);
Dimension screenSize = getToolkit().getScreenSize();
pack();
setLocation((screenSize.width - getSize().width) / 2,
(screenSize.height - getSize().height) / 2);
}
public Thread getSplashThread() {
return splashThread;
}
public void start() {
this.toFront();
splashThread.start();
}
public void run() {
try
{
setVisible(true);
int delay = 5;
for(int i = 0; i < 500; i++) {
if ( i == 100 ) {
delay = 4;
} else if ( i == 200 ) {
delay = 3;
} else if ( i == 300 ) {
delay = 2;
} else if ( i == 400 ) {
delay = 1;
}
Thread.sleep( delay );
progressBar.setValue(progressBar.getValue() + 1);
}
} catch(Exception e) {
e.printStackTrace();
}
dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -