TextField Cursor initial position

Ajay

I have a javafx TextField with an image in the text field to left. When the TextField is focused the cursor appears right on the image, I want the cursor to appear next to image.

current look

How it appears

desired look

How i need it to be appeared

My css code:

#adminname {
-fx-background-color: white;
-fx-background-image: url("usericon.png");
-fx-background-repeat: no-repeat;   
-fx-background-size: 20 20;
-fx-background-position: left center;
-fx-background-color: #a9a9a9 , white , white;
-fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1;
 }

 #adminname:focused {
-fx-background-color: white;
-fx-background-image: url("usericon.png");
-fx-background-repeat: no-repeat;   
-fx-background-size: 25 25;
-fx-background-position: left center;
-fx-background-color: #a9a9a9 , white , white;
-fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1;
-fx-min-width: 170;
 }
fabian

Use -fx-padding (see CSS properties for Region). Note however that the padding is not empty by default, so don't use 0 on the other values:

-fx-padding: 4 7 4 27;

The padding works the same way as in the standard css model. IMHO that description is better than the one in the javadoc for the Region class. The important thing is the padding sets the distance to the border (i.e. the rounded rectangle around the TextField) but isn't applied for the background.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Get cursor position in a TextField

Flutter set TextField cursor position

iOS textfield cursor position wrong

Flutter TextField TextFieldController setState - position of cursor changes

Why cursor is not starting from the initial position in the input field

Flutter Cursor of TextField moves to Position 0 after setState

What is the relation between MediaQuery.of(context) and TextField cursor position in Flutter?

how to set cursor position at the end of the value in flutter in textfield?

Change Cursor Position and force SingleLine of TextField in Jetpack Compose

ms access - set position of cursor in textfield to start only if textbox is empty

clear textfield initial value

How do I set the initial position of the textinput cursor to the top-left corner

Jetpack compose TextField, is there a way to show a drag handle bubble to move cursor position when editing text?

SwiftUI TextField cursor colour

TextField with initial value inside StreamBuilder

How to clear the incorrect user input from the command line and set the commandline cursor to its initial position in C# Console?

What is position initial in CSS

Set initial scrollbar position

Initial position of a SwiftUI view

add padding to TextField cursor / center the TextField cursor in flutter

TextField label border position

mouse position (Cursor.Position)

Cursor and text not showing in TextField Flutter

QML: Change cursor color in TextField

Move cursor to the end of TextField - Nativescript

The textfield cursor does not work correctly

Flutter TextField cursor strange behaviour

Set cursor position into TextInput

Preserving cursor position with angularjs