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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      OS X 10.8 (Retina Display)

      Description

      > 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();
      > }
      >
      > }

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: