當前位置: 首頁>>代碼示例>>Java>>正文


Java Display類代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Display的典型用法代碼示例。如果您正苦於以下問題:Java Display類的具體用法?Java Display怎麽用?Java Display使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Display類屬於org.eclipse.swt.widgets包,在下文中一共展示了Display類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main( String[] args ) 
{
    JFreeChart chart = createChart(createDataset());
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 400);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    //frame.setDisplayToolTips(false);
    frame.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:23,代碼來源:SWTPieChartDemo1.java

示例2: onDoubleClick

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
@Override
protected void onDoubleClick() {
	
	HivePartitionKeyValueDialog fieldDialog=new HivePartitionKeyValueDialog(Display.getCurrent().getActiveShell(), propertyDialogButtonBar);
	fieldDialog.setComponentName(gridConfig.getComponentName());
	if (getProperties().get(propertyName) == null) {
		
		InputHivePartitionKeyValues inputHivePartitionKeyValues = new InputHivePartitionKeyValues();
		List<String> keys= new ArrayList<>();
		List<InputHivePartitionColumn> keyValues = new ArrayList<>();
		inputHivePartitionKeyValues.setKey(keys);
		inputHivePartitionKeyValues.setKeyValues(keyValues);
		
		setProperties(propertyName, (InputHivePartitionKeyValues)inputHivePartitionKeyValues);
	}
	fieldDialog.setRuntimePropertySet(hivePartitionKeyValues);
	fieldDialog.setSourceFieldsFromPropagatedSchema(getPropagatedSchema());
	fieldDialog.open();
	setProperties(propertyName,fieldDialog.getRuntimePropertySet());

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:HiveInputSingleColumnWidget.java

示例3: init

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	super.init(site, input);
	setSite(site);
	setPartName(input.getName());
	setInputWithNotify(input);
	site.setSelectionProvider(this);
	if (getEditorInput() instanceof FileEditorInput) {
		FileEditorInput fei = (FileEditorInput) getEditorInput();
		IFile file = fei.getFile();
		gWGraph = ResourceManager.load(file);
		Display.getDefault().asyncExec(new Runnable() {
			@Override
			public void run() {
				gWGraph.initialize(getGraphicalViewer().getEditPartRegistry());
				if (!ResourceManager.isEditable(file)) {
					gWGraph.setReadOnly(true);
					getGraphicalViewer().getControl().setEnabled(false);
					String title = MessageUtil.getString("conversion");
					String message = MessageUtil.getString("not_formatted_as_json_convert_it");
					DialogManager.displayWarning(title, message);
				}
			}
		});
	}

}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:27,代碼來源:GW4EEditor.java

示例4: show

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Build and show the Window, dispose it after is is not longer needed.
 * @param parent The parent ShellWindow.
 * @param arrayModificationHandler The ArrayModificationHandler the holds the represented array.
 * @param myDimension The dimension of a probably multidimensional array this Window represents.
 * @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of.
 */
public void show(ShellWindow parent, ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) {
	try {
		// Initialize.
		this.parent = parent;
		this.display = Display.getDefault();
		createShell(arrayModificationHandler, myDimension, dimensionsIndexes);
		this.shell.open();

		// Keep the window active as long as it is needed.
		while (!this.shell.isDisposed()) {
			if (!this.display.readAndDispatch())
				this.display.sleep();
			}
	} catch (Throwable t) {
		arrayModificationHandler.doNotReturnThisArray();
		StaticGuiSupport.processGuiError(t, "Array entries", parent.getShell());
	} finally {
		doExit();
	}
}
 
開發者ID:wwu-pi,項目名稱:tap17-muggl-javaee,代碼行數:28,代碼來源:ArrayEntriesWindow.java

示例5: testFinished

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Called when an atomic test has finished, whether the test succeeds or fails.
 *
 * @param description
 *            the description of the test that just ran
 */
@Override
public void testFinished(Description description) throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifyFinishedExecutionOf(description);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:N4IDEXpectRunListener.java

示例6: testAssumptionFailure

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Called when an atomic test flags that it assumes a condition that is false
 *
 * describes the test that failed and the {@link AssumptionViolatedException} that was thrown
 */
@Override
public void testAssumptionFailure(Failure failure) {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {

			IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
			try {
				N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
						N4IDEXpectView.ID);
				view.notifyFailedExecutionOf(failure);
			} catch (PartInitException e) {
				N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
			}
		}
	});
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:N4IDEXpectRunListener.java

示例7: show

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Build and show the Windows, dispose it after is is not longer needed.
 * @param parentShell The parent windows' Shell.
 * @param classLoader The system MugglClassLoader.
 * @param classFile The classFile the initial Method belongs to.
 * @param method The initial Method.
 */
public void show(Shell parentShell, MugglClassLoader classLoader, ClassFile classFile, Method method) {
	try {
		this.display = Display.getDefault();
		if (createShell(parentShell, classLoader, classFile, method))
		this.shell.open();

		// Now make the parent shell invisible.
		parentShell.setVisible(false);

		// Keep the window alive.
		while (!this.shell.isDisposed()) {
			if (!this.display.readAndDispatch())
				this.display.sleep();
			}
	} catch (Throwable t) {
		StaticGuiSupport.processGuiError(t, "Step by step execution", parentShell);
	} finally {
		//Make the parent shell visible.
		parentShell.setVisible(true);
		// Make sure execution is aborted. Otherwise the Thread would not be stopped and the memory released after this window is closed.
		if (this.stepByStepExecutionComposite != null) this.stepByStepExecutionComposite.abortExecution(false);
		doExit();
	}
}
 
開發者ID:wwu-pi,項目名稱:tap17-muggl-javaee,代碼行數:32,代碼來源:StepByStepExecutionWindow.java

