Hello Cinta,
Sorry for the delay. JavaOne madness.
I just ran your code on Windows 7 with an nVidia card with no issues.
Can you file a Jira and describe your build and what version of javafx
you are using?
Also, paste the code from your email.
https://javafx-jira.kenai.com/secure/Dashboard.jspa
Thanks,
Joe
On 9/26/2013 9:20 PM, Cinta Damayanti wrote:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class TestCanvasTest extends Application {
static int width = 400 , height = 400;
@Override
public void start(Stage stage) throws Exception {
Group root = new Group();
final Canvas canvas = new Canvas(width, height);
final GraphicsContext gc = canvas.getGraphicsContext2D();
Button button1 = new Button();
button1.setText("START");
button1.setMinWidth(100);
button1.setTranslateX(10);
button1.setTranslateY(10);
Button button2 = new Button();
button2.setText("PAUSE");
button2.setMinWidth(100);
button2.setTranslateX(10);
button2.setTranslateY(40);
root.getChildren().add(canvas);
root.getChildren().addAll(button1, button2);
Scene scene = new Scene(root, width, height);
stage.setScene(scene);
gc.setFill(Color.RED);
gc.fillRect(0, 0, width, height);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}