Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40
  1. #21
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    To help you should explain your question well. Just talking about a code again and again, but not well explanation you put here.
    Sir plz help me.Only you tell how i go..

  2. #22
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    To help you should explain your question well. Just talking about a code again and again, but not well explanation you put here.
    Plz help me..

  3. #23
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    To help you should explain your question well. Just talking about a code again and again, but not well explanation you put here.
    Sir i hope now you help me...

  4. #24
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Hello Mir,
    Check this link may help yoy to some extent.
    Java Tips - How to add colored text to the document
    Hi Niveditha,it is good example but here i stuck.Becouse i have frame and i am unabel to convert these code.Can you help how can i use these code for frame..

    Plz help me

  5. #25
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Ok Mir..
    So your problem is that your code extends thread and the example code extends JTextPane and you cant extend two classes rite?

    Simple write a different class that extends JTextPane and that class should have your method/code of changing text color. Create an instance of this class in your original class and call that method with the help of some parameters if required...
    To finish sooner, take your own time....
    Nivedithaaaa

  6. #26
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Ok Mir..
    So your problem is that your code extends thread and the example code extends JTextPane and you cant extend two classes rite?

    Simple write a different class that extends JTextPane and that class should have your method/code of changing text color. Create an instance of this class in your original class and call that method with the help of some parameters if required...
    it means i make a file which have code of change the color and then i call it through constructor..

  7. #27
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Yes exactly!!! that is what i meant....
    To finish sooner, take your own time....
    Nivedithaaaa

  8. #28
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Easiest place to do this is appendText() of the LogArea class. Basically before append the text, do all formatting. As Niveditha says, if you involve with the thread it can be little hard/complex. Basically check the lat place before adding text to the GUI.

  9. #29
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Easiest place to do this is appendText() of the LogArea class. Basically before append the text, do all formatting. As Niveditha says, if you involve with the thread it can be little hard/complex. Basically check the lat place before adding text to the GUI.
    Sir i am not geting your point
    Java Code:
    appendText()
    .Can you give me more details..

    Thxs for respomce..

  10. #30
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  11. #31
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Check you LogArea class, and try to identify the place where you write logs.
    Sir i am not writing a log in Log Class.Here is log class,can you tell where i put the code..

    Java Code:
    public class LogArea extends TextArea
    {
    	 
    	static LogArea logArea;
    
    	
    
    	public LogArea(int rows, int columns)
    	{
    		
    		super(rows, columns);
    		
    
    		setEditable(false);
    		
    	
    
    		
    	    }
    	
    	public synchronized void appendText(String str)
    	{
    		super.appendText(str);
    		 
    	}

  12. #32
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  13. #33
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Now you know how to change colors on the text right?
    ok sir..no problem..

  14. #34
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Ok, can you find the method which is your application write text to the text area of the GUI(basically the interface you have)?

  15. #35
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Ok, can you find the method which is your application write text to the text area of the GUI(basically the interface you have)?
    yes it is

    Java Code:
    mainFrame.updateLog("" + name);

  16. #36
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    ok, before update the text, do the formatting. Because in that case you don't need to deal with threads and so on.

  17. #37
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    ok, before update the text, do the formatting. Because in that case you don't need to deal with threads and so on.
    I think it's a too deficult for me.You had told me these condition and i was send code through PM.And related to code you have no responding me...

  18. #38
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I have no time to write codes. I gave you suggestions. Trying it or not is your decision. I don't care about that.

  19. #39
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    I have no time to write codes. I gave you suggestions. Trying it or not is your decision. I don't care about that.
    Ok Sir i know about that(time).No problem i am agree with your points..

  20. #40
    dbashby's Avatar
    dbashby is offline Senior Member
    Join Date
    Mar 2009
    Posts
    223
    Rep Power
    6

    Default

    I have read this thread and I am lost, I am looking to change the output text colour on my app

    I have three outputs

    Underweight - I want orange

    OK I want Green

    Overweight I want red

    I want the textfield to be black

    I have tried to make sense of the links given here but I cant, anyone give me a little more information please?

    Thanks in advance.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. How to change JDK?
    By mew in forum Eclipse
    Replies: 5
    Last Post: 05-21-2010, 05:21 AM
  2. Replies: 0
    Last Post: 06-25-2008, 10:33 AM
  3. Replies: 0
    Last Post: 05-26-2008, 04:26 PM
  4. How ro change the locale of JVM
    By ravi.ks007@hotmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-26-2007, 06:17 AM
  5. Is it possible to change the '\n' into ' ' ...
    By johnny7white in forum New To Java
    Replies: 1
    Last Post: 11-15-2007, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •