📄 cliffhangerapplication.java
字号:
/**
* Copyright (c) 1996-2004 Borland Software Corporation. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland Software as part
* of a Borland Software product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland Software.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS
* RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
* CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
* DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
* ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
* DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
* DERIVED FROM THIS SOURCE CODE FILE.
*/
//------------------------------------------------------------------------------
// Copyright (c) 1996-2004 Borland Software Corporation. All Rights Reserved.
//------------------------------------------------------------------------------
package com.borland.samples.orderentry;
import java.awt.*;
/**
* CliffhangerApplication is the application class for the Cliffhanger project.
* The static main method is implemented here, as well as other static methods
* that are used throughout the application.
*/
public class CliffhangerApplication {
// public variables
public static final String MESSAGE_TITLE = "Cliffhanger";
private static Frame lastFrame;
/**
* Construct the application
*/
public CliffhangerApplication() {
// Show the splash screen while connecting to database
SplashScreen splash = new SplashScreen();
splash.pack();
showCenteredWindow(splash, true);
// Show the Main window
MainFrame frame = new MainFrame();
frame.pack();
showCenteredWindow(frame, true);
// Hide the splash screen after the Main window appears
splash.setVisible(false);
}
/**
* Main method
* @param args String[]
*/
static public void main(String[] args) {
new CliffhangerApplication();
}
/**
* Method to show a frame in the center of the screen.
* @param window Window
* @param usePreferredSize boolean
*/
static public void showCenteredWindow(Window window, boolean usePreferredSize) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension windowSize;
if (usePreferredSize)
windowSize = window.getPreferredSize();
else
windowSize = window.getSize();
if (windowSize.height > screenSize.height)
windowSize.height = screenSize.height;
if (windowSize.width > screenSize.width)
windowSize.width = screenSize.width;
window.setLocation((screenSize.width - windowSize.width) / 2, (screenSize.height - windowSize.height) / 2);
window.setVisible(true);
if (window instanceof Frame) {
lastFrame = (Frame) window;
}
}
/**
* used by DataModule1 to get a frame for dialogs
* @return Frame
*/
static public Frame getMostRecentFrame() {
return lastFrame;
}
/**
* @param frame Frame
*/
static public void setMostRecentFrame(Frame frame) {
lastFrame = frame;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -