Colors in Text Areas

Hi all.
I've been working an a project that involves emailing and stuff.
I've got all the Action Listeners sorted out and i just need to know if
font colors and faces/styles, can be changed in a textarea.
Thanks in advance.
Xx_BlackMamba_xX

> f anybody knows which class JTextArea inherits from
it would be a big help.java.lang.Object
|
+--> java.awt.Component
       |
       +--> java.awt.Container
             |
             +--> javax.swing.JComponent
                   |
                   +--> javax.swing.text.JTextComponent
                         |
                         +--> javax.swing.JTextAreaSee: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTextArea.html
> Meanwhile I''l figure out how to override the
colouring in my fonts.
THANKS TONS
byebye
I meant something like this:
public static void main(String[] args) {
  JFrame frame = new JFrame("test");
  frame.setSize(200, 50);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JTextArea txtField = new JTextArea();
  txtField.setForeground(java.awt.Color.RED);
  frame.add(txtField);
  frame.setVisible(true);
}Message was edited by:
prometheuzz

Similar Messages

  • Color coded text area

    How can I make a text area that when you type, if it is a reserved word it change it's color, like JCreator or some editor

    Swing related questions should be posted in the Swing forum.
    How can I make a text area that when you type, if it is a reserved word it change it's colorYou can't. You need to use a JTextPane (or JEditorPane)
    Search the Swing forum using "syntax highlighting" as the keywords to find other postings on this topic. You may even find my "SyntaxDocument" solution which will work for Java but not other programming languages.

  • Different color text in text area???????

    hi,
    i am working on applet in which i want to show different color text in text area????????
    could any one help me

    I'm not sure it replies, we have developed an
    editorkit for the JEditorPane for colorizing a
    text with a property file describing a grammar. We
    provide in the packaging a trivial sample
    for coloring a java syntax in an applet.
    http://www.japisoft.com/syntaxcolor
    And of course it also requires that you buy it, and a.brillant forgot to mention that a.brillant has a financial interest in this product.

  • Different  font colors in the same text area.

    i need to have a text area where i can setText with different colors.
    eg red if an error message, rest to be black.
    the only way to set text color i know is using setforegound color which will do the only documents, but i need to set font color per string.
    how?

    JTextPane
    StyledDocument
    MutableAttributeSet
    db

  • How to change linux text area background color?

    Hi,
    I like to know the method. just like in windows platform.

    Just like change the text area color in notepad.exe
    so i mean X11 and gnome.
    do you mean inside a terminal when you're running X
    No, i can change the color in gnome terminal.
    But i can not change the color in openldev(or any other gtk apps)
    I hate the default color(white),
    want text background color as grey, without configure each apps color.

  • How to change the color of text in Teat Area

    Pls tell me how can i print two different lines in two different colors inside the same text area.
    Because whenever i set the color it sets the color for the complete text area.
    I want to print "Hello..." with color red and "Hi..." with color green in the same text area.
    Pls help me out...

    hi,
    u should use swing component JTextPane instead of textarea to change the color of the text.
    for eg:
    JTextPane textPane;
    JScrollPane panescrollpane;
    textPane=new JTextPane();
    panescrollpane=new JScrollPane(textPane);
    panescrollpane.setVisible(true);
    String[] initString =
    request+newline
    String[] initStyles =
    { "regular"
    Style def = StyleContext.getDefaultStyleContext().
    getStyle(StyleContext.DEFAULT_STYLE);
    Style regular = myClient.textPane.addStyle("regular", def);
    StyleConstants.setFontFamily(def, "SansSerif");
    StyleConstants.setForeground(regular,Color.orange);
    Document doc = textPane.getDocument();
    try {
    for (int i=0; i < initString.length; i++) {
    doc.insertString(doc.getLength(), initString,
    textPane.getStyle(initStyles[i]));
    } catch (BadLocationException ble) {
    // System.err.println("Couldn't insert initial text.");
    Hope this helps..
    regards,
    Kalpana.

  • How to change the color of the text in the Text Field or in the text area??

    HI all,
    i think its a very simple problem, still, can anyone tell me how i can change the color of the text and also its font, before i display it in either a textfield or a text area.
    bharath

    Just Use:
    JTextField.setForeground(Color.RED);
    so SIMPLE na!
    Balakumar .M
    http://i5bala.blogspot.com
    --

  • [FL8] cambiar el color del scroll del componete text Area

    aupi gente
    pues eso,,estoy mirando la ayuda del flash y no doy con la
    solucion
    alguien, lo ha tenido que cambiar d ecolor alguna vez?
    saludos y gracias de ante mano

    Horgykitkat wrote:
    What I found after taking out the heights from the text areas is that I was left with uneven text column lengths (alternating beige areas). So I created a repeatable jpg with the same alternating beiges and put it as the background of the bodyArea tag. Again, if there is a better way, please let me know!
    A repeating background image to 'fake' equal height columns is perfectly ok.
    It won't work IF your page is responsive but it isn't so no problem. If it were responsive a better solution would be to take advantage of the css property display: table; and display: table-cell;
    In reference to your footer background color not showing I would assume you have floated items within the footer container. If so then you need to clear those floated items which allows the footer container to wrap itself around the floated items inside it.
    You would do this by using css - overflow: hidden; - on the parent container which has the floats inside it.

  • Drawing a colored cursor on a text area given coordinates

    Hi all,
    Does anybody know how to draw a telepointer ( ie. a small coloured arrow like the cursor) given point coordinates on a text area? Please help.

    This may help... just set the transparency in the png or use a gif
    Image cur = getImage(getDocumentBase(), "cursor.png");
    Cursor myCursor = Toolkit.getDefaultToolkit().createCustomCursor(cur, new Point(0, 0), "name");
    textarea.setCursor(myCursor);

  • Transfer footage iMovie 08 to iMovie 06 HD & change outline color for text

    I have a completed video that is basically all stills. I would like to transfer the stills in their current sequence and if possible with their current crop styles ie Ken Burns without having to start ALL over. Is this possible? Just downloaded 06 HD because I wanted more editing options that iMovie 08 seems to be lacking.
    Also, how do you change the outline color for text in titles? At one point it switched from black to white but I have no idea how it happened... now its back to black.
    Lastly, are we only allowed to place music exactly at the head of a clip or is there a setting I am unable to find that unlocks that "snap to" function?
    Thank you.
    Message was edited by: boogieon
    Message was edited by: boogieon

    Thanks....I was thinking that was probably it. Will be a little time consuming, but I'll feel better in the end knowing a vacation and bunch of summer stuff is back on tape for archiving.

  • I am unable to change the color of text in an email I replay to or compose. I am on 31.6.0 release of Thunderbird.

    When I receive, reply or compose email. I no longer am able to see or change the color of text. I select to change the text from black to Red (or any other color) and the text just stays black, The color seletor box will show the last select color, but never actually changes the text color in an email. Also in received email, when the sender has indicated their replies to me are in another color, All the text only appears as black. I never had this problem in the past, not sure what has happened. I did restart Thunderbird with add-ons disabled and this did not change the problem.

    Hello, maybe the question need to move by a moderator to thunderbird support ?
    https://support.mozilla.org/en-US/questions/thunderbird?owner=all
    thank you
    [moderator note: question thread has been moved from Firefox queue to Thunderbird queue]

  • Report Title and Text Area issue when exported to pdf using Viewer

    Hi there,
    We are using OracleBI Discoverer Version 10.1.2.55.26
    We have reports that displays Report title containing the following
    - Report Title
    - Runt Date and Time
    - Page No
    And text area which displays 'Last Page'
    Following properties are set at the worksheet level using page setup
    Report Title --> 'Print on every Page'
    Text Area --> 'Print on last page'
    The report when exported to PDF using Discoverer plus works fine and displays report title and text area as defeined.
    But when we try to export the same report to pdf from Discoverer viewer, it displays
    - Report title on first page only.
    - text area on all pages
    All our users accesses report using discoverer viewer so we cannot open discoverer plus to them.
    Is there a solution which will enable us to export the report in pdf using discoverer viewer and displays the same output as discoverer plus.
    Please let me know... If you have any questions then please feel free to ask.
    Thanks in advance for your help...
    Manish

    but when opened on other os x machines some text is colored differently than it should be
    Well, if typographic objects are colour managed, the colour appearance is dependent on the source ICC profile that describes the colourants in the typographic objects and the destination ICC profile that describes the colours the display is able to form and the RBC colourant combinations that will form those colours.
    In general, typographic objects should have special treatment, since the expectation is not that typographic objects should be colour managed, but that typographic objects should simple be set to the maximum density of dark. On a display, that is R=0 G=0 B=0 and on a seperations device (a lithographic press) that is C=0 M=0 Y=0 K=100.
    If for some reason typographic objects are colour managed, and if the ICC profiles for the displays are off by half a mile or more in relation to the actual state of the display system, then the colours will not be the same. On the other hand, if those displays are calibrated and characterized, then the colourants will be converted to form the same colours on the displays.
    /hh

  • How can I change the background color in text box using RGB format

    Can some one tell me if Mac Pages (version 5.0) allows users to customize the background color of a text box using RGB color format?  It appears that the text color can be changed using RGB but background color is limited to a few standard colors.   Thanks

    They are just sample swatches, use the Color Picker to choose anything you want.
    Peter

  • How to add a text area in a Content pane..?

    Hi,
    I created a content pane with 5 buttons. One of them is a quit button, and I was able to create an "system.exit(0)" event handling for him. My problem is.. I have 4 other buttons, and I want them to show some text when I click them. How do I add a text area bellow my content pane..?
    Copy/paste my code to see what im talking about :) :
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Interface extends JFrame {
    public Interface() {
    Container contentPane = getContentPane();
    contentPane.setLayout(new FlowLayout());
    JButton button1 = new JButton("Test1");
    JButton button2 = new JButton("Test2");
    JButton button3 = new JButton("Test3");
    JButton button4 = new JButton("Test4");
    JButton button5 = new JButton("Quit");
    ButtonHandler handler = new ButtonHandler();
    button5.addActionListener( handler );
    contentPane.add(button1);
    contentPane.add(button2);
    contentPane.add(button3);
    contentPane.add(button4);
    contentPane.add(button5);
    contentPane.setBackground(Color.orange);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public static void main(String args[]) {
    Interface window = new Interface();
    window.setLocation(250,350);
    window.setTitle("FlowLayout");
    window.pack();
    window.setTitle("Test");
    window.setVisible(true);
    public class ButtonHandler implements ActionListener {
    public void actionPerformed( ActionEvent e )
    System.exit(0);
    Thanks alot! :)

    By default the content pane of the JFrame uses a Border Layout. So you should:
    1) Create a JPanel
    2) Set the layout of the JPanel to FlowLayout
    3) add the buttons to the panel
    4) add the panel to the content pane
    5) add your text area to the content pane
    Read this section from the Swing tutorial on "Using Layout Managers":
    http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

  • How do I retrieve all data from a table and display it on a text area?

    I want to retrieve all the data from one of my MS Access data table and display them all in a text area. how do i go among doing this?
    In my car table i have the fields lined up like this..
    license,color,doors and year_made
    I have an Object class called CAR that will contain methods to set the data from these fields when it gets retrieved.
    here's what i go so far.....
    statement = getDBConnection().createStatement();
         rs = statement.executeQuery("select * from car");
         boolean moreRS = rs.next();
    if(moreRS)
    car.setLicense(rs.getLong(1));
         car.setColor(rs.getString(2));
         car.setDoors(rs.getString(3));
    car.setYearMade(rs.getString(4));
    //but this will only get me one car. How do I get more car data?
    HELP!!

    Vector cars = new Vector();
    while (rs.next()) {
      String license = rs.getLong(1);
      String color = rs.getLong(2);
      String doors = rs.getLong(3);
      String year = rs.getLong(4);
      myTextArea.append(license+"\t"+color+"\t"+doors+"\t"+year+"\n");
      Car car = new Car();
      car.setLicense(license);
      car.setColor(color);
      car.setDoors(doors);
      car.setYearMade(year);
      cars.add(car);
    }t=tab
    n=newline
    Vector: http://java.sun.com/j2se/1.4.1/docs/api/java/util/Vector.html

Maybe you are looking for