How to set the text color in a Canvas?

When I use (Graphics) g.setColor(255,255,255), then g.drawString("xxx", 0, 0, ....);
the simulator works well but it can't work in my mobile phone (Nokia 7650).
What's wrong?
Thanks.

do it like this
g.setColor(255,255,255);//this will set the color for the canvas
g.fillRect(0,0,ht,wd);//this will fill the rect(screen) with the above color,actually this will be BG color for ur app..ht,wd are the height and width of ur canvas...
now specify color for the text
g.setColor(r,g,b);//this color shud ofcourse be diff frm the color set for BG
now draw the string
g.drawString("xxx", 0, 0, ....);

Similar Messages

  • How to identify the text color in a word doc.?

    how to identify the text color in a word doc.?
    I need to read a word document using java code. which contains many strings with different colors.
    i need to identify the color and giving the marks accordingly like
    test in blue color so
    test marks=2
    how can i do this using java. i only want to know how can i identify the text color using java code.?

    morgalr wrote:
    I guarantee it is not pretty.Indeed.
    I created a Word doc that simply has the word "Blue" in blue, then a space, then the word "Red" in red, all in the default font that Word started with (Times New Roman). The resulting document is 24,064 bytes. It starts off with 80 bytes of various hex values, mostly 0x00.Then 432 bytes of just 0xFF. Then 2048 bytes of various hex values, mostly 0x00. Then the text "Blue Red" (which appears twice more in the file). And so on...
    Edited by: jverd on May 10, 2010 8:45 AM

  • How do change the text color in the variable screen ?

    Hi Experts ,
    I would like to know about , How do change the text color in the variable screen ?
    Using web templates (Analytical) can get the output. It has the variable screen contains 6 fields (Company code, Country , Region , COB, Plant and Purchasing Group). I want to make RED color text on Plant. Please help me .
    Thank you ,
    Prasad.

    Hi,
    I am looking for nearly the same. What I have found is that it seems to manipulate the SAP theme that is used in standard when template is executed in the portal. Just display the source code of the HTML and there you will see the included SAP theme (normally SAP_TRADESHOW). Then you have to go to the SAP portal and change this stuff. But for that you have to know where to find it and what impact this change has.
    I am not pretty sure if this is the right way. But as I want to change the standard layout of a whole template to a customer specific layout I think there is no other way in BI7.0.
    Regards,
    Peter

  • How 2 set the background color in j2me

    Can any body tell me how to set the background color to midlet.??

    if you are using Screen then you can call its setBackColor()
    or if you are using Canvas then you can call
    g.setColor(r,g,b);
    g.fillRect(0,0,getWidth,getHieght);
    where g is the Graphics instance of Canvas,for further information consult documentation

  • How to set the Background Color of a Text Field in a Tabular Report.

    Hello,
    I tried to set the Background Color of a Text Field in a Tabular Report.
    But I was not able to change this colur.
    In the report attributes --> column attributes
    I tried already:
    1. Column Formating -- >CSS Style (bgcolor: red)
    2. Tabular Form Element --> Element Attributes (bgcolor: red)
    but nothing worked.
    Can anybody help me?
    I Use Oracle Apex 2.2.1 on 10gR2
    thank you in advance.
    Oliver

    in "Report Attributes" select the column to move to the "Column Attributes" page. In the "Element Attributes" field under the "Tabular Form Element" region enter
    style="background-color:red;"
    I will also check if there is a way to do this via the template and post here again
    edit:
    in your template definition, above the template, enter the following:
    < STYLE TYPE="text/css" >
    .class INPUT {background-color:red;}
    < /STYLE >
    (remove the spaces after the < and before the >)
    change "class" to the class that the template is calling
    (I'm using theme 9, the table has: class="t9GCCReportsStyle1" so I would enter t9GCCReportsStyle1)
    A side-effect of using this second version is that ALL input types will have a red background color--checkboxes, input boxes, etc.
    Message was edited by:
    TheJosh

  • How to change the text color to red in a combo box?

    I'm writing a java program which have a combo box which shows all the name of the member from the database. However, I would like to change the text color of those member who have now currently on-line.
    Please help, it's URGENT. Thanks in advance.
    Clark

    hi,
    as i mentioned, you would require to use a custom renderer for this, for this
    //Class subclass the JFrame and has a JList in it
    import javax.swing.*;
    import java.awt.*;
    import java.util.Vector;
    public class ListRendererTest extends JFrame
         private JList lstMenu;
         private DefaultListModel defaultListModel;
         private JScrollPane scrollPane;
         private Vector listVector;
         public ListRendererTest()
              init();
              addComponents();
              showFrame();
         public void init()
              lstMenu = new JList();
              defaultListModel= new DefaultListModel();
              lstMenu.setModel(defaultListModel);
              scrollPane      = new JScrollPane(lstMenu);
              listVector = new Vector();
              MyListData m1 = new MyListData();
              m1.setName("Rakesh");
              m1.setOnline(false);
              listVector.addElement(m1);
              m1 = new MyListData();   //represents each User instance
              m1.setName("Makesh");
              m1.setOnline(true);
              listVector.addElement(m1);
              for (int i=0;i < listVector.size(); i++)
                   defaultListModel.addElement(((MyListData)listVector.elementAt(i)));
              lstMenu.setCellRenderer(new MyListRenderer());  //set custom renderer
         public void addComponents()
              getContentPane().add(scrollPane,BorderLayout.CENTER);
         public void showFrame()
              setTitle("List renderer test");
              setSize(300,300);
              setLocation(200,200);
              setVisible(true);
         public static void main(String args[])
              new ListRendererTest();
    }The above class is the Container which houses the JList in it, it uses two other classes, MyListData which is used to represent each user instance ( username, and information about whether he is online) and MyListRenderer (custom renderer).
    // Represents each user instance //
    public class MyListData
         private String name;
         private boolean online;
         public void setName(String name)
              this.name = name;
         public String getName()
              return name;
         public void setOnline(boolean online)
              this.online = online;
         public boolean isOnline()
              return online;
    //custom list renderer
    import javax.swing.*;
    import java.awt.*;
    public class MyListRenderer extends DefaultListCellRenderer
         private MyListData myListData;
         public Component getListCellRendererComponent(JList list, Object value, int index,  boolean isSelected, boolean cellHasFocus)
               myListData = (MyListData)value;
               setText(myListData.getName());
               setBackground(myListData.isOnline() ? Color.red: Color.white);  //check if online, if so show in different color
               setForeground(isSelected ? Color.blue : Color.black);
               return this;
    }hope that helps.
    cheerz
    ynkrish

  • How to set the 'text' property of a 'Header' region dynamically?

    Hi,
    I have a requirement to display the 'text' property of a 'Header' region, based on a query.
    So I need to set the text property programatically in CO.
    Can I use setText("..") by getting the handler to the 'Header' region?
    If so, How to get the handler for the 'Header' region?
    Message was edited by:
    user594528

    How to get the handler for the 'Header' region to call the setText()?
    OAHeaderBean Header1 = (OAHeaderBean)...........................
    Header1.setText("....");

  • Can I set the text color in a Label?

    Hi everyone ~
    Can I set the font color in PP? I only found that there is a "setBackground".. but I want to set the color within a Label.
    Thanks!
    Gary

    Fixed it!
    There was a global style for s|Label and since the Spark button uses one of these for the text, that was it.

  • Setting the text color

    Hi
    Does anybody know the syntax for changing the text color for workspace customization ?
    like for backgorund color ,we have color = "background-color:IndianRed"
    Ritu

    Hi Ritu,
    If you're trying to change the color inside of the bpmworkspace.css (the default CSS for the Workspace) to Indian Red you could do this:
    .bpmWorkspaceHeaderUser {
         background-color:#cd5c5c;
         width:100%;
         text-align:right;
    . . .If you're trying to change the background or foreground color of a label or field on a BPM Object presentation, you could do this:
    // set the first label on a presentation to Red
    setForegroundColor this
       using componentId = "label0", 
          color = Fuego.Ui.Color.INDIAN_RED.rgb()
    // set the first text field's background color to Red
    setBackgroundColor this
       using componentId = "text0", 
          color = Fuego.Ui.Color.INDIAN_RED.rgb()This logic would be run from inside a BPM Object's method to dynamically change colors on a Presenation. This would set the first label's ("label0") foreground and the first text field's ("text0") background color to Indian Red. You'd normally have the method invoked either as an initialization method for the presentation (click the outer edge of a presentation -> click the "Properties" tab -> change the method invoked when the presentation initializes by changing the "Initialization method" property) or as the method invoked by a field's "On change invoke" property.
    Note that "label0" and "text0" are the names of the label and text fields on a specific BPM Object's presentation and not the name of an attribute inside the BPM Object. To uncover their specific names, open the BPM Object presentation -> click the label or field -> open the "Properties" tab on the right -> look at the value inside the "Name" field.
    You can see the other colors available if from the Project Navigator tab if you expand the "Catalog" -> expand "Fuego" -> expand "Ui". The upper case attributes listed are enumerations. The string's needed for the "setForegroundColor" and "setBackgroundColor" methods are returned using the catalog's Fuego.Ui "rgb()" method.
    Hope this helps,
    Dan

  • How to set the text of a cell in Numbers to vertical direction? Tks.

    Hi
    In Numbers, please tell me how to switch the text of a cell to vertical direction?
    Tks.

    Hi Kyle,
    In Numbers, nothing having to do with a table can be rotated. (In Pages an entire Table can be rotated, but not text within a Table.)
    There have been many suggestions posted here over the life of iWork for vertical labels. Most fall into three categories:
    1. Type one letter, Option-Return, type another letter, Option-Return, and so forth.
    2. Type label in a Text Box, rotate the box, position the box over the table, covering the cell where you need a label.
    3. Create a PDF graphic with rotated text and insert it into table cell as Background Fill.
    The third option is clearly the best. The steps for option three are:
    Insert Text Box
    Type label into the box
    Rotate the text box
    Select the text box (not the text inside the box)
    Command-C
    Switch to Preview.app
    Command-N
    Command-C
    Switch to Numbers
    Click on Cell where the label goes
    Command-V
    It sounds worse than it is. You can reuse the Text Box so you don't end up with a sheet full of them.
    Regards,
    Jerry

  • How to set the text as an image

    Is there a way to set the text to automatically change to an image? (In preference panel, you select "Sow text imaging indicator", then there comes a yellow sign over the text, meaning that the text will be a graphic in the browser) Some text does change to a graphic but some does not. It´s very annoying cause the text sometimes changes in the browser, some don´t. So is there not a way to select which text changes to a graphic?

    Okay I made a new text box and changed the font until the little graphic appeared. Now I know, but, I also know that a lot of the font I tried would not be on someone else's computer (specially windows) but it would not have converted I guess it would have been substituted. That is really not good because the look would be very different. Should we force a conversion then to insure that it looks like what we want? Then we no longer have any text we have mostly graphics and is that not bad to be found by the search engines?
    This is so complicated!
    Mireille

  • How to Set the Text of an Onstage TextField?

    I'm trying to set an onstage TextField instance's "text" property, while maintaining embedded fonts and its onstage appearance.
    Problem Encountered: Text doesn't show up when setting text via ActionScript on an on-stage TextField w/ embedded text.
    Workaround: Create and assign a TextFormat object:
    defaultTextFormat = new TextFormat('Arial', 100, 0x000000, true, true);
    Annoyance: This defeats the purpose of styling text with the IDE.
    Possible Solution: Import the embedded font to the library and export for ActionScript?

    My problem was actually that merely setting the *text* property caused my dynamic TextField w/ embedded font to not display any text. BUT, I just re-tested this with a new file, and the problem doesn't occur. Only thing I can think of is -- my FLA was created with an older version of Flash... possibly MX 200(4?). Could this be the issue?

  • How to change the text color of a label by using RGB values without changing the background colour?

    xCode interface builder:
    When I try to change the color property of a label's text by using the RGB values, the background color also changes to the same value automatically.
    in other words:
    While setting the RGB values for text colour of labels, the background colour also changes unless we use the sliders.
    How to make sure that only the color of text changes and not the background?

    You can simply do this.
        [labelname setTextColor:[UIColor colorWithRed:38/255.0f green:171/255.0f blue:226/255.0f alpha:1.0f]];

  • How to set selected text color in Spark TextInput

    I'm trying to make Spark TextInputs and MXFTETextInputs look like Halo/MX TextInputs as much as possible, since I have a mix of both Spark and MX TextInputs in my application. I know I can set the
    selection background color to black using focusedTextSelectionColor. How can I set the selected text color to white so it matches the MX white-on-black look?

    This works, if you set the enabled property directly on the s:TextInput:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">
        <s:layout>
            <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
        </s:layout>
        <s:controlBarContent>
            <s:CheckBox id="ch" label="enabled" selected="true" />
        </s:controlBarContent>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            s|TextInput:disabled {
                color: red;
        </fx:Style>
        <s:Group>
            <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{ch.selected}" />
        </s:Group>
    </s:Application>
    It can get a bit trickier when you're setting the enabled property on a parent container, since (I believe) that the child control's enabled properties are still set to true and just the container is disabled. One possible workaround would be to bind the child TextInput control's enabled property to the container's enabled property. That way the s:TextInput should still go to it's disabled state and you can customize the disabled state's styles to have darker text, or whatever else you want.
    <s:Group id="gr" enabled="{ch.selected}">
        <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{gr.enabled}" />
    </s:Group>
    Peter

  • How to set the text in a jtextfield to align to the left

    A quick simple question. I'm populating a jtextfield with text pulled from a record. However the text is too long to fit in the jtextfield and the alignment is set to the right rather than the left. How do I set the alignment of the text in the jtextfield to be on the left, so that the first character of the string is shown?
    I've tried using
    setHorizontalAlignmnet(JTextField.LEFT),
    but my text still appears right justified in the jtextfield. It means that the user has to scroll the text to go to the beginning of the string, rather than the usual of scrolling the right to go the end of the string.
    This has really gotten me stumped!

    HI thanks for the help. Unfortunately it doesn't work if the text is longer than the actual textfield. The textfield would still show the end of the text, rather than showing the beginning of the text.
    For e.g.
    |est text|
    is show rather than
    |test tex|
    which is my desired result.
    Any further suggestions please.

Maybe you are looking for

  • Restriction of Payment to Vendor above Purchase Order Amount

    Hi Experts, I have a requirement where my user wants an error message to appear when a Payment to Vendor is made in excess of the PO Amount. An Information message appears when posting an advance payment through F-48 for the same but can I get a simi

  • IMac is losing network connection

    Hi all, since the latest Update to ML 10.8.4, my iMac loses the connection to my NAS server (Synology Diskstation DS212+) from time to time, which results in a freezing of the Finder. Due to that, the whole system "hangs" until the "Network connectio

  • Storage in ODS

    Hi I would like to know how the data is being stored in ODS. Will it store all the versions of delta or will it be having single latest record always. Please let me know. Regards Leon

  • AVCHD Editing

    I am currently using a PC and can't stand editing in High Def on it so I am considering switching to a Mac and using Final Cut Pro, but I am not sure if the laptop I am considering will be powerfully enough to handle AVCHD editing: 15" Macbook Pro In

  • Field Width; BCC not found

    Two Mail questions: 1- Is there a way to set the column widths separately in different mailboxes? IOW when I make, say, the Subject field wider in one mailbox or folder it affects all of them. This is quite annoying (Outlook never did that). 2- Where