Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8396409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:31:41+00:00 2026-06-09T20:31:41+00:00

I want to create a custom text editing component. Basically I need a text

  • 0

I want to create a custom text editing component. Basically I need a text with an ability to set a caret and handle key events in a custom way. Is there a way to do so in JavaFX? There are implementation specific methods on Text (which are deprecated and comments say that they should be considered private), but I can’t use them.

Is it possible to do so in JavaFX?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:31:43+00:00Added an answer on June 9, 2026 at 8:31 pm
    • For single-lined text, use a TextField.
    • For multi-lined text, use a TextArea.
    • For a styled text, use a HTMLEditor.

    If using a TextField or TextArea, they are both subclasses of TextInputControl. The TextInputControl provides a caretPositionProperty you can use to read and modify the caret position. All scene graph objects (including TextField and TextArea) are instances of Node. A node allows you to set custom EventHandlers and event filters. You can use an event handler to override the default key processing handler of the TextInputControls so that you can implement your own handling.

    If you need further customization capability which you cannot get from customizing a TextField or TextArea instance, then you could create your own TextInputControl subclass and implement the custom text editing component as you need, but I wouldn’t really advise that approach due to the complexity and possible required dependency on internal JavaFX apis that you would likely end up needing.

    TextField doesn’t work for me because: 1. It has a border which indicates focus and which I don’t know how to remove.

    Here is a link to the default caspian.css stylesheet for JavaFX 2.2.
    You can set the the style for TextField to remove the focus border, by setting it’s :focused pseudoclass selector style to the same values as it’s default selector. For example:

    .text-field:focused {
        -fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, -fx-control-inner-background;
        -fx-background-insets: 0, 1, 2;
        -fx-background-radius: 3, 2, 2;
    }
    

    Refer to the JavaFX css reference guide for information on how to use css in JavaFX.

    TextField doesn’t work for me because: 2. It has fixed number of columns and I need to change width dynamically.

    TextField is a resizable control, if you place it in a resizing layout pane with appropriate constraints it will change it’s width dynamically. The number of columns setting in TextField is a preferred column count, not a fixed column count.

    Refer to the JavaFX layout documentation on further information regarding layout in JavaFX.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create custom button and I need it to be circle. How
I want to create a custom set that will automatically convert objects into a
I want to create custom UIButton like [ IMAGE here text here ] How
I want to create a custom toolbar. Here is my code: toolbar:[{ text: Go
i want create a custom json data from the mssql 2008 results so that
I want to create a custom navigation bar to put in my header.phtml file.
I want to create a custom property on one of my entities mapped from
I want to create a custom list in Flex for an interface prototype. The
I want to create a custom alert view within my iOS application. For example,
I want to create a custom style for an activity that will look like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.