示例8: update

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
@Override
public void update ( final ViewerCell cell )
{
    final ConfigurationDescriptor cfg = (ConfigurationDescriptor)cell.getElement ();
    switch ( cell.getColumnIndex () )
    {
    case 0:
        cell.setText ( cfg.getConfigurationInformation ().getId () );
        break;
    case 1:
        cell.setText ( "" + cfg.getConfigurationInformation ().getState () );
        break;
    }

    if ( cfg.getConfigurationInformation ().getErrorInformation () != null )
    {
        cell.setBackground ( Display.getCurrent ().getSystemColor ( SWT.COLOR_RED ) );
    }
    else
    {
        cell.setBackground ( null );
    }

    super.update ( cell );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:FactoryCellLabelProvider.java

示例9: MainAvoCADoShell

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * create the main avoCADo shell and display it
 * @param display
 */
public MainAvoCADoShell(Display display){
	shell = new Shell(display);
	
	setupShell(); 				// place components in the main avoCADo shell
	
	shell.setText("avoCADo");
	shell.setSize(800, 600);	//TODO: set intial size to last known size
	shell.setMinimumSize(640, 480);
	Rectangle b = display.getBounds();
	int xPos = Math.max(0, (b.width-800)/2);
	int yPos = Math.max(0, (b.height-600)/2);
	shell.setLocation(xPos, yPos);
	shell.setImage(ImageUtils.getIcon("./avoCADo.png", 32, 32));
	shell.open();
	
	AvoGlobal.intializeNewAvoCADoProject(); // initialize app to starting model/view.
	
	StartupSplashShell.closeSplash();
			
	// handle events while the shell is not disposed
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
}
 
開發者ID:avoCADo-3d,項目名稱:avoCADo,代碼行數:30,代碼來源:MainAvoCADoShell.java

示例10: focusMarker

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
public static void focusMarker(final IMarker marker) {
  Display.getDefault().syncExec(new Runnable() {

    @Override
    public void run() {
      try {
        IDE.openEditor(
            MarkerActivator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage(),
            marker);
      } catch (final PartInitException e1) {

        e1.printStackTrace();
      }
    }
  });
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:17,代碼來源:MarkUtilities.java

示例11: TestProgressBar

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Create instance.
 */
public TestProgressBar(Composite parent, int style) {
	super(parent, style);

	// damn you, SWT color management
	// Color sample is form: http://www.colorpicker.com/c6f2b1
	colorSkipped = new Color(Display.getCurrent(), 230, 232, 235);
	colorPassed = new Color(Display.getCurrent(), 198, 242, 177);
	colorFailed = new Color(Display.getCurrent(), 242, 188, 177);
	colorError = new Color(Display.getCurrent(), 242, 188, 177);
	colorFixme = new Color(Display.getCurrent(), 177, 231, 242);

	addPaintListener((ev) -> {
		onPaint(ev.gc);
	});
	addDisposeListener((ev) -> {
		onDispose();
	});
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:22,代碼來源:TestProgressBar.java

示例12: getSchemaFromXSD

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
public List<GridRow> getSchemaFromXSD(String XSDFile,String loopXPathQuery) throws ParserConfigurationException, SAXException, IOException, JAXBException{
	SchemaParser parser = new SchemaParser();
	try{
		Schema schema=parser.parse(XSDFile);
		Element element = getRowTagElement(schema);
		if(element==null){
			return null;
		}
		return parseElementsOfRowTag(element,loopXPathQuery);
	}
	catch(Exception e){
		createMessageBox(INVALID_XSD_FILE+e.getMessage(), Constants.ERROR, SWT.ERROR,Display.getCurrent().getActiveShell());
		
	}
	return null;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:XMLUtil.java

示例13: CommentBoxFigure

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
 * with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public CommentBoxFigure(int borderSize) {
	setBorder(new MarginBorder(5));
	FlowPage flowPage = new FlowPage();

	textFlow = new TextFlow();

	textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));

	flowPage.add(textFlow);

	setLayoutManager(new StackLayout());
	add(flowPage);
	font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
	setFont(font);
	setForegroundColor(ColorConstants.black);
	setOpaque(false);

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:26,代碼來源:CommentBoxFigure.java

示例14: start

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    Display display = PlatformUI.createDisplay ();
    try
    {
        int returnCode = PlatformUI.createAndRunWorkbench ( display, new ApplicationWorkbenchAdvisor () );
        if ( returnCode == PlatformUI.RETURN_RESTART )
        {
            return IApplication.EXIT_RESTART;
        }
        else
        {
            return IApplication.EXIT_OK;
        }
    }
    finally
    {
        display.dispose ();
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:Application.java

示例15: AboutAvoCADoGPLShell

import org.eclipse.swt.widgets.Display; //導入依賴的package包/類
/**
 * create the startup splash shell and display it
 * @param display
 */
public AboutAvoCADoGPLShell(Display display){
	shell = new Shell(display, SWT.PRIMARY_MODAL);
	
	setupShell(); 				// place components in the avoCADo license shell
	
	shell.setText("avoCADo GPLv2");
	shell.setSize(583, 350);	//TODO: set initial size to last known size
	Rectangle b = display.getBounds();
	int xPos = Math.max(0, (b.width-583)/2);
	int yPos = Math.max(0, (b.height-350)/2);
	shell.setLocation(xPos, yPos);
	shell.open();
	
	// handle events while the shell is not disposed
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
}
 
開發者ID:avoCADo-3d,項目名稱:avoCADo,代碼行數:24,代碼來源:AboutAvoCADoGPLShell.java


注:本文中的org.eclipse.swt.widgets.Display類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。