2014-11-19 6 views
6

Come creare JavaFX TextField come Android TextField utilizzando JavaFX CSS?JavaFX TextField CSS

Ad esempio: Android TextField

ho provato un sacco di css FX, ma non raggiunto sguardo come quello. Qui http://jsfiddle.net/QKm37/ I CSS esistono per il tipo di input HTML ma non è applicabile in JavaFX SceneBuilder.

Ad esempio: /** Not Exist in JavaFX **/

-fx-border: none;

-fx-background: bottom left linear-gradient(#a9a9a9, #a9a9a9) no-repeat, bottom center linear-gradient(#a9a9a9, #a9a9a9) repeat-x, bottom right linear-gradient(#a9a9a9, #a9a9a9) no-repeat;

risposta

11

Prova questo nel vostro file CSS:

.text-field { 
    -fx-background-color: #a9a9a9 , white , white; 
    -fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1; 
} 

.text-field:focused { 
    -fx-background-color: #a9a9a9 , white , white; 
    -fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1; 
} 
+0

Grazie funziona ora. –

+0

@GauravKumar Suggerire modifiche è una buona idea, ma per favore non includere il commento nella modifica stessa, ma piuttosto nel sommario. L'ho rimosso per te. – Scimonster

+0

funziona, ma come rimuovere il raggio? – SalutonMondo