仅举例说明!
如:
import javax.swing.UIManager;
import java.awt.*;
import com.incors.plaf.alloy.AlloyLookAndFeel; //首先引用Look&Feel的类包
public class Football_MainApp {
boolean packFrame = false;
//Construct the application
public Football_MainApp() {
Football_MainFrame frame = new Football_MainFrame();
//Validate frames that have preset sizes
//Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
}
else {
frame.validate();
}
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
frame.setSize(new Dimension(screenSize.width,screenSize.height));
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation(0,0);
frame.setVisible(true);
}
//Main method
public static void main(String[] args) {
try {
//设置Look&Feel的具体参数
AlloyLookAndFeel alloyLnF = new AlloyLookAndFeel();
alloyLnF.setProperty("alloy.isSandbox", "true");
alloyLnF.setProperty("alloy.isLookAndFeelFrameDecoration", "true");
UIManager.setLookAndFeel(alloyLnF);
UIManager.setLookAndFeel("com.incors.plaf.alloy.AlloyLookAndFeel");
}
catch(Exception e) {
e.printStackTrace();
}
new Football_MainApp();
}
}