Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


[java] textarea


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 February 2000 - 07:21 AM

Im trying to create a java applet to serve as the client to a program I am making. I want to be able to do like Yahoo and other chat places do their text. It looks to me like they place their text inside a textarea, but how do they get other attributes? for example, choosing different fonts, and different colors, and font sizes, background, pictures, etc. How could I create a similar "textarea" for use in my project.

Sponsor:

#2 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 February 2000 - 02:00 PM

I think this is a job for styled documents.
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
I''ve never actually done anything with them but I think that''s what you need. There is an example that comes with the jdk in which you can change the font and color of text, and insert images.

#3 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 February 2000 - 03:43 PM

I may have overlooked it, but I couldnt find the information
I needed on the URL you gave.

It seems like it would be pretty simple, but I just cant seem to find source so I can change font attributes [color, etc] and insert pictures inside a textarea.

maybe they use something other than textarea?

#4 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 February 2000 - 02:26 AM

You''re not looking for textarea stuff. You should be looking for styled document stuff. There''s an example in the jdk distributuion
\demo\jfc\StylePad\
java -jar Stylepad.jar

I''m sure that is for what you are looking, right?

#5 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 February 2000 - 11:50 AM

couldnt look at it tonite, but if Im not mistaken, swing is for Java 1.2 and greater, I was just curious which browsers support Java 1.2 and greater?



#6 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 08 February 2000 - 01:57 PM

Well, none right now. That''s why we have the Plug-In available for most platforms. Now, most probably, future versions of the browsers will support JDK 1.2, but until then you have to learn how to deal with the nuances of the Plug-In, which in my opinion, is still new technology and has plenty of problems.

JoeG

#7 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 February 2000 - 03:29 PM

then how does Yahoo.com chat do their java chat clients?

They have colored text, and images inside their "textarea".

There must be a way to do this under Java 1.0 then right?



#8 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 February 2000 - 02:44 PM

What if I tried to create my own textarea from the classes that textarea get its inheritance from? would that be possible, and then I could add in colored text?

Somebody suggested using a Canvas to impersonate a textarea, but that way I could do anything to it, colored text, pictures, anything. How would I implement this?

#9 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 February 2000 - 02:53 AM

I don''t imagine that there would be any problem with you just using the javax.swing.text package and just including it in your distribution. Most of the stuff you need are interfaces, and the concrete implementations directly extend java.lang.object. If not, you can still look at the source for ideas on what methods to use if you are going to extend textarea yourself.

#10 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 11 February 2000 - 07:56 AM

Just run java -verbose yourApp.class and capture the output. What you see is a list of all the classes that you''re app loaded. Finding these classes in the class hierarchy is an entirely different problem though.

#11 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 February 2000 - 09:05 AM


>I don''t imagine that there would be any problem with you
>just using the javax.swing.text package and just including
>it in your distribution.

The main reason I dont want to use Java 1.1, 1.2, 2.0, or swing is because it is going to be an applet. I need it to be small and use Java 1.0

I''ll try and see if I can find the appropriate classes
so I can extend textarea to include colored fonts and images.

thanx for all the advice and replies.

#12 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 February 2000 - 06:53 AM

If you''re using 1.0 there''s not going to be any API or class that you can use, you''re gonna have to code your own component. Good luck hadling events.

#13 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 12 February 2000 - 10:00 AM

Actually java1.1 is supported by the major browsers. The event handling there is a lot more nicer than it was with java1.0

JoeG

#14 Jeremiah   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 February 2000 - 03:17 PM

well, I''m beginning coding it today...

Its going to have a canvas, and a scrollbar.

The part Im trying to figure out is this:
I am going to need to know the total height of the
"textarea" information, so I can deal with the scrollbar.

but this isnt as easy as it sounds. because Im going to be
using different fonts, and each font takes up different amount of space. some are fixed-width, and some arent.
And then if I add in images, I''ll hafta add them into figureing out the hieght.

what should I have the "textarea" contents stored in?
How should I store it, so I can store the color of different words and images and such?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS