package javafx_image;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.scene.control.Button;
import javafx.stage.Stage;
/**
*
* @web http://mobile-web-app.blogspot.com/
*/
public class JavaFX_image extends Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("java-buddy.blogspot.com: Load image");
Group root = new Group();
double width = 400;
double height = 300;
Scene scene = new Scene(root, width, height, Color.WHITE);
Image image = new Image(getClass().getResourceAsStream("duke_44x80.png"));
ImageView imageView = new ImageView();
imageView.setImage(image);
VBox vBox = new VBox();
Button button = new Button("it's a Button");
Text text = new Text("css style applied on root!");
String style_root = "-fx-font-size: 16pt;"
+ "-fx-font-family: 'Courier New';"
+ "-fx-base: rgb(128, 0, 0);";
vBox.getChildren().addAll(imageView, button, text);
root.getChildren().add(vBox);
root.setStyle(style_root);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Saturday, February 11, 2012
JavaFX 2.0: Apply css style
Subscribe to:
Post Comments (Atom)
can we apply graphics to stage closing and opning
ReplyDeleteif there pls send to my mail srihari1203@gmail.com