Change background of the text in a TextBox

(JavaFX 1.3) How can one change the background (color, gradient, whatever) of the text in a TextBox without affecting any of the other display (Skin) attributes for the TextBox?
A related question is: How can I programmatically determine the background (color, gradient, whatever) of the text in a TextBox?
I would like to be able to indicate to the user that the text entered is not valid by changing the background of the text to something other than the original background and change it back to the original background when the text is valid. This would probably be done inside overridden replaceSelection and/or commit functions when extending a TextBox.

This seems to change the background of a button from the caspian style to something else and back to the caspian style, without losing the focus highlight.
// caspianFXBodyColor = definition of -fx-body-color in .scene from caspian.css
def caspianFXBodyColor = "linear (0%,0%) to (0%,100%) stops (0,derive(-fx-color,34%)) (1,derive(-fx-color,-18%))";
def revisedFXBodyColor = "red";
Stage {
  scene: Scene {
    width: 250
    height: 300
    content: Button {
      var isCaspian = true;
      var bodyColor: String = caspianFXBodyColor;
      text: "push me"
      style: bind "-fx-body-color: {bodyColor};"
      action: function() {
        if (isCaspian = not isCaspian) bodyColor = caspianFXBodyColor
        else bodyColor = revisedFXBodyColor;
}However, the original question regarding how to do this for a TextBox remains unanswered. The following code demonstrates that changing the value for -fx-background-color changes the background color as desired, but the focus highlight is lost. Changing the value of -fx-body-color has no visible effect.
// caspianBGColor = definition of -fx-background-color in .text-box{} in caspian.css
def caspianBGColor = "-fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, -fx-control-inner-background;";
def revisedBGColor = "-fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, red;";
def caspianBodyColor = "-fx-body-color: -fx-control-inner-background;";
def revisedBodyColor = "-fx-body-color: red;";
def box = TextBox { text: "sample text" }
var isCaspianBackground = true;
var isCaspianBody = true;
def button1 = Button {
  text: bind "change {if (isCaspianBackground) 'from' else 'to'} caspian background color"
  action: function() {
    if (isCaspianBackground) box.style = revisedBGColor else box.style = caspianBGColor;
    isCaspianBackground = not isCaspianBackground;
def button2 = Button {
  text: bind "change {if (isCaspianBody) 'from' else 'to'} caspian body color"
  action: function() {
    if (isCaspianBody) box.style = revisedBodyColor else box.style = caspianBodyColor;
    isCaspianBody = not isCaspianBody;
Stage {
  scene: Scene {
    width: 250
    height: 300
    content: [ VBox { content: [ box, button1, button2 ] } ]
}Edited by: timdoodle on Aug 13, 2010 5:25 PM
Code was not displayed correctly. Some text inside braces was not displayed.

Similar Messages

  • Change the background color of a particular word without changing the background color of the rest of the text in a textbox

    Hello,
    I'm designing my own website and want to know how to change the background color of a particular word without changing the background color of the rest of the text in a textbox. If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Thank you very much!
    Roger.

    If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Read this :
         Create and add a TABLE in iWeb »
         More about a TABLE in iWeb »
         Sample 1
         Sample 2

  • How to change background color of text in pdf based by font name

    Hi
    How to change the background color of text in PDF based by font name. Is there any option in Javascript. e.g: If PDF containing ARIAL font, the ARIAL text background color needs to be changed in red color for all pages. Same for all fonts with different different color in the PDF.
    Thanks in Advance

    Hi
    1) Is there any possibilities to highlight with different color based on font using javascript
    2) list of font used in PDF using javascript
    3) How to hilight the text using javascript
    Thanks in Advance

  • Change background color during text edit mode

    THis is a wacky problem...
    I have a presentation template. The slide master has white copy in the title and black copy in the body/bulleted list.
    When I try to use the template and edit the title copy, the background color for editing that line is white, just like the text, so I can't see what I'm typing. I can't figure out how to change the background color during text edit mode so that I can actually see what I'm typing. Is there a way to make this transparent?
    For some reason, the body copy edit works fine: black text edited in either a white or transparent background color.
    help!

    THis is a wacky problem...
    I have a presentation template. The slide master has white copy in the title and black copy in the body/bulleted list.
    When I try to use the template and edit the title copy, the background color for editing that line is white, just like the text, so I can't see what I'm typing. I can't figure out how to change the background color during text edit mode so that I can actually see what I'm typing. Is there a way to make this transparent?
    For some reason, the body copy edit works fine: black text edited in either a white or transparent background color.
    help!

  • HOW TO CHANGE BACKGROUND AT THE TOP FROM FIREWORKS?

    HOW TO CHANGE THE BACKGROUND AT THE TOP? IT NOW HAS FIREWORKS.
    == This happened ==
    Every time Firefox opened
    == Option to change to the fireworks at the top

    Sounds that you installed a Persona.
    You can uninstall that Persona and revert to the ''Default'' theme (Tools > Add-ons > Themes).
    See [[Using themes with Firefox]] and http://kb.mozillazine.org/Themes (Lightweight theme)

  • Can we change background of the table

    can any body knows how to change backgorung of the table component
    and also how to add buttons in a table header
    thanks in advance

    yes by changing the theme of the project. which is a pain in the ass.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/themes.html

  • Changing language of the text elements

    hi all,
    i have a text module printed in english. i want to translate the textmodule into Japaneese.
    The form into which i am calling the text module is in english , but i want to translate a particular textmodule into japaneese.how to do that?
    thanks & regards,
    jyoti

    Hello jyoti,
    I suppose you mean SmartForms.
    in SAP R/3 4.6C : the textmodule is always called with the language of the 
                               SmartForm (your case EN). The only solution would be, that
                               your textmodule ist in EN but inside is Japaneese.
    from SAP WEB 6.10: you can define choosed language of your textmodule
                                    dynamically or statically.
    Regards,
    Peter

  • Change Background to White & Text To Black

    Hello,
    I am trying to use FCP7 to change my background to white (rather than black) and my text to white.
    I used View -> Background -> White and then changed my text colour to white.
    Everything seems fine in my timeline, and is rendered.
    But when I go to Export video, the export has a blackbackground and no text.
    Any help would be much appreciated.
    Thanks,
    Marc

    Thanks Nick, I asked a friend about Color Matte. You were right. The next step is chose Color Solid then change that color from blue to white. Then add a new track and insert slug with the white color matte and all is good! Thanks!
    Marc

  • Is there any way to change or remove the 'text-tone' sound iPhone's make when sending an SMS/iMessage.

    Is there any way to change or remove this sound? The same sound is played if an SMS / message is received while a chat window is open, regardless of your 'text-tone' sound settings. Any ideas on how to change or fix this issue? Thanks.

    No, there is no way of changing that particular sound.  Sounds like a blip.

  • QUESTION: Changing Backgrounds on the Curve ( How To Transfer from the 8700g )

    Good Morning,
    I am new to the Blackberry Family and so far, I love it ...... I have a question that could nopt be answered by the T-Mobile Support Folks.
    I ended up getting the 8700g phone and it has a ton of different backgrounds that come standard with it, I then decided to order a Curve which came yesterday, I was able to transfer my phone numbers and notes over, I used the CD that came with the unit. 
    The Curve really came with no additional backgrounds other than that blue one, my question is how can I transfer all of those backgrounds from that 8700g over to my curve to use ?
    I would truly appreciate any help and guidance .....
    Thank You in Advance !
    Bill

    What you have on your computer is your iTunes library, not your "account."  The "account" you have for iTunes is your Apple ID, which you use when purchasing or downloading from the iTunes Store.  If these songs came from music CDs that you imported into iTunes, those songs are not related to your Apple ID.
    Recently my itunes account changed for some unknown reason and now it doesn't recognize the songs from the cds
    How are they not "recognized"?  Are the songs still listed in your iTunes music library, but grayed out?  They no longer appear in your iTunes library at all?
    If you search your computer (not in iTunes) for the song files, using one of the song names, can you find the song files?

  • Acrobat pro 9 - How do I reference the text in another textbox on another page?

    Near the top of each page on my form I have a text box that users are to enter their company name.  Unfortunately, there is the same information requested on each page in the form.  It is too far down to use a header, but I don't think you can place a field in the header.
    I know that you can use the Calculate tab to reference the numeric values of other fields, for mathematical purposes.  What I would like to do is: Have the other company name fields in the rest of document reference the first one so the user only has to enter it once.
    I have been searching and googling without success, and I even checked the manual but found no reference in the logical areas.  Can this be done with Acrobat Pro 9?
    Thanks in advance for your help.
    Gregory

    Huh.  Whaddya know, it does.  Such an easy solution.  And it is probably documented somewhere.  I guess I should have done more than skim through the manual.  Thanks Gilad.

  • How can type a word on an image in Ps and change the text box background

    How can I type a word on an Image in Ps and change the background of the text box

    Photoshop doesnt have an ability to fill a text box so you will have to create a layer underneath the text layer. A shape layer work work well. That can be filled and stroked quite easily with editability.

  • Can you no longer have a background color for the text box in the new version of hp photo creations

    just updated to the new version of HP Photo Creations, used to be able to have a colored background for the text box - is that no longer possible in this new (not better) version????!!!!! Uuuuuuuuuugh

    Hi Lainey.
    Thanks for asking. We're working on bringing back that feature. In the meantime, here's another way to add text backgrounds: Add a placeable graphic and then click the Arrange button to send it to the back, behind the text.
    That approach also gives you more interesting shapes. The new alignment guides make it a snap to align a graphic with a text box. In the example below (it may take a day for the image to show up here), I also used the new Premium Editing Features to change the color of the graphic.
    P.S. — Applying a thick border to an empty text box (also using the Premium Editing Features) is another way to create a background shape. That has the advantage of letting you pick any color for the box. You'll also find several new text styles at the bottom of the new text menu.
    Let us know if we can help further,
    RocketLife 
    RocketLife, developer of HP Photo Creations
    » Visit the HP Photo Creations Facebook page — news, tips, and inspiration
    » See the HP Photo Creations video tours — cool tips in under 2 minutes
    » Contact Customer Support — get answers from the experts

  • How to change the text variables for a standard report-writer report ?

    I am trying to change the text variables for a report -writer report and transport the same so as to change the title page and the report output heading  .I know the Report-Group 6Z02 and the library 6O1 to which it belongs.I tried using the change transaction GR32 after going to the area menu through FGRP . I try to change the text variables through  but it throws an error "You chose a name in the reserved name range - try different name ".
    I have also tried copying this report into another report and changing the new report . I was able to change and save the text variables . Now when I try to overwrite the original report 6Z02-001 with this new report , it does not allow that.
    Let me know how I can change the text variables for the same

    Can anyone please suggest me what to do here ?

  • Change background color of textbox based on non-visible value

    Hello,
    I have a 10g master - detail form. I was wondering how can I change background color of text box (NAME) based on non-visivle item (MODIFIED_BY) value.
    So far, I have created two visual attributes and have put following code on "WHEN_NEW_BLOCK_INSTANCE" trigger
    if( :main.MODIFIED_BY = 'COCO') then
         SET_ITEM_PROPERTY('main.NAME',VISUAL_ATTRIBUTE,'VA_BLUE');
    else
         SET_ITEM_PROPERTY('main.NAME',VISUAL_ATTRIBUTE,'VA_RED');
    end if;
         But, it always goes to "ELSE" part and make RED color for all records. Could you please help me with this?
    Thanks.

    Got it.
    Post Query trigger on block
         if (:main.MODIFIED_BY ='COCO') then
              set_item_instance_property('main.NAME',current_record,visual_attribute,'VA_BLUE');
         else
              set_item_instance_property('main.NAME',current_record,visual_attribute,'VA_RED');
         end if;Thanks

Maybe you are looking for

  • Can I use multiple audio inputs in Flash Media Live Encoder?

    This is the closet forum section to that program and I was wondering if there was any way to take the audio input from my capture card as well as a microphone and use those together at the same time.

  • Oracle SFTP adapter Configuration for BPEL  process (11.1.1.3 )

    Hi All, Can someone tell me how to configure the FTP adapter for window's server. We already have a bpel process with FTP adapter but it is set up for unix server , we want to change the location to window's server. Can any one provide me with what c

  • How to upgrade Exchange Server 2013 CU5 on my site?

    My site have four Exchange servers . The four Exchange Servers are installed mailbox and cas roles. The Dag achieved by the four servers. Please help me to upgrade exchange server 2013 cu5 on the four servers. how to do? Thanks. 北京老马

  • Argh! Hit escape twice after capturing tape!!! Where did my footage go???

    So yah... This has happened to be several time before... As soon as I finish capturing the full tape, I hit escape to stop capture... Sometimes it looks like the program did not realize I hit escape, so I hit it again... That is when the window opens

  • Export to powerpoint not working for certain views

    Hi All, I am in the process of implementation of STVN 2.1 Pre EHP3 version of Nakisa OrgChart for one of my clients. During testing, it is observed that export to powerpoint object is not working for the following views. 1. Condensed Org. Chart 2. Co