Is it possible to forbid selection in TextField?

I have a small problem: my text field keeps selecting itself, for example if I alt-tab from and to application.
For my application, text selection is not needed and will not be used - so I want to disallow this annoying behavior. Actually, just setting selection color to transparent or white will work fine.
Is there some way to do this?

just setting selection color to transparent or white will work fine.Having an editable field without being able to see selections in the field does seem kind of strange to me. But anyway, you can do that via css:
textField.setStyle("-fx-highlight-fill: null; -fx-highlight-text-fill: -fx-text-fill;");Create a stylesheet styling .text-input if you want to apply the style to all text input fields.
See the JavaFX css reference guide for answers to all of your css related question: http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html
You can also listen on the selectedTextProperty and clear the selection whenever something is selected.
Sample app:
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TextFieldHighlightFill extends Application {
  public static void main(String[] args) { launch(args); }
  @Override public void start(final Stage stage) throws Exception {
    TextField standardTextField = new TextField("Plain Jane");
    TextField styledTextField = new TextField("Jumping Jackrabbits");
    styledTextField.setStyle("-fx-highlight-fill: null; -fx-highlight-text-fill: -fx-text-fill;");
    final TextField forbiddenTextField = new TextField("Happy hippopotamuses");
    forbiddenTextField.setStyle("-fx-highlight-fill: null; -fx-highlight-text-fill: -fx-text-fill;");
    forbiddenTextField.selectedTextProperty().addListener(new ChangeListener<String>() {
      @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
        if (newValue != null || !newValue.isEmpty()) {
          int caretAt = forbiddenTextField.getCaretPosition();
          forbiddenTextField.selectRange(caretAt, caretAt);
    final VBox layout = new VBox(10);
    layout.getChildren().addAll(standardTextField, styledTextField, forbiddenTextField);
    layout.setStyle("-fx-padding: 10; -fx-background-color: cornsilk;");
    stage.setScene(new Scene(layout));
    stage.show();
}

Similar Messages

  • Is it possible user to select the chart type in WAD??

    Hi All,
    I have a requirement in WAD, where customer wants to select their own desired chart in WAD.
    Is it possible user to select the chart type?? If so please let me know the path where i need to do the setting.
    Thanks in Advance.
    Regards
    Sathiya

    Hi,
    you have to press the right mouse button on the chart (it is not so easy - there are 2 different context menus) -> in context menu -> properties -> web item -> chart setting -> chart type
    Regards
    Erwin Buda

  • Possible to trigger select() to continue without new data?

    Hi, I have 2 questions regarding select() and non-blocking sockets.
    1) Is it possible to use select() for multiple client sockets? seems all examples are focusing on the server-side.
    2) Is it possible to tell (by code ofc) the blocking select() method to continue execution even though there are no new events on the attached sockets?
    Thanks.

    So call Selector.select(timeout) with a non-zero timeout so it won't block indefinitely, and when it returns check the selected key set and also process your vector.
    The code for a client socket is exactly the same as the code for an accepted server socket, of which there are plently of examples in the JDK and the Networking Tutorial. The only additional thing is that you have to call connect() on the SocketChannel, register for OP_CONNECT, call finishConnect() when you get it, and deregister OP_CONNECT if finishConnect() returns true.

  • Problem winth drag and selection on textfields (Possible BUG?)

    Hello
    I've been trying to eneble draging of images and selections on RichTextEditor to make them more interactive. I've been successfull at doing this and it wasn´t that hard to make once you learn the right functions on textfields. But, my current problem is that when I start a drag operation from a text field and then I make the drop on the same textField some mouse events seem not to be reaching the selection control of the textfield.
    What happens is that once the drag operation is over, the textfield behaves as if the mouse is still pressed, marking a text selection. This behavior tends to finish once you click the mouse.
    I was wondering if this is a bug on the TextField or if I have to have some extra considerations when draging on a text field.
    Thanks.
    Sebastian

    OK it seems that it's actually a bug, but I was able to narrow it down a bit.
    When you change the state of the textfield from selectable = true to selectable = false while a selection n the textfield is been made, then when you set selectable back to true, the textfield continue to make a selection even though the mouse is no longer down. This is more likely a problem with the textField form flash than a problem with flex.

  • Automatic select textbox / textfield ?

    Hello,
    Is it possible to get an automatically focus on a textbox (or
    textfield) in Flash?
    I tried this:
    Selection.setFocus(input_txt);
    Selection.setSelection();
    where input_txt is the instance name of the textfield.
    It does not work?
    Does anyone know how to do this?
    Regards,
    Micheal.

    Hi,
    Try this.
    Selection.setFocus("input_txt");
    instance name of the textfield should be within doublecodes.
    It works when you run the swf file seperately
    GHMS

  • XML Publisher Report  - Possible for multi-select LOV parameters?

    I am new to using BI Publisher for generating reports out of E-Business Suite. I am looking for assistance with 2 questions below
    1. I have created an LOV parameter based on a value set, is it possible to allow the user to select one, all, or a subset?
    2. Is there a way to model an "IN" statement in the XML where using the parameter?
    Thank you.

    With whatever i could make out is you are trying to change a discovere report to xml; publisher report isnt it?
    To answe to your question, directly it is not possible to have In clause but you could use some smart logic like lexical parameters etc to achieve similar things.I guess you cannot do in in EBS Reports too.

  • Is it possible to nest SELECT statements?

    Greetings community,
    Another newbie’s question it is. Looking tutorials and some posts here I’ve been advised not to pull entire table through the local network, and torture client machines’ processors and memory. It’s been said that better solution is to
    pull just one part of the table.
    So, imagine this: you want to make a part of your app that would allow your user to view list of orders. So you put one data grid view on the form, pull last 20 headers from the table into it and leave to user to choose one to be opened
    in another form. If user doesn’t find header they want, they press page up for example and previous 20 headers are loaded into data grid view. Of course, user could filter headers list by customer, or by distribution lane (having all customers residing in
    one part of the town), or whatever more, but let’s not complicate things at this moment, because I’m practically in the beginning.
    I’m trying to make a stored procedure that would load penultimate 20 headers when user presses page up. So, not knowing any better, I created table variable that has the same structure as Orders table with one difference: OrderID column,
    which is identity (auto incremented) in Orders table, here is simply defined as bigint not null. Community member Visakh16 warned me few months ago it’s the bad practice to put self-incrementing columns in table variables.
    At this moment there’s a query on my screen, which waits to become store procedure. After boring part with table variable definition, it goes like this:
    INSERT INTO @OrdersTemp SELECT TOP 40 * FROM dbo.Orders ORDER BY OrderID DESC
    SELECT TOP 20 * FROM @OrdersTemp ORDER BY OrderID ASC
    To put that simply, I pull last 40 headers into table variable, and then pull first 20 from there. This thing works, and I just have to replace 40 with parameter, for every page up or down.
    Now I have few questions.
    -Is there some better way (considering performance) to achieve that? Here is the place where I wanted to ask the question from the title of the post. I don’t know much about T-SQL, and I’m not sure about the proper syntax to nest SELECT
    statements, if something like that is even possible
    -Is there any better way (some built-in function) to find about the count of the rows in one table than
    SELECT COUNT(OrdersID) FROM dbo.Orders
    Thanks for any suggestions.

    Hi Erland,
    Sorry for the very late reply, but I said that I would start another thread when I find more free time to dedicate it to this, so I didn’t really expected you to reply anymore. I didn’t really check here for more than a week, and I glanced
    at mail accidentally.
    As for the negative result I got, its measurement unit is microsecond, so it doesn’t go out of margins you had experienced.
    As for the number of cores, you got me surprised there. I use express edition of SQL server. Last time I checked was SQL server 2012 express, and in specifications it said that express edition is limited to 1 processor core, 1GB of RAM
    and creates up to 10GB database file. I don’t believe they changed any of those specifications. It was generous enough when they doubled size of DB file few editions ago. Still, it appears that “one processor core for express edition” statement has some gray
    areas in it.
    However, at this moment I’m just learning, and I just wanted some way to test how efficient my queries are. I don’t have a real biz problem to solve. I don’t expect that any real performance problem should rise in years of everyday work
    of populating database. What I expect is performance impact when it comes to creating reports, but after all, I don’t think that my boss would create reports by himself. I believe that creating reports would be my task, and I will be doing it after hours,
    being the only user at the moment. Or maybe I could make de-normalized copy of database that would be populated after hours to make it possible for my boss to get his reports faster by himself, as I’ve heard that was the way of making BI in older non-express
    editions.
    So, I do suggest that we finally close this thread for sake of other readers. I’ll start another one with this subject when I find the time to do it.
    Again, thanks for being with me along this journey.

  • Setting the background color of the selection when text selected (input TextField)

    My input TextField has a black background. The problem is,
    when some text is enter and then selected, the selection background
    color remains black and the selected text remains white. Because of
    this it's imposible to tell that the text has been selected. Is
    there a way to change the selection background color, or do I
    really have to write a custom textfield? :(

    Yes, I do have an additional attribute called "identity" which is set to the original table where it came from. The problem is that I do not know how to check for it in my renderer. I will post my renderer code here
    public class myTableRenderer extends DefaultTableCellRenderer{
    public Component getTableCellRendererComponent( JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
    final Component component = super.getTableCellRendererComponent(table, value,isSelected,hasFocus, row, column);
    if ( value != null ) {
    if ( value instanceof String ) {
    String val = value.toString();
    if ( val.compareTo("DisplayKnown") == 0 ) {
    component.setBackground(Color.CYAN);
    else
    component.setBackground(Color.LIGHT_GRAY);
    } // end if value not null
    return component;
    } // end mytablerenderer
    What happens here, is that only the column with the identity value "DisplayKnown" gets the color blue. I would like to color the whole row with that column value to be Blue.
    Does this make sense??
    Thanks,
    npatel

  • Is it possible to hide selected bookmarks in bookmark pane?

    We want our application to launch a PDF opened to a certain bookmark. However, that bookmark will be a numeric ID, so we don't want it to be displayed in the bookmark pane. We DO want the bookmark pane to display our standard table of contents.
    So, is it possible to selectively hide the numeric ID bookmarks, while leaving the bookmarks based on text headings visible? The PDF will be generated from an InDesign file (CS6) on Windows 7.
    Thanks for any help and advice.
    RB

    Here's an example to help you think of how to use destinations. In InDesign CS6, I created two hyperlink destinations (Hyperlinks panel > Panel menu > New Hyperlink Destination). I selected headlines on pages 4 and 5: "Seeds of Inspiration" on page 4, and "Professor Wangari Maathai" on page 5, and chose New Hyperlink Destination. Because they were text, Text Anchors were created.
    On Page 3, which is the table of contents you see below, I selected the entry "Seeds of Inspiration......page 4" and turned into a Hyperlink (Panel menu > New Hyperlink). I selected the Text Anchor for page 4. I repeated a hyperlink leading to the Text Anchor on page 5. So you can use hyperlinks to take you to a destination.
    But you could also create a button (you mentioned user presses F1 on a particular screen—that could be a button). So I also created a button at the top of page 3. The button has an action: Go to Destination. I selected the same Text Anchor I used with a link. When the button is selected in Acrobat, its settings are shown on the left side of the screen capture.
    I don't usually use the Destinations panel. I don't need it, but you can see that the destinations are listed in the Destinations panel.

  • Is it possible to pass selected value from one jsp to another jsp page?

    In my welcome page(in jsp), if the user is selecting some values, is it possible to pass those values to another jsp page and display?
    If yes, how can it be done?
    please help..

    Yes, you would have to make the motion from one page to the next submit a form. Then on the second JSP you can use request.getParameter("nameOfInputField") to get the value the user selected.

  • Possible to automatically select text field data on enter

    I have been trolling this forum for a couple weeks and have figured out everything on my form except this issue.
    I would like my form to automatically select the "data" that is in a text or numeric field when the field is entered. 
    For example:  If I open a form that has been filled out previously I would like each field's data to be selected when I enter the field either by tab or clicking on the field.  This way I can overwrite the current data much easier without having to double click to "select all" or backspace to delete the current field.  It is possible that the data should stay the same so I dont want the data to be deleted on enter just "selected"
    Thanks for your help,
    Joe

    Hi Joe, When using the keyboard and tabbing to a field all the fields contents are selected, but this doesn't happen when using the mouse and clicking into a field.  Have a look at this sample which tries make the mouse behave the same as the keyboard http://adobelivecycledesignercookbookbybr001.blogspot.com.au/2013/05/on-click-select-all-t ext-in-form-field.html.  Bruce

  • ** Is it possible to give select command from multiple tables in JDBC

    Hi Friends,
    Is it possible to give the select command to select data from multiple tables directly in the 'Query SQL statement' in JDBC sender communication channel ? (Instead of Stored Procedure)
    Thanking you.
    Kind Regards,
    Jeg P.

    Hi,
    here is a sample:
    Table #1
    Header
    Name EmpId Status
    Jai 5601 0
    Karthik 5579 0
    Table #2
    Name Contactnumber
    Jai 9894268913
    Jai 04312432431
    Karthik 98984110335
    Karthik 04222643993
    select Header.Name, Header.EmpId, Item.Contactnumber from Header,Item where Header.Name = (select min(Header.Name) from Header where Header.Status = 0) and Header.Name = Item.Name
    Regards Mario

  • Possibility for multiple selection in F4 help

    Hi,
    at the moment I have to change the marketing attributes in PCUI. We need a functionality that allows us to select multiple values in the F4 help and depending on the amount of selected values the amount of entries for marketing attributes will be generated.
    Is there a possibility to realise a multiple selection in F4 helps?
    What needs to be done?
    Would be great if you could help me.
    Kind regards,
    Timo

    Hi Naveen,
    thanks for your help. Just to be sure, I meant a standard simple F4 help using F4_main.do. Is it somehow possible to change it there for one specific F4 help or do I need to develop a complete new BSP application for it? The BSP application I'm talking about is not a custom developped application but generated through F4_main.do
    Kind regards,
    Timo

  • Is it possible send a SELECT APDU from one applet to another?

    Hello i want to select one applet from another. is it possible and how?. Thanks

    OK, I went to use this today, and can't figure it out.  Where do I place this code; In the SQL of a query, In the VBA of a form, or In a Modual?
    UPDATE Registrations RIGHT JOIN Registrations2
    ON Registrations.TEXT_REGISTRANT_ID = Registrations2.TEXT_REGISTRANT_ID
    SET Registrations.TEXT_REGISTRANT_ID = Registrations2.TEXT_REGISTRANT_ID,
    Registrations.[Name] = Registrations2.[Name]

  • Copy user-selected HTML textfield

    AS3 targeting Flash 9. Using regular old textfield with htmlText and a stylesheet. The text content has some links, bullets, bold, etc.
    The user may want to select all or part of the text in the textfield and copy the text to paste into Word, email, etc.
    As it is only the text gets copied and not the htmlText. But what I really want to do is do some formatting on the htmlText to make it more readable when they paste it into Word or e-mail. Like replace the <li> tags with bullets, display both the friendly text and the href for links, etc.
    I've figure out how to use RegExp to format the entire htmlText into what I want on the clipboard and that all is working with a "copy" button.
    But I want the user to also be able to use rightclick, menu, or keyboard commands.
    First problem: Is there a way to detect rightclick copy event and/or menu copy event? I'm guessing the answer is no.
    Second problem: Is there a way to align the selectionIndex with the htmlText?
    Anyone have any clever ideas? Thanks.

    You should probably ask in the LiveCycle Designer forum.

Maybe you are looking for

  • IF..THEN..ELSE...not working properly

    Hi experts, iam facing trouble with IF ..THEN..ELSE function. condition is  IF the salearea = 'AB' THEN  date trans DDMMYY------>YYYYMMDD ELSE date trans MMDDYY---- >YYYYMMDD here always the only  ELSE part working. but if use IF WITHOUT ELSE  like b

  • How can I stop the iOs 6 - iOS 7 update on iPhone 4 when I've already started it?

    Started an update on my iPhone 4 but I figured out after making that decision that I'd rather stay on iOs 6. What do I do now? If I connect my phone to wifi, it resumes the update automatically. I don't want the iOs 7 as most of the features don't wo

  • Basic query on PLSQL using TOAD

    hi all, First of all thanks a lot to everyone for always helping and guiding me through all the doubts i had asked here.I have leasrned a lot and appreciate your help. So,my question is executing the STORED PROCEDURE in Toad 9.0 execute assign_daily_

  • Limit purchase order

    Hi All, For my customer we are defining the Limit purchase order (new purchase order type) can any one help me in knowing the process flow for this. Limit purchase order will allow receipt to be made to value specified in the purchase order. Once the

  • I forgot my parental controls pass code on my kids iphone 5

    I forgot my parental control pass word on my kids iPhone 5s