Setting the background color of a TextArea

I was not able to set the background color of a text box. Here's what I try and it works for the other components.

****************************************************************

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.control.TextArea;

public class TextAreaTest extends Application{
  public void start(Stage stage){
    TextArea area = new TextArea();
    area.setStyle("-fx-background-color: black; -fx-text-fill: lightgreen;");
    Scene s = new Scene(area);
    stage.setTitle("black text area");
    stage.setScene(s);
    stage.show();
  }
  public static void main(String[] args){
    launch(args);
  }

}

***************************************************************

I use jdk 8 with whatever version javafx is included. I searched a bit on the internet and I think I see mixed results using this technique.

Thank you.

In an external css file, do

.text-area .content {
   -fx-background-color: black ;
}

Tags: Java

Similar Questions

  • How can I set the background color for a photo book to be between photos as well as on the perimeter?

    I am trying to create a book in iPhoto. I can set the background color, but it doesn't seem to work between photos that appears white by default. How can I make the background color of work between photos?

    You can not

    but to see exactly what you always get an overview of your book before ordering

    LN

  • is it possible to set the background color of a table or chart to be transparent?

    is it possible to set the background color of a table or chart to be transparent?

    Thank you

    Yes.

    Select tools palette (view > tool palette) and set the background of the graph as well as the control in transperent.

  • How to set the background color of an application in bbui.js?

    How can I set the background color of an application that uses the bbui.js?

    his does not work just to put a:

    body {
        background-color: #000000;
    }
    

    It is even easier than... just create the style or the class on your screen

  • How can set the background color of the status bar?

    Quote from the old forum:

    Comments: comments
    How can set the background color of the status bar?
    Posted the: July 17, 2008 02:56
     
    How can set the background color of the status bar?
    Using this code for the status bar:
    LabelField statusField = new LabelField ("Good Morning", LabelField.USE_ALL_WIDTH |) LabelField.NON_FOCUSABLE | LabelField.HCENTER)
    {
    int _backgroundColour = Color.LIGHTGREEN;
    public void paint (Graphics g)
    {
    g.setBackgroundColor (Color.RED);
    g.Clear ();
    Super.Paint (g);
    }
    };

    Font defaultfont = Font.getDefault ();
    Police smallfont = defaultfont.derive (Font.PLAIN, 12);

    statusField.setFont (smallfont);
    setStatus (statusField);

    When I ran the code you have above, my status background color was red.  Is not what you see?  If so, please provide the BlackBerry model and software version that you are testing.  You can find this under Options.

    Or if you try to do something else, please provide details.

    I tested this in the BlackBerry Simulator included with version 4.5.0 BlackBerry JDE (4.5.0.44).

    To do this in version 4.1, first call getColor and save the current color.  Then call setColor, setting the color to the color you want to use for the background.  After this call call fillRect, starting with 0, 0 and go to the size of the field (use this.getWidth () and this.getHeight () to get this).  This must fill in the field with your specified color.

    To allow the drawing of the default content of the field call setColor once again, passing in the original color, then call super.paint.

  • How to set the background color of the title?

    Generally, the title background color is black and the other area of the main screen is white. I want to set the background color of the linear gradient background as blue or something. I try the following 2 ways, but there is always a black line at the bottom of the title bar.

          Background background = BackgroundFactory
                    .createLinearGradientBackground(0x00ff0000, 0x00ff0000,
                            0x0000ff00, 0x0000ff00);
            LabelField title = new LabelField("Hello World Demo",
                    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
            title.setBackground(background);
            setTitle(title);
    
           LabelField title = new LabelField("Hello World Demo",
                    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    
            HorizontalFieldManager hrzManager = new HorizontalFieldManager() {
                protected void paintBackground(Graphics graphics) {
    
                    graphics.setBackgroundColor(0x00382B79);
                    graphics.clear();
                    super.paint(graphics);
                }
            };
            hrzManager.add(title);
            setTitle(hrzManager);
    

    Hello

    I think that there may be a problem using the default setTilte() method.

    Have something by default, behavior with the device.

    It may be a way to customize the default title to remove the black line at the bottom of the title bar.

    But I suggest an alternative that will behave like the title bar without using the setTitle() method.

    You can use something like below to get your condition.

    import net.rim.device.api.ui.*;import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.container.*;import net.rim.device.api.system.*;
    
    class TestScreen extends MainScreen{
    
        private VerticalFieldManager verticalManager;    private HorizontalFieldManager hrzManager;
    
        TestScreen()     {            super(NO_VERTICAL_SCROLL);
    
            LabelField title = new LabelField("Hello World Demo",                        LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
    
            hrzManager = new HorizontalFieldManager()         {            protected void paintBackground(Graphics graphics)             {                graphics.setBackgroundColor(0x00382B79);                graphics.clear();                super.paint(graphics);            }        };        hrzManager.add(title);        this.add(hrzManager);
    
            //rather than  adding component in the mainScreen        //add components in this verticalManager and then        // add this manager to mainScreen          verticalManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)        {            /*              public void paint(Graphics graphics)            {                graphics.setBackgroundColor(0x00ffffff);                graphics.clear();                super.paint(graphics);            }            */                        protected void sublayout( int maxWidth, int maxHeight )            {                int width = Display.getWidth();                int height = Display.getHeight() - hrzManager.getHeight();
    
                    super.sublayout( width, height);                setExtent( width, height);            }        };
    
            ButtonField button1 = new ButtonField("Button1");        ButtonField button2 = new ButtonField("Button2");        ButtonField button3 = new ButtonField("Button3");        ButtonField button4 = new ButtonField("Button4");        ButtonField button5 = new ButtonField("Button5");
    
            verticalManager.add(button1);        verticalManager.add(button2);        verticalManager.add(button3);        verticalManager.add(button4);        verticalManager.add(button5);        this.add(verticalManager);
    
        }}
    

    Concerning

    Bika

  • Set the background color of the screen?

    someone knows how to set the background color for a screen?

    Also see this article.

    How - to change the background color of a form

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

    Concerning

    Bika

  • How to set the background color of a page_item?

    I was pasting "background-color: #5CD65C" in a number of places, like the 'attributes of the HTML table cells' under the label and the tabs of the item, but get no results. Can someone tell me how to set the background color of a cell, please?

    Hi Doug,.
    One method is to add a style to your header html in page attributes, if you add the below css styling and the change of the name of the item page (#P2_FIRST_NAME) to your he should style correctly:

    Thank you

    Paul

  • Setting the background color to a region

    Hi all

    I need to set the background color for the regions on page apex.

    Am trying to do this using the following html tag in the header part of the region, but not able to succeed.

    Can someone help me in this?

    Use APEX 3.2

    Thank you and best regards,
    Santini.

    Published by: Santini on February 23, 2011 04:07

    Change the region-> region attributes, put more css

    // should put backgound-color:red with-in quotes
    style=background-color:red;
    

    Note: You should have #REGION_ATTRIBUTES # reference in the model of your region.

    See http://www.w3schools.com/css/pr_background-color.asp for tips of css.

    Kind regards
    Hari

  • Set the background color of af: SelectOneChoice

    Hi all

    I use Jdeveloper 11 and I have an af:SelectOneChoice in a table.
    According to the value selected on the af: SelectOneChoice I want to set the background color.

    I now have this style as the content property:
    contentStyle = "#{row.priority == 9?' background-color: Red;': ' background-color: White ;'}}"

    When the priority is 9, then the color is red, otherwise it is white.
    It's works well but I want to extend this by assigning the Orange color when the priority is 8 or 7.

    How can I do?

    Well I did it using nested condition and it works.
    Sorry that I have copy paste directly from my code but I'm busy:

    value="#{ (row.bindings.ToKont.inputValue == 'N') ? globalParams.storedText[206]:((row.bindings.ToKont.inputValue == 'Z') ? globalParams.storedText[304] : globalParams.storedText[207]) }"
    

    Good luck :)

  • How to set the background color for the Webworks Menu?

    Hi all

    I have developed a web application that uses the emulator to ripple and Blackberry Webworks SDK 2.3.1.5.In I added the Menu items on the Blackberry Menu button... It works well... It contains the background color by default for Menu (Black)... Here, I want to change the background color of the Menu... Please help me to change the background color... Thank you very much..

    With respect,

    Marimuthu_P

    I don't think that this is possible.  The WebWorks API allows you to add menu items to your application does not provide the ability to change the background color by default of the menu.

    This API is actually an extension of Java built into the SDK WebWorks.  The source code because it's open source, available here: https://github.com/blackberry/WebWorks/tree/master/api/menu/src/main/java/blackberry/ui/menu

    It is based on the Java class "MenuItem", which as you can see it does not provide methods or properties to set the color:

    http://www.BlackBerry.com/developers/docs/7.1.0api/NET/rim/device/API/UI/MenuItem.html

  • Setting the background color of the screen

    Hai...

    When my application running in the Simulator, it shows only a small portion with the bgcolor that I gave in the html file. I think that the bgcolor simply encapsulates html content. So, what should I do to view the entire screen with the bgcolor.

    The problem is that in WebWorks (which uses a control called BrowserField) to view the content, the size of the display of web pages grows to the size of the content in your HTML code.

    So if height of your HTML below the screen, it will show the background color of the screen.

    To change this, you can set the window of the display using tags or set the height of the body to the size of the screen.

  • Setting the background color of the default work in Photoshop CC 2015 plan

    So here's the thing, I am aware that right-clicking on a background of work plan will allow you to change its color, but I'm looking for a way to set the default color. I prefer the background color of artboard to a gray color dark, but the default is light gray, so I have to change every time I open a new document. All solutions?

    Well Yes. Currently, it is an enhancement request. A good one, I might add.

    In the meantime, you can probably create a template with the desired background and use for newly created documents.

  • How to set the background color in a scene?

    I'm new to JavaFX and just started my first program of FX.  I created a FX 7.3 NetBeans project and the project runs correctly.   All the samples in the JavaFX samples download work as well.  But when I try to do something as simple as the definition of the background on my first stage color to black, I can't make it work.  I find examples and documentation telling me that what I do should work, but it's not.

    Scene = new scene (root, 300, 250, Color.BLACK);

    scene.setFill (Color.BLACK);

    primaryStage.initStyle (StageStyle.UNDECORATED);

    primaryStage.setTitle ("Hello World!");

    primaryStage.setScene (scene);

    The two lines "BOLD" are marked as errors.  Unfortunately, I can't find a way to copy the error popup text in the IDE, so I'll summarize.  The two lines are errors that say that I gave a color but paint was expected.

    Is there something that I am missing? Can it be this hard set a background color in JavaFX?

    Thank you.

    Hello. Choose your imports. You probably

    import java.awt.Color;
    

    Instead of

    import javafx.scene.paint.Color;
    
  • Setting the background color of the element

    How I change the background color of a text element?
    Is there an item property that I can put with an HTML tag?
    If the answer is "Yes", if you please tell me exactly how to set it.
    I can do the same for the bottom of the page?

    Also, is there a web page that allows you to see all the available colors and tells you what the exact code for this color, so you can specify it in an HTML tag?

    And what is the procedure to change all text in the same color of the background of a sudden?

    The following CSS rule to the selected location:

    input[type="text"] {
      background-color: #cf6;
    }
    

    but note that there are [no support for this in IE6 and below | http://reference.sitepoint.com/css/attributeselector].

Maybe you are looking for

  • Updated Mavericks 10.9.5 showing in App Store when the El Capitan

    Hello! I recently installed at El Capitan (10.11.2) and appeared the Mavericks and iPhoto updates in the App Store. I managed to solve the problem in iPhoto by removing the application from the computer, but the Mavericks update is always present and

  • Questions about buying a new computer.

    My computer tells me that Microsoft will stop supporting Windows XP in April 2014. They suggest that the search for a new computer that my computer will not support Windows 8. All computers that I have watched have Windows 8 is already installed. Now

  • MD3220i - virtual drives Windows 2008 offline

    After installation of the MD3220i and the initiator configuration iSCSI, I see the LUNS from storage but they are offline and I can do something with them. Any help?

  • Pictures in text messages blackBerry Smartphones

    Can anyone help please? I bought my wife a Blackberry Curve 9300. Very good so far, but it cannot download the pictures that have been sent on a text message, it does not use websites to social network, or the internet for the time reserved for the m

  • Do HP international warranty covers the poor. Enclosed battery and Chargers?

    Hello, I bought the hp probook 4540 s international security, now 1 month has passed my battery is finished... means he can't keep not one load and displays "0%, plugged in, do not load"... my question is that HP International guarantee cover battery