📄 application.java
字号:
/* This file is part of ui2swt.
*
* $Revision: 1.14 $
* $Date: 2007/06/17 04:12:17 $
* $Name: $
*
* Copyright (C) 2006-2007 James Forbes, All Rights Reserved.
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the
* use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software in
* a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*/
package ui2swt.test;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Application
{
private static Display display;
private static Shell shell;
private static MainWindow mainWindow;
private static Launcher testLauncher = new Launcher();
public static void main( String args[] )
{
display = new Display();
shell = new Shell(display);
mainWindow = new MainWindow(shell);
shell.pack();
shell.setMinimumSize(shell.getSize());
shell.setSize(400,600);
setTests();
shell.open();
while ( !shell.isDisposed() )
{
if ( !display.readAndDispatch() )
{
display.sleep ();
}
}
display.dispose();
}
//
//
//
private static void setTests()
{
// Add tests
addTestGroup("TestButton");
addTestGroup("TestComboBox");
addTestGroup("TestDialog");
addTestGroup("TestFrame");
addTestGroup("TestInt");
addTestGroup("TestGroupBox");
addTestGroup("TestLabelFont");
addTestGroup("TestLabelImage");
addTestGroup("TestLine");
addTestGroup("TestLineEdit");
addTestGroup("TestListAndTable");
addTestGroup("TestMainWindow");
addTestGroup("TestNestedLayout");
addTestGroup("TestProgressBar");
addTestGroup("TestSpacer");
addTestGroup("TestTabWidget");
addTestGroup("TestTextBrowser");
addTestGroup("TestTextEdit");
// Add actions
mainWindow.launchPushButton.addSelectionListener(
new SelectionAdapter()
{
public void widgetSelected( SelectionEvent event )
{
launchSelectedTest();
}
});
mainWindow.testsListBox.addMouseListener(
new MouseListener()
{
public void mouseDoubleClick( MouseEvent event )
{
launchSelectedTest();
}
public void mouseDown( MouseEvent event ) {}
public void mouseUp( MouseEvent event ) {}
});
}
private static void addTestGroup( String iGroup )
{
addTest(iGroup+"2");
addTest(iGroup+"3");
addTest(iGroup+"4");
}
private static void addTest( String iTest )
{
mainWindow.testsListBox.add("ui2swt.test."+iTest);
}
//
//
//
static void launchSelectedTest()
{
String[] classNames = mainWindow.testsListBox.getSelection();
if ( classNames.length > 0 )
{
testLauncher.launchTest(shell, classNames[0]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -