当前位置: 首页>>代码示例>>Java>>正文


Java FXCanvas.setScene方法代码示例

本文整理汇总了Java中javafx.embed.swt.FXCanvas.setScene方法的典型用法代码示例。如果您正苦于以下问题:Java FXCanvas.setScene方法的具体用法?Java FXCanvas.setScene怎么用?Java FXCanvas.setScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.embed.swt.FXCanvas的用法示例。


在下文中一共展示了FXCanvas.setScene方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPartControl

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
public void createPartControl(Composite parent) {
	fxCanvas = new FXCanvas(parent, SWT.NONE);
	eventManagerRenderer = new EventManagerRenderer();
	Scene scene = new Scene(eventManagerRenderer);
	fxCanvas.setScene(scene);

	parent.getShell().addListener(SWT.Resize, (e) -> {

	});
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:11,代码来源:EventManagerViewPart.java

示例2: createDialogArea

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
	Composite area = (Composite) super.createDialogArea(parent);
	Composite container = new Composite(area, SWT.NONE);
	container.setLayout(new GridLayout(1, false));
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	FXCanvas fxCanvas = new FXCanvas(container, SWT.NONE);
	fxCanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	VBox vBox = new VBox();
	Scene scene = new Scene(vBox);
	fxCanvas.setScene(scene);
	vBox.getChildren().add(createTraceWidget(extractor1, "First Trace", scene.widthProperty()));
	vBox.getChildren().add(createTraceWidget(extractor2, "Second Trace", scene.widthProperty()));
	
	return area;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:17,代码来源:TraceSectionsDialog.java

示例3: FXCanvasScrollApp

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
protected FXCanvasScrollApp() {
    shell = new Shell();
    shell.setText(this.getClass().getSimpleName());
    shell.setLayout(new FillLayout());

    ScrolledComposite scrollPane = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    FXCanvas fxCanvas = new FXCanvas(scrollPane, SWT.BORDER);
    fxCanvas.setScene(createScene(SCROLL_CONTAINER_ID));
    scrollPane.setContent(fxCanvas);
    scrollPane.setExpandHorizontal(true);
    scrollPane.setExpandVertical(true);
    fxCanvas.pack();
    scrollPane.setMinSize(fxCanvas.getSize());

    shell.pack();
    Monitor monitor = shell.getMonitor();
    Rectangle monitorRect = monitor.getClientArea();
    Rectangle shellRect = shell.getBounds();
    shellRect.x = Math.max(0, (monitorRect.width - shellRect.width) / 2);
    shellRect.y = Math.max(0, (monitorRect.height - shellRect.height) / 2);
    shell.setBounds(shellRect);
    shell.open();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:FXCanvasScrollApp.java

示例4: FXCanvasBrowserApp

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
protected FXCanvasBrowserApp() {
    shell = new Shell();
    shell.setText(this.getClass().getSimpleName());
    shell.setLayout(new FillLayout());
    FXCanvas fxCanvas = new FXCanvas(shell, SWT.BORDER);

    browser = new WebView();
    browser.getEngine().getLoadWorker().stateProperty().addListener(
            new ChangeListener<State>() {
        public void changed(ObservableValue ov, State oldState, State newState) {
            if (newState == State.SUCCEEDED) {
                successLabel.setText(SUCCESS_MESSAGE);
            }
        }
    });
    fxCanvas.setScene(createScene());

    shell.pack();
    Monitor monitor = shell.getMonitor();
    Rectangle monitorRect = monitor.getClientArea();
    Rectangle shellRect = shell.getBounds();
    shellRect.x = Math.max(0, (monitorRect.width - shellRect.width) / 2);
    shellRect.y = Math.max(0, (monitorRect.height - shellRect.height) / 2);
    shell.setBounds(shellRect);
    shell.open();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:27,代码来源:FXCanvasBrowserApp.java

示例5: createControl

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
/**
 * <p>
 * Creates an FXCanvas control and initializes a default empty JavaFX scene
 * </p>
 */
@Override
protected void createControl(Composite parent) {
	contentProvider = new FXContentProvider();

	fxCanvas = new FXCanvas(parent, SWT.NONE);

	// Create the root nodes
	internalRoot = new Group();
	root = new Group();

	internalRoot.getChildren().add(root);

	setupSceneInternals(internalRoot);

	scene = new Scene(internalRoot, 100, 100, true);

	// Set the scene's background color
	scene.setFill(Color.rgb(24, 30, 31));

	// Setup camera and input
	createDefaultCamera(internalRoot);
	wireSelectionHandling();

	fxCanvas.setScene(scene);
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:31,代码来源:FXViewer.java

示例6: createWebView

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
public static WebEngine createWebView(FXCanvas canvas) {
	canvas.setLayout(new FillLayout());
	WebView view = new WebView();
	// When the WebEngine is initialized a CookieHandler is set, which has
	// errors reading multi value cookies, therefore set to null again
	CookieHandler.setDefault(null);
	Scene scene = new Scene(view);
	canvas.setScene(scene);
	WebEngine webkit = view.getEngine();
	webkit.setJavaScriptEnabled(true);
	webkit.setOnAlert(e -> {
		Logger log = LoggerFactory.getLogger(UI.class);
		log.error("JavaScript alert: {}", e.getData());
	});
	return webkit;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:17,代码来源:UI.java

示例7: main

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	FXCanvas canvas = new FXCanvas(shell, SWT.NONE);
	SwtToFXGestureConverter gestureConverter = new SwtToFXGestureConverter(canvas);
	Scene scene = createScene();
	canvas.setScene(scene);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	gestureConverter.dispose();
	display.dispose();
	
}
 
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:18,代码来源:Demo.java

示例8: createPartControl

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
	fxCanvas = new FXCanvas(parent, SWT.NONE);
	root = new Pane();
	final Scene scene = new Scene(root);
	fxCanvas.setScene(scene);
	setupRoot();
	buildMenu(parent.getShell());
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:10,代码来源:StateGraphViewPart.java

示例9: createPartControl

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
	fxCanvas = new FXCanvas(parent, SWT.NONE);
	diffViewer = new TimelineDiffViewerRenderer();
	Scene scene = new Scene(diffViewer);
	fxCanvas.setScene(scene);
	parent.getShell().addListener(SWT.Resize, (e) -> {
		diffViewer.refresh();
	});
	buildMenu(parent.getShell());
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:12,代码来源:TimelineDiffViewerViewPart.java

示例10: createPartControl

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
public void createPartControl(Composite parent) {
	fxCanvas = new FXCanvas(parent, SWT.NONE);
	eventManagerRenderer = new EventManagerRenderer();
	Scene scene = new Scene(eventManagerRenderer);
	fxCanvas.setScene(scene);
	
	parent.getShell().addListener(SWT.Resize, (e) -> {
		
	});
}
 
开发者ID:SiriusLab,项目名称:ModelDebugging,代码行数:11,代码来源:EventManagerViewPart.java

示例11: create

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
public static ContributionChart create(Composite parent, FormToolkit toolkit, double width, double height) {
	Composite container = UI.formComposite(parent, toolkit);
	UI.gridLayout(container, 2);
	UI.gridData(container, true, true);
	ContributionChart chart = new ContributionChart(width, height);
	FXCanvas canvas = new FXCanvas(container, SWT.NONE);
	Scene scene = new Scene(new Group(chart));
	String cssPath = ContributionChart.class.getPackage().getName().replace('.', '/');
	scene.getStylesheets().add("/" + cssPath + "/styles.css");
	canvas.setScene(scene);
	chart.legend = new ChartLegend(container);
	return chart;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:14,代码来源:ContributionChart.java

示例12: setCanvasScene

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
public static void setCanvasScene(FXCanvas canvas, Scene scene) {
    canvas.setScene(scene);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:4,代码来源:SWTUtils.java

示例13: createGUI

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
private void createGUI(final Composite parent)
{
    final GridLayout layout = new GridLayout(1, false);
    parent.setLayout(layout);

    ModelBasedPlot plot;
    try
    {
        plot = new ModelBasedPlot(true);
    }
    catch (Exception e1)
    {
        e1.printStackTrace();
        return;
    }
    final FXCanvas canvas = new FXCanvas(parent, SWT.NONE);
    canvas.setScene(new Scene(plot.getPlot()));
    canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, layout.numColumns, 1));

    // [Done] button to end demo
    final Button ok = new Button(parent, SWT.PUSH);
    ok.setText("Done");
    ok.setLayoutData(new GridData(SWT.RIGHT, 0, true, false));
    ok.addSelectionListener(new SelectionAdapter()
    {
        @Override
        public void widgetSelected(final SelectionEvent e)
        {
            run = false;
        }
    });

    //        plot.addListener(listener);

    // Create demo samples
    final List<PlotSample> values = new ArrayList<PlotSample>();
    for (int i=1; i<10; ++i)
        values.add(new PlotSample("Test", TestHelper.makeValue(i)));
    values.add(new PlotSample("Test", TestHelper.makeError(15, "Disconnected")));
    // Single value. Line should continue until the following 'disconnect'.
    values.add(new PlotSample("Test", TestHelper.makeValue(17)));
    values.add(new PlotSample("Test", TestHelper.makeError(18, "Disconnected")));

    for (int i=20; i<30; ++i)
        values.add(new PlotSample("Test", TestHelper.makeValue(i)));

    final PlotSampleArray samples = new PlotSampleArray();
    samples.set(values);

    // Add item with demo samples
    final ModelItem item = new ModelItem("Demo")
    {
        @Override
        public PlotSamples getSamples()
        {
            return samples;
        }

        @Override
        public void write(final PrintWriter writer)
        {
            // NOP
        }
    };
    //TODO: Fix or remove
    //item.setColor(new RGB(0, 0, 255));
    plot.addTrace(item);

    //        start_time = VTypeHelper.getTimestamp(samples.getSample(0).getValue());
    //        end_time = VTypeHelper.getTimestamp(samples.getSample(samples.getSize()-1).getValue());
    //        plot.setTimeRange(start_time, end_time);
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:73,代码来源:PlotDemo.java

示例14: createPageControl

import javafx.embed.swt.FXCanvas; //导入方法依赖的package包/类
/**
	 * Creates custom control for user-defined query text.
	 * @throws IOException 
	 */
	private Control createPageControl( Composite parent ) throws IOException
	{
		Composite composite = new Composite( parent, SWT.NONE );
		composite.setLayout( new GridLayout( 1, false ) );
//		GridData gridData = new GridData( GridData.HORIZONTAL_ALIGN_FILL
//				| GridData.VERTICAL_ALIGN_FILL );
//		composite.setLayoutData( gridData );

		FXCanvas fxCanvas = new FXCanvas(composite, SWT.NONE);
		
		FXMLLoader loader = new FXMLLoader(getClass().getResource("/Scene.fxml"));
		Parent root = (Parent) loader.load();
		
		Scene scene = new Scene(root);
		fxCanvas.setScene(scene);

		Platform.setImplicitExit(false);
		GridData webData = new GridData( GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
		fxCanvas.setLayoutData( webData );
		controller = ((FXMLController) loader.getController());
		controller.addQueryAreaChangeListener(new ChangeListener<String>() {
		    @Override
		    public void changed(ObservableValue<? extends String> observable,
		            String oldValue, String newValue) {
		    	validateData();
		    }
		});
		
		try {
			java.util.Properties connProps = 
					DesignSessionUtil.getEffectiveDataSourceProperties( 
							getInitializationDesign().getDataSourceDesign() );
			String hostName = connProps.getProperty("hostName");
			String port = connProps.getProperty("port");
			String path = connProps.getProperty("path");
			controller.setSearchFieldText("http://"+hostName+":"+port+path);
			controller.search();
			
		} catch (OdaException e) {
			e.printStackTrace();
		}
		
		setPageComplete( false );
		return composite;
	}
 
开发者ID:Kratos-ISE,项目名称:birt-kairosdb-datasource-plugin,代码行数:50,代码来源:CustomDataSetWizardPage.java


注:本文中的javafx.embed.swt.FXCanvas.setScene方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。