appsample.java

来自「SRI international 发布的OAA框架软件」· Java 代码 · 共 79 行

JAVA
79
字号
/**
 * The contents of this file are subject to the OAA  Community Research
 * License Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License
 * at http://www.ai.sri.com/~oaa/.  Software distributed under the License
 * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * rights and limitations under the License.  Portions of the software are
 * Copyright (c) SRI International, 1999.  All rights reserved.
 * "OAA" is a registered trademark, and "Open Agent Architecture" is a
 * trademark, of SRI International, a California nonprofit public benefit
 * corporation.
*/

/**
 * AppSample.java
 * 
 * This is the main application class for the debug agent. 
 * 
 */


package com.sri.oaa2.agt.sampleAgent;

import javax.swing.UIManager;
import javax.swing.LookAndFeel;
import java.awt.*;

public class AppSample 
{
	//instance data	
	boolean m_bPackFrame = false;

	//constructor
	public AppSample(String[] args) 
	{
		//create the frame
		FrmSample frame = new FrmSample();
		
		//Validate frames that have preset sizes
		//Pack frames that have useful preferred size info, e.g. from their layout
		if(m_bPackFrame)
			frame.pack();
		else
			frame.validate();
		
		//Center the window
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension frameSize = frame.getSize();
		if (frameSize.height > screenSize.height)
			frameSize.height = screenSize.height;
		if (frameSize.width > screenSize.width)
			frameSize.width = screenSize.width;
  	frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);

		frame.setVisible(true);
	}

	

  //Main method
	public static void main(String[] args) 
	{
		try  
		{
			// UIManager.setLookAndFeel(new com.sun.java.swing.plaf.motif.MotifLookAndFeel());
			// UIManager.setLookAndFeel(new com.sun.java.swing.plaf.metal.MetalLookAndFeel());
			UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
		}
		catch (Exception e) 
		{
			//do nothing
		}
		
		//instantiate the App
		new AppSample(args);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?