Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8096134

[SWT, Mac, Retina] FXCanvas draws badly when Scene is changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u20
    • 8
    • javafx
    • None
    • OS X 10.8 (Retina Display)

      > package application;
      >
      > import java.io.IOException;
      >
      > import javafx.application.ConditionalFeature;
      > import javafx.application.Platform;
      > import javafx.embed.swt.FXCanvas;
      > import javafx.event.ActionEvent;
      > import javafx.event.EventHandler;
      > import javafx.fxml.FXMLLoader;
      > import javafx.scene.Parent;
      > import javafx.scene.Scene;
      > import javafx.scene.control.Button;
      > import javafx.scene.control.ContextMenu;
      > import javafx.scene.control.MenuItem;
      > import javafx.scene.control.TextArea;
      > import javafx.scene.layout.HBox;
      >
      > import org.eclipse.swt.SWT;
      > import org.eclipse.swt.layout.FillLayout;
      > import org.eclipse.swt.widgets.Display;
      > import org.eclipse.swt.widgets.Shell;
      >
      > /**
      > * @author tomschindl
      > *
      > */
      > public class TestFXSWT {
      >
      > /**
      > * @param args
      > */
      > public static void main(String[] args) {
      > Display d = new Display();
      > Shell s = new Shell();
      > s.setLayout(new FillLayout());
      >
      > final FXCanvas c = new FXCanvas(s, SWT.NONE);
      >
      > HBox b = new HBox();
      > Button bu = new Button("Hello World");
      > bu.setContextMenu(new ContextMenu(new MenuItem("Hello Menu")));
      > bu.setOnAction(new EventHandler<ActionEvent>() {
      >
      > @Override
      > public void handle(ActionEvent event) {
      > HBox b1 = new HBox();
      > b1.getChildren().add(new Button("New one"));
      > c.setScene(new Scene(b1,1000,1000,Platform.isSupported(ConditionalFeature.SCENE3D)));
      > }
      > });
      > b.getChildren().add(bu);
      > c.setScene(new Scene(b,1000,1000,Platform.isSupported(ConditionalFeature.SCENE3D)));
      >
      > s.setSize(500, 500);
      > s.open();
      > while( ! s.isDisposed() ) {
      > if(! d.readAndDispatch()) {
      > d.sleep();
      > }
      > }
      >
      > d.dispose();
      > }
      >
      > }

            snorthov Steve Northover (Inactive)
            tschindl Tom Schindl
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: