2017-04-09 4 views
0

Es funktioniert nicht, der Textarea-Hintergrund ist immer noch null.Wie setze ich ein Bild in textarea für JavaFX?

public class dsgf extends Application { 

    @Override 
    public void start(Stage primarystage) throws Exception { 

    HBox b = new HBox(); 

    Image image = new Image("ph/background.jpg"); 
    BackgroundImage c = new BackgroundImage(image, null, null, null, null); 
    Background g = new Background(c); 

    TextArea t = new TextArea(); 

    t.setBackground(g);// 

    b.getChildren().add(t); 
    Scene scene = new Scene(b); 

    primarystage.setScene(scene); 
    primarystage.show(); 
    } 

    public static void main(String[] args) { 

    launch(args); 
    } 
} 
+0

Mögliche Duplikat [ein kleines Bild auf der rechten Seite des Textfeld mit CSS Hinzufügen] (http://stackoverflow.com/questions/13159156/adding-a-small-picture-auf-der-rechten-seite-von-textfield-with-css) –

Antwort

Verwandte Themen