本文整理汇总了Java中javafx.embed.swt.FXCanvas类的典型用法代码示例。如果您正苦于以下问题:Java FXCanvas类的具体用法?Java FXCanvas怎么用?Java FXCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FXCanvas类属于javafx.embed.swt包,在下文中一共展示了FXCanvas类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: getScene
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
public static Wrap<? extends Scene> getScene() {
Wrap<? extends Scene> scene;
// TODO: ugly stub here: should be resolved on Jemmy side
Wrap<? extends Shell> shell = null;
do {
try {
shell = Shells.SHELLS.lookup().wrap();
} catch (NullPointerException ex) {
}
} while (shell == null);
final FXCanvas swt_panel = (FXCanvas) shell.as(Parent.class, FXCanvas.class).lookup(FXCanvas.class).wrap().getControl();
SwingAWTUtils.SceneRetriever scene_retriever = new SwingAWTUtils.SceneRetriever(swt_panel);
swt_panel.getDisplay().syncExec(scene_retriever);
scene = scene_retriever.getScene();
final Wrap<? extends Shell> fshell = shell;
swt_panel.getDisplay().syncExec(new Runnable() {
public void run() {
fshell.getControl().forceActive();
}
});
return scene;
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:SWTUtils.java
示例6: createSWTTestPresenterShow
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
public static void createSWTTestPresenterShow(boolean isRunning, CombinedTestChooserPresenter combinedTestChooserPresenter) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("Shell");
FXCanvas panel = new FXCanvas(shell, SWT.NONE);
combinedTestChooserPresenter.show(shell, panel);
shell.pack();
shell.open();
while (!shell.isDisposed() && isRunning) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:18,代码来源:SWTUtils.java
示例7: 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
示例8: CenteredCameraController
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
/**
* The default constructor.
*
* @param camera
* The camera this controller will manage.
* @param scene
* The scene the camera is viewing.
* @param canvas
* The FXCanvas containing the scene.
*/
public CenteredCameraController(Camera camera, Scene scene,
FXCanvas canvas) {
super(camera, scene, canvas);
// Initialize the data members
dragStarted = false;
shouldInvertX = false;
shouldInvertY = false;
// Set the x axis rotation for the affine transformation
x = new Rotate();
x.setAxis(Rotate.X_AXIS);
// Set the y axis rotation for the affine transformation
y = new Rotate();
y.setAxis(Rotate.Y_AXIS);
// Set the y axis rotation for the affine transformation
z = new Rotate();
z.setAxis(Rotate.Z_AXIS);
// Apply the rotations and the affine to the camera
xform.getTransforms().setAll(x, y, z, affine);
}
开发者ID:eclipse,项目名称:eavp,代码行数:36,代码来源:CenteredCameraController.java
示例9: 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
示例10: 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
示例11: SwtToFXGestureConverter
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
public SwtToFXGestureConverter(final FXCanvas canvas) {
this.canvas = canvas;
this.currentState = new State(StateType.IDLE);
canvas.addGestureListener(this);
canvas.addMouseWheelListener(this);
Display display = canvas.getDisplay();
if (display.getTouchEnabled()) {
// register a filter to suppress emulated scroll events that
// originate from mouse wheel events on devices that support touch
// events (see #430940)
mouseWheelEmulatedEventFilter = new Listener() {
@Override
public void handleEvent(Event event) {
if (event.widget == canvas) {
event.type = SWT.None;
}
}
};
display.addFilter(SWT.MouseVerticalWheel,
mouseWheelEmulatedEventFilter);
display.addFilter(SWT.MouseHorizontalWheel,
mouseWheelEmulatedEventFilter);
}
}
开发者ID:JanKoehnlein,项目名称:JavaFX-SWT-Gesture-Bridge,代码行数:25,代码来源:SwtToFXGestureConverter.java
示例12: 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
示例13: 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
示例14: setUpClass
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
System.setProperty("javafx.swtinteroperability", "true");
FXCanvasApp.main(null);
JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
frame = Shells.SHELLS.lookup().wrap();
frameAsParent = frame.as(Parent.class);
menuBtn = frameAsParent.lookup(org.eclipse.swt.widgets.Button.class, new ByText(FXCanvasApp.MENU_POPUP_BTN)).wrap();
alphaSlider = frameAsParent.lookup(Scale.class).wrap();
fxpane = frameAsParent.lookup(FXCanvas.class).wrap();
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:12,代码来源:FXCanvasTest.java
示例15: setUpClass
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
System.setProperty("javafx.swtinteroperability", "true");
FXCanvasScrollApp.main(null);
JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
frame = Shells.SHELLS.lookup().wrap();
frameAsParent = frame.as(Parent.class);
fxpane = frameAsParent.lookup(FXCanvas.class).wrap();
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:10,代码来源:FXCanvasScrollTest.java
示例16: init
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
protected void init(final Composite parent) {
// this will initialize the FX Toolkit
fxCanvas = new FXCanvas(parent, SWT.NONE);
Platform.setImplicitExit(false);
Platform.runLater(() -> createScene(parent));
}
开发者ID:DrBookings,项目名称:drbookings,代码行数:8,代码来源:SamplePart.java
示例17: 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
示例18: createFormContent
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
@Override
protected void createFormContent(IManagedForm managedForm) {
ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
UI.formHeader(managedForm, M.OpenLCALog);
Composite body = UI.formBody(form, toolkit);
FXCanvas canvas = new FXCanvas(body, SWT.NONE);
WebEngine webkit = UI.createWebView(canvas);
UI.gridData(canvas, true, true);
try {
String html = new String(Files.readAllBytes(file.toPath()));
webkit.loadContent(html);
} catch (IOException e) {
log.error("Error loading log files", e);
}
}
开发者ID:GreenDelta,项目名称:olca-app,代码行数:17,代码来源:LogFileEditor.java
示例19: 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
示例20: startSWT
import javafx.embed.swt.FXCanvas; //导入依赖的package包/类
public void startSWT(final GetAction<Scene> sceneGetter,
final CountDownLatch sync,
final double initialX, final double initialY,
final String stageName) {
OtherThreadRunner.invokeOnMainThread(new Runnable() {
public void run() {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLocation((int) Math.round(initialX), (int) Math.round(initialY));
shell.setLayout(new FillLayout());
if (stageName == null) {
shell.setText("SWTShell : " + Utils.getRunEnvironmentInfo());
} else {
shell.setText(stageName);
}
fxcanvas = new FXCanvas(shell, SWT.NONE);
//Toolkit is initialized, only when FXCanvas is created.
Scene scene = sceneGetter.dispatch(Root.ROOT.getEnvironment());
shell.open();
Utils.setCustomFont(scene);
fxcanvas.setScene(scene);
fxcanvas.setSize((int) scene.getWidth(), (int) scene.getHeight());
scene.heightProperty().addListener(new SWTSizeListener(scene, fxcanvas));
scene.widthProperty().addListener(new SWTSizeListener(scene, fxcanvas));
sync.countDown();
while (!shell.isDisposed() && OtherThreadRunner.isRunning()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
});
}
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:42,代码来源:SWTUtils.java
注:本文中的javafx.embed.swt.FXCanvas类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论