How to change the caret/selection color of text input controls?

Hello JavaFX Community,
i'm new to JavaFX. I'm using it since i saw the huge steps forward with version 2.0.
I have the task to migrate a software from Swing to JavaFX. As a part of our corporate design, we used a special color for the caret and text selection. I couldn't find any information about changing the caret color in JavaFX 2, so i'd like to ask you and i'd be very thankful for an advise.
There is a cross-post at StackOverflow:
http://stackoverflow.com/questions/10057989/how-to-change-the-caret-color-in-javafx-2-0
Thanks and best regards.

This might be possible, but it is not trivial. You cannot do it with a standard API at this time, you will have to look into creating a skin that allows for these properties to be controlled.
For example, the color of the caret is currently controlled in the TextFieldSkin (look for the "caretPath" property). Just forcing a color change in a subclassed skin is not so hard. Something like this:
public class MyTextFieldSkin extends TextFieldSkin {
  public MyTextFieldSkin() {
    this.caretPath.fillProperty().unbind();
    this.caretPath.fillProperty().set(Color.RED);
}However, it gets trickier if this color must be dynamic and if you want other things to be changed as well. It is a place to start though.
Many of the skins methods and properties are 'protected' though, so atleast in Skin subclasses you have a lot of options to introduce new features and behaviour.

Similar Messages

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

  • I want to change the size and color of text in call out boxes and text boxes. How can I do this? Jack

    I want to change the size and color of text in call out boxes and text boxes. How can I do this? Jack

    Highlite the text inside the text box and then press Ctrl+E.

  • How to change the line's color?

    In a linechart, if the backgroundColor of
    Application is not "#ffffff",there will be some white
    horizontal lines in the linechart. how to change the
    line's color?? thanks

    Hi, I hope this is what you are looking for:
    http://blog.flexexamples.com/2007/11/15/customizing-the-horizontal-grid-lines-in-a-flex-li nechart-control/

  • How can I change the disabled of a message text input base on a choice

    how can I change the disabled of a message text input when a dropdown list value is changed? I declare the primaryclientaction but I don't know how to make the event automatically change the disabled of the message text input to true or false.
    HELP!!!! IT'S URGENT....

    Hi,
    assuming you are using ADF Faces:
    Put a submit(); in the on-change javascript event of the dropdown.
    In the disabled property of the input text use some EL to reference the value of the dropdown eg disabled="{#{! bindings.Fruit.inputValue == 'BANANA'}"
    Brenden

  • How to change the Hyper links color in the XML form

    HI SDNs
    Do u have any idea how to change the hyperlink color in the xml form. My requirement is as follows.I have created xml form by using xml template and i displayed this xml form by using Km document iview.  I need tochange the hyper link color in the xml form content. I dont want to go for manual process by editing the xml form. because i have several hundreds of xml forms.
    Appreciate if you give suggestion.
    Thanks
    Ramana

    Hi Ramana,
    The most convenient way to change the hyper links is by using the Theme Editor. Go to System Administration --> Portal Display --> Select Theme --> Component-Specific Styles --> Links --> Function/Result Link.
    Hope this helps.
    Kind regards,
    Joost

  • How to change the Find highlight color

    I am trying to find out if there is a way to change the Find Highlight color in office 2013.
    Every time I search for a word or anything it uses a light yallow to highlight that line or word, and I woudl like to replace the yellow with like a teal or a green or some other color that I'm not using already in my Word document. This way I can find out
    were it is telling me It is because I have a lot of stuff already highlighted yallow, and when I click find and search for something in the Navigation window and it finds it. It also puts it as a lighter yellow and it confuses me.

    Hi,
    As far as I know, we can't change the highlight color when using Find in Word. The highlight color is fixed.
    As a workaround, you can try to use Advanced Find instead which will show the search result with a different color.
    Best Regards,
    Steve Fan
    TechNet Community Support

  • How to change the numbers of items in a ring control in run time ?

    Hi !
    I would like change the numbers of items in a ring control in run time, but I can´t.
    Thanks.

    Hello blaze,
    did you try the "Strings And Values []" property of the ring?
    LabView7.1 help says:
    Array of clusters containing the strings from which you can select in the ring control
    and the numeric values for each item. Use the Strings [] property if you do not need to
    assign specific numeric values to each item.
    Best regards,
    GerdW
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to change the stsndard selection text for a LDB..

