Reputation:
I want to set an underline for my text area but I have a problem
I tried this with css but it doesn't work
.hyperlink-text-area .text {
-fx-underline: true ;
}
Upvotes: 0
Views: 373
Reputation: 1450
Create TextArea and add your style class:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class HelloFX extends Application {
@Override
public void start(Stage stage) {
TextArea textArea = new TextArea("Test...");
textArea.getStyleClass().add("text-area-underline-text");
VBox vbox = new VBox(textArea);
Scene scene = new Scene(vbox, 640, 480);
scene.getStylesheets().add("style.css");
stage.setScene(scene);
stage.setTitle("JavaFX App");
stage.show();
}
public static void main(String[] args) {
launch();
}
}
Add your style in your application style.css file
.text-area-underline-text .text {
-fx-underline: true ;
}
Upvotes: 1