java.awt.TextArea - Customized

Hi,

i have been working on a java chat application. its working perfectly except for the fact that i need a customized text area to display messages in a formatted manner. Now i couldnt set font or color for any specific text because java.awt.TextArea doesnt support this. im not able to use swing (where this is possible) because it needs JRE1.3 in the client system.

What best could be done?

Thanks,

prasanna

[450 byte] By [augustin_prasanna21] at [2007-9-26 8:17:15]
# 1
JRE 1.3 HAS support for swing...
kelvekar at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 2
If you wish to use it as applet in browser, you would have to use Sun's java plugin.
kelvekar at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 3

Hi,

i know that JRE1.3 supports swing. but i need to develop a similar component for JRE1.2 as i cannot expect all my users to have JRE1.3 or suns Java Plugin. i need a customized text area using awt API that is supported in IE and Netscape that uses JRE1.2 and below

Thanks,

prasanna

augustin_prasanna21 at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 4

I can understand your argument for not using Swing but the Java Plug-In can be seamlessly downloaded and installed along with your Applet code.

If you want to stick with the standard AWT then you could build your own TextArea using a Canvas component and basically paint the text when a keypress is detected. However, bear in mind that you will also have to handle cursor movement, page up / down, scrollbars, copy & paste etc.

Ronny.

ronnybatty at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 5

i have tried installing java plug in along with the applet. but its size is nearly 5 MB which is really too big. i understand that i have to create a customized component using canvas. i would like to know id there is any such 3rd party component available. i wonder why sun has not added such a component to awt package?

Thanks,

prasanna

augustin_prasanna21 at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 6

The AWT package has been superseded by the Swing classes which address all of the AWT shortcomings but unfortunately the browser vendors were reluctant to include Swing in their JVM's.

Is it really essential to have color changing ability in the editing area itself ? You could use a normal TextField / TextArea for typing and (using a Canvas) change the colors / fonts based on each users settings.

Ronny.

ronnybatty at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 7

HI,

im not talking about the editing area. i need to develop the component for the displaying area.

Actually, the chat room has an admin user. The admin user name and admin's message needs to be displayed in a different font color from the normal users.

Thanks,

prasanna

augustin_prasanna21 at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 8
Then use a Canvas component and override the paint method to change the font / color before calling Graphics.drawString.Ronny.
ronnybatty at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 9
Search the forums. I have seen a post that says there is some code available for a java.awt chat.
atmguy at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 10
I couldn't find it in the forums, but here are pages that might be of interest. http://www.davecentral.com/browse/143/ http://www.javashareware.com/ http://freewarejava.com/
atmguy at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 11
Hello ATMGUY,i have also tried searching the forums. i couldnt find any useful messages. also i went throu the sites u have mentioned, but i couldnt find any related info for the issue.Thanks for ur effortsprasanna
augustin_prasanna21 at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...
# 12
OK then email me at atm-guy@home.com if you want some sample code. I am reluctant because I don't think this code (which I wrote) is very good, but it seems to be what you are looking for.
atmguy at 2007-7-1 18:48:02 > top of Java-index,Core,Core APIs...