    Hi All,
        I am using a LDB selection screen. I want to change the selection text of the standard selecetion field.
    For ex, for LDB- PNP, i want to change the 'Personnel number' text to 'Employee ID'...
    Please let me know how to do this.
    Regards
    Nanda

    Hi Nanda,
    Here is the code which is exactly suitable for this req.
    TABLES: pernr.
    data: i_tab type standard table of RSSELTEXTS with header line.
    initialization.
    i_tab-name = 'PNPPERNR'.
    i_tab-kind = 'S'.
    i_tab-text = 'Employee ID'.
    append i_tab.
    CALL FUNCTION 'SELECTION_TEXTS_MODIFY'
      EXPORTING
        program                           = 'ZESO_TEST'
      tables
        seltexts                          = i_tab
    EXCEPTIONS
      PROGRAM_NOT_FOUND                 = 1
      PROGRAM_CANNOT_BE_GENERATED       = 2
      OTHERS                            = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks
    Eswar

  • [i]How to change the[/i]   background color in a webdynpro?

    Does somebody know how I can simpley change the background color in a webdynpro?

    You need to use external CSS..via the sap-ep-themeroot or sap-cssurl.
    For downloading and changing CSS. pls refer to
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7015b1f9-535c-2910-c8b7-e681fe75aaf8
    Note: as stated in the documentation for a external CSS, that is just placing it in /SAP/PUBLIC Folder, <b>did not work</b> for me....
    Do following it works..
    Create a BSP application, ZCUSTOMTHEME. GO to MIME Repository and create a folder zmytheme under ZCUSTOMTHEME
    open SE38 and execute BSP_UPDATE_MIMEREPOS and upload ur custom theme under this folder.. /sap/bc/bsp/sap/ZCUSTOMTHEME/zmytheme
    While calling ur WD application....append following at end of URL
    sap-ep-themeroot = /sap/bc/bsp/ZCUSTOMTHEME/zmytheme'

  • How to change the disabled value color of messageTextInput

    Hi,
    I have a requirement to change the value color of messageTextInput. And I had apply custom look and feel. For normal messageTextInput, I can change its color, but for disabled messageTextInput, the value is always gray out. I can't change its color.
    Could anyone tell me how to change it?
    Thanks,
    Eileen

    Eileen,
    This is the code u need to use in process request:
    OAMessageTextInputBean x = (OAMessageTextInputBean)webBean.findChildRecursive("<item id of message text input which have to disable>");
    //If item id of the next message text input is XXX, on which
    //u wanna set focus when user clicks on ur disables message text input
    x.setOnFocus("javascript:XXX.focus();");
    Now u can set CSS class.The above code will automatically set focus on field with item id XXX, when user clicks on it, thus not allowing user to enter anything in that message text input.
    I hope this helps.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do you change the roll over color of text?

    i have text that i made a link and the roll over color is orange....how do i change this color? thanks

    cocktail5555,
    It's laid out pretty good by Suzanne Boben in in this thread, or you can use FrogDance.
    Mark

  • How to change the Dynamic Selection screen

    Dear Freinds,
                I have requirement where in on the selection of Dynamic Selections ( iam using PNP logical database) i want to add another fields , could  any one tell me how to change  Dynamic Selections as per my requirement.
    please let me know .
    regards
    divya

    Hi Prat,
               I have done similar way and saved the view ( i.e se80> ediobject>table>table name > given all the tables required for me and i try to saved it is not allowing to save and giving message as empty view cannot be saved. Therefore i have selected the tables which have been added and made one by table and selected them . some how it got saved. Now when i added this name of the view in the custom report caterogy and executed my custom report and selected the > dynamic selections i found as empty and in debugging i can see all the 4 tables which i have mentioed while createing view are there . But i dint understood why the custom View is empty.
    please correct me where i went wrong.
    regards
    divya'

  • How to chang the row's color in the Jtable?

    I have a table and many rows,I want chang the rows color,like row one's color is red,row tow's color is write,row three's color is green.How can do it? And if i want chang row 3,coloum 2's color.How can do it?
    thanks.

    hi,
    I use jdbtable to view data,I want them to chang row color when some cells equal the value.But interface getTableCellRendererComponent not run.I don't know why!
    jdbtable is extend jtable ,it made in borland jbuilder.
    //1 class
    package errorreport;
    import java.awt.Component;
    import java.awt.Color;
    import javax.swing.table.DefaultTableCellRenderer;
    import com.borland.dbswing.*;
    public class rowcolor extends DefaultTableCellRenderer {
    public Component getTableCellRendererComponent
    (JdbTable table, Object value, boolean isSelected,
    boolean hasFocus, int row, int column)
    Component cell = super.getTableCellRendererComponent
    (table, value, isSelected, hasFocus, row, column);
    int iColcount = 0;
    iColcount = table.getColumnCount();
    if( value instanceof String )
    String strAlmlev = (String)value;
    if(strAlmlev.trim().equals("C1"))
    cell.setBackground( Color.red );
    // You can also customize the Font and Foreground this way
    // cell.setForeground();
    // cell.setFont();
    else
    if(strAlmlev.trim().equals("C2"))
    cell.setBackground( Color.orange );
    else
    if(strAlmlev.trim().equals("C3"))
    cell.setBackground( Color.yellow );
    else
    if(strAlmlev.trim().equals("ERR"))
    cell.setBackground( Color.green );
    return cell;
    //2 class
    JdbTable jdbTable2 = new JdbTable();
    TableCellRenderer renderer = new rowcolor();
    try
    jdbTable2.setDefaultRenderer( Class.forName( "java.lang.String" ), renderer );
    catch( ClassNotFoundException ex )
    System.exit( 0 );
    thanks

  • How to change the Video Background Color - The Answer...Not the Question.

    Hello All,
    I was struggling with the Video Background Color as I was setting up my DVD. I'm new to DVD Studio Pro. I couldn't get the color to change from grey to the desired black. I was moments from asking for help, but thought to try just a bit harder. The answer lies under Preferences, Menu, Video Background Color. Just thought I'd share for future search strings by others.
    Ahh, onward!
    DG

    The id is applied by (I think) the skin class of the ChoiceBox. You don't need to define it.
    You have to apply the css in an external style sheet. You can apply the external style sheet to any parent of your choice box, or to the scene (the most usual way to do it).
    Example:
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class ChoiceBoxTest extends Application {
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Example 2");
        final ChoiceBox<String> choiceBox = new ChoiceBox<>();
        List<String> tempResult = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
          tempResult.add("Item " + i);
        choiceBox.getItems().setAll(tempResult);
        VBox root = new VBox();
        root.getChildren().add(choiceBox);
        final Scene scene = new Scene(root, 300, 250);
        scene.getStylesheets().add("choiceBox.css");
        primaryStage.setScene(scene);
        primaryStage.show();   
      public static void main(String[] args) {
        launch(args);
    choiceBox.css:
    @CHARSET "UTF-8";
    #choice-box-menu-item:focused  {
    -fx-background-color: yellow ;
    #choice-box-menu-item .label {
    -fx-text-fill: black ;
    Message was edited by: James_D

Maybe you are looking for

  • How do I use safari v8 to navigate as I did with my former safari versions?

    I just got a Mac Air with OS X Yosemite (Safari V8).  I cannot figure out how to do the simplest thing!  .... like navigate to see the yahoo or google web site home page --- even when I set up my preferences. The tutorial did not help - is there an a

  • Hp smart print for officejet 8100 on windows 8.1

    ASKING:  Is HP SMART add on / plug in (for economy of ink / paper)  still available for website printing  with an HP Officejet 8100 on WIndows 8.1??  This restricts printing to "only" a portion of a webpage? Thanks. This question was solved. View Sol

  • 3D files in After Effects CC

    Isn't that like saying, you didn't meet your own deadline? I'm glad it has worked towards yours and C4$D's advantage.. $$$$ Anyway, I am a whole hearted Blender Freak. On my 4th year now. You can do almost anything in Blender, and since it's such a s

  • Using Quality Center (v9.0) to automate testing in SAP- questions/guidence

    Hi, First time on the expert forums for me. Hope you are able to help provide some guidance on this area for me. Overview is our client is looking to fully automate testing in SAP for patches/upgrades/new developments by using Quality Centre v9.0 (wh

  • My contacts hear when people call me

    Hi, I have a problem with the iphone, I asked to other people who have iPhone and they have the same problem. When I'm talking and new call come, the people who I'm talking hear the tone and know that I have a new call. Thanks!