Background color of non editable textfield

Dear all,
how can I set the background color with a css stylesheet of a textfield that is enabled but non editable "textfield.setEditable(false);"?
I can not find an example in the caspian.css stylesheet file.
Regards Tim

Use the -fx-background-color to change the background color of a TextField.
Whether the textfield is editable or not, makes no difference as to how this is done.
If you want the textfield background to change only when it is not editable, then you can use the :readonly css pseudoclass on the field as bouye suggests.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TestCssStyles extends Application {
  public static void main(String[] args) throws Exception { launch(); }
  @Override public void start(final Stage stage) throws Exception {
    VBox root = new VBox();
    ToggleButton button = new ToggleButton("Toggle Editable");
    final TextField textField = new TextField("Frobozz");
    textField.getStyleClass().add("customtextfield");
    textField.editableProperty().bind(button.selectedProperty());
    root.getChildren().addAll(textField, button);
    Scene scene = new Scene(root);
    scene.getStylesheets().add(getClass().getResource("styletest.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
/** styletest.css place in same dir as TestCssStyles.java and ensure build system copies it to the app compile output path */
.root {
  -fx-padding: 10;
  -fx-spacing: 5;
  -fx-background-color: cornsilk; 
.customtextfield:readonly {
  -fx-background-color: coral;
}Edited by: jsmith on Aug 6, 2012 4:14 PM
Updated to demo use of a :readonly pseudoclass as per bouye's suggestion.

Similar Messages

  • 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!

  • Changing JList non-editable Font color of the selected items

    Hi All,
    I want to change the font color of non-editable JList's selected items which is not clearly visible to user. And I need to change the font color only the selected item in this scenerio.
    Could you please clarify me?
    <img src="file:///C:/DOCUME~1/sgnanasi/LOCALS~1/Temp/moz-screenshot-4.png" alt="" />

    [email protected] wrote:
    ..I want to change the font color of non-editable JList's selected items which is not clearly visible to user. And I need to change the font color only the selected item in this scenerio.Set a custom [cell renderer|http://java.sun.com/javase/6/docs/api/javax/swing/ListCellRenderer.html] *(<- link)* for the JList.

  • Code for changing a TextField BackGround color?

    Hello again!
    I can´t find anywhere the code for changing the background color of a TextField, anyone knows?
    I tried:
         TextField.border.fill.color.value = "255,255,255";      // doesn´t change bg color
         TextField.caption.font.fill.color.value = "255,255,255";     // doesn´t change bg color
         TextField.value.rectangle.fill.color.value = "153,153,153";      // doesn´t change bg color
    Bur none of them works!

    The script works fine..please show here..
    https://workspaces.acrobat.com/?d=EKbH6jmrJ-5RXnVNyxPiPA
    Kind regards,
    Mandy

  • Non-editable Color for TextInput

    Hi,
    Is it possible to set up, in a CSS, the backgroundColor of a
    readonly text input?
    So whenever it's set to readonly (editable=false) its
    background will automatically
    change to the color set up in the CSS.
    I want to do something like this:
    TextInput{
    theme-color:haloGreen;
    color:#005FA9;
    readonly-color:0xF5F5F5; // or "non-editable-color"
    Cheers,
    Jarrod...

    you must completely fill in the background in a non-opaque color.
    I doubt the 'non-opaque color' part might be a typoI think it is a typo, otherwise, like you, I don't know what they are trying to say.
    Just using setOpaque(true), does NOT make a component opaque. It simply tells the the RepaintManger not to search the ancestor tree to find an opaque component. This makes painting more efficient if it doesn't need to search all the way up to the content pane of the window. By setting the opaque property you are guaranteeing that the component will paint its own background in an opaque color.
    For example a JPanel is opaque and its paintComponent() method will invoke the fillRect(...) method to paint the background whatever color is specified by the setBackground() method.
    So if you do panel.setBackground(Color,RED) this is valid.
    However, if you do panel.setBackground( new Color(255, 0, 0, 128) ); this is invalid because you have set a background with an alpha value that results in a transparent color. In this case you will generally see artifacts in the background of the panel. If you want to do this, then you must also use setOpaque(false), so that the background of the ancestor component is painted first.
    Edited by: camickr on Jul 8, 2008 11:18 AM
    Fixed an incorrect reference from "non-opaque" to "opaque".

  • Changing background color in Edit mode?

    Is there any way to change the background color in Edit mode. My background is white, very annoying.
    Also full screen mode is Black. Also annoying, wish it was dark grey.
    Thanks,
    Ed

    no
    suggest to Apple - iPhoto menu ==> provide iPhoto feedback

  • 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

  • Textfields in advanced search from LOV non-editable

    I have a LOV where the textfields in advanced search are always non-editable. When I look into the LOV JSP page, maxlength of the textfields is 0.
    One of the textfields uses following attribute:
    in EntityObject: attribute "Kuerzel", type "String" (database datatype VARCHAR2(10))
    in ViewObject: attribute "DspKuerzel"
    in the JHeadstart ADF BC Property Editor from EntityObject and ViewObject the Setting "maximum length" of the attribute is not set (no entry). Jheadstart help says that when maximum length is set to 0 then the corresponding textfield is non-editable. But here it is not set. Is there a solution to this problem?

    If you send a testcase to [email protected] and rename extension .zip to .zipped we can investigate why the maximum length is not generated correctly in your situation.
    Steven Davelaar,
    JHeadstart Team.

  • Background color of textfield

    Could some kind soul explain to me how I can set the background of a textfield to some color other than white in Interface Builder?
    Here is a screenshot of my panel.
    http://zach.in.tu-clausthal.de/tmp/textfield.png
    The textfield is labeled "Image exclusion options" (in the screenshot it is selected).
    No matter what I try in Interface Builder, I can't get the background to become some other color than white.
    Does anyone have an idea? Do I really need to write several lines of code for that?
    Thanks a lot in advance.
    Best regards,
    Gabriel.

    Have you tried to select Draw background?
    Yes, but IB always deselects it again.
    You could also use NSTextFields setBackgroundColor Methode
    ah, yes, but I was hoping to find a more elegant solution, because, you see, I don't need to access that field from my program at all (other than changing the background color ...)
    Best regards,
    Gabriel.

  • 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

  • Edit Band.css file to change datasheet view background color causes adverse effects

    Hi. I'm using SharePoint 2007 still and we are using the blueglassband.master theme.  With this theme the background color of the site is a dark blue but this causes datasheet view grids to be extremely dark.
    I have found fixes to edit the .body tag and set it to FFFFFF and then add a form#aspnetForm element and set the dark blue background there, and this has worked successfully...
    Or so I thought.  It turns out this has caused a weird issue in other pages in SharePoint where-by half the page is dark blue as expected, but then it changes to white.
    Even more bizarre, it seems the "half way" mark where the color changes is dependent on the initial size of the IE window when the page gets first rendered.  That is, the blue to white change occurs at the point in the page that touches the
    bottom of the IE window.  Bigger IE window = change happens later.
    Any ideas on this one?

    Hi,
    For this issue, I'm trying to involve someone familiar with this topic to further look at it.
    Thanks,
    Qiao
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Qiao Wei
    TechNet Community Support

  • Unable to Edit CSS style panel to change Wiget background colors

    Hello my name is Gabriel and Im designing a website using the Sprymenu Bar: Menu Bar 1 that I found on the adobie free template 1.
    I was able to edit the spry menu bar to drop down sub menu's but I was curious hoy to bring up the CSS Style panel so I can change the colors of this Spry Menu bar. How do I bring up the CSS style panel? Could you point me to a color menu so I could change the Colors?

    Hi,
    they work with an background-image, look for example here (it's from widgets of this
    http://labs.adobe.com/technologies/spry/samples/menubar/MenuBarSample.html):
    #MenuBar6 a.MenuBarItemSubmenu {
    background-image: url(images/star.gif);
    background-position: 5% 50%;
    #MenuBar6 a.MenuBarItemSubmenuHover {
    background-image: url(images/star-hover.gif);
    background-position: 5% 50%;
    background-color: #FF0;
    color: #F00;
    Hans-G.

  • I want to make a textfield non editable with blinking cursor,and the text is input from a custom keypad

    I want to make a textfield non editable with blinking cursor,and the text is input from a custom keypad....
    Please Help me.
    I want to make a numpad of my own from which i can set the text but i want the user to tap in between the text..

    You seem to stop the while loop to run the following code, then the program ends. Are you running this using the "continuous run" button????
    You need one big while loop containing the acquisition, then you build up the history data in a shift register. Clicking "save" will save the data, but not stop the loop.
    Why did you place a time-control in the FOR loop??? This is just post-processing so it should just do it without any delays. I don't understand the logic in the FOR loop. You are appending arrays, but then you delete the first element at each iteraction constantly trimming data from the beginning of the appended array. Then you autoindex at the output tunnel heavily duplicating all data. Ths make s no sense!
    Can you explain how you want you data saved?
    Message Edited by altenbach on 12-16-2005 11:20 AM
    LabVIEW Champion . Do more with less code and in less time .

  • The toolbar displays File, Edit, View, etc. print too small & barely able to read. How to enlarge print. Also background color of toolbars hard to read. It is black. make larger?

    The Menu Bar, Roboform Bar in general all toolbars the print is too small and barely able to read. Please tell me how to enlarge the print. Also, the background color is black and hard to read. Thanks for any help you can give me.

    Use this extension to adjust the font size for the user interface:
    *Theme Font & Size Changer: https://addons.mozilla.org/firefox/addon/theme-font-size-changer/
    Increase the String pref layout.css.devPixelsPerPx from 1.0 to 2.0 in 0.1 or 0.05 steps to adjust the size of all fonts and other elements in Firefox.<br />
    In current Firefox versions this pref is a String value parsed to a float and allows to fine tune the dimensions of all elements (user interface and web pages) more precisely.
    *http://kb.mozillazine.org/about:config
    You can use an extension to set a default font size and page zoom on web pages if the above steps made the text too large.
    *Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/

  • Change background color of a selected line of text in textfield

    I have a list of items in a dynamic text field. When a line is clicked I would like to highlight it, or change the background color. Any ideas?

    By default, the generated application uses the oracle skin family. This skin generates the buttons as images with rounded edges so you cannot change the background color. If you change the skin-family to "minimal" in the adf-faces-config.xml, then you can change the background color of the buttons by adding a property like this to the button template:
    inlineStyle="background-color:red;"
    However, a cleaner way to do this, is by creating a custom skin, so you do not have to modify the generator templates at all. See the following link for more info on ADF Faces skinning:
    http://www.oracle.com/technology/products/jdev/101/howtos/adfskins/index.html
    In addition, using the Check for Updates feature in JDeveloper, you can install additional sample skins.
    Steven Davelaar,
    JHeadstart Team.

Maybe you are looking for

  • Sequence clip with  red line above

    I imported several clips from a Nikon D300s camera into PP, and put on a sequence timeline.  4 show the yellow line above, indicating matching settings, but 2 show red lines, and I don't know what is different.  All were done at the same time, and sh

  • Variable argument not working

    someone tell why this not working class Init      public void assign(String... args)           for(Object str:args)                System.out.println(str); public class VarArg1      public static void main(String args[])           Init abc=new Init()

  • HELP.........I have produced a training module and the reporting at the wont do what I need.

    HELP.........  I have produced a training module and the reporting at the wont do what I need.  I need it to tell me what percentage of the test I have scored which it does but then I need it to tell me which questions I got wrong without giving me t

  • Transport type when copying transports to other system

    Hello, probably a simple question. I have to transport couple transports from one system to another, there is no link between the systems. I have created one (mass) transport which include objects of these transports, but I am not sure what type of t

  • Why is the screen of the 5S so fragile?

    Why is the screen of the 5S so fragile?