Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java applet GUI question

Reply
Thread Tools

java applet GUI question

 
 
Claus K.
Guest
Posts: n/a
 
      03-10-2009
Hello everyone,

I have written this small applet GUI some time ago (more as proof of
concept than anything else); now there actually is a new requirement
for it.

The applet GUI is basically a telnet client, with some custom
functionality built in, which is all working fine.
However, now the stream output arriving should be coloured when there
is colour specified.

The first version was just written in plain AWT, with all the telnet
color code removed via regex.
Now, I am looking for what to do.

I have found the swing Components, of course, and it appears as if I
could do exactly what I want with a JTextPane, but the Document
instance as model behind is confusing me a bit.
Can I just add the stream output to the document with color
information when specified and update the JTextPane to show the
document again? How does that work with limiting scrollback and fast
arriving data over the stream?
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      03-11-2009
Claus K. wrote:
> Hello everyone,
>
> I have written this small applet GUI some time ago (more as proof of
> concept than anything else); now there actually is a new requirement
> for it.
>
> The applet GUI is basically a telnet client, with some custom
> functionality built in, which is all working fine.
> However, now the stream output arriving should be coloured when there
> is colour specified.
>
> The first version was just written in plain AWT, with all the telnet
> color code removed via regex.
> Now, I am looking for what to do.
>
> I have found the swing Components, of course, and it appears as if I
> could do exactly what I want with a JTextPane, but the Document
> instance as model behind is confusing me a bit.
> Can I just add the stream output to the document with color
> information when specified and update the JTextPane to show the
> document again? How does that work with limiting scrollback and fast
> arriving data over the stream?


JTextPane has limited capabilities to display a couple of different
markup types (HTML and RTF). I think it would work just fine for what
you want to do. You should be able to just append text to the document.

--

Knute Johnson
email s/nospam/knute2009/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      03-11-2009
Claus K. wrote:
> Hello everyone,
>
> I have written this small applet GUI some time ago (more as proof of
> concept than anything else); now there actually is a new requirement
> for it.
>
> The applet GUI is basically a telnet client, with some custom
> functionality built in, which is all working fine.
> However, now the stream output arriving should be coloured when there
> is colour specified.
>
> The first version was just written in plain AWT, with all the telnet
> color code removed via regex.
> Now, I am looking for what to do.


First, Color is not usually "telnet" code, it is terminal code. Look up
VT220 emulation for a start.

> I have found the swing Components, of course, and it appears as if I
> could do exactly what I want with a JTextPane, but the Document
> instance as model behind is confusing me a bit.
> Can I just add the stream output to the document with color
> information when specified and update the JTextPane to show the
> document again? How does that work with limiting scrollback and fast
> arriving data over the stream?


That I can't help you with. What have you tried? What happened?


--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      03-12-2009
On Tue, 10 Mar 2009 14:35:29 -0700 (PDT), "Claus K."
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>The first version was just written in plain AWT, with all the telnet
>color code removed via regex.
>Now, I am looking for what to do.


Probably the easiest way to do it is to mark up your stream with some
simple HTML markup and feed it to a JEditorPane.
see http://mindprod.com/jgloss/jeditorpane.html

You can do it in AWT by using drawString on a Canvas, very low level.

--
Roedy Green Canadian Mind Products
http://mindprod.com

"Climate change is no longer a doomsday prophecy, itís a reality."
~ Astrid Heiberg president of the International Federation of Red Cross and Red Crescent Societies
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java.applet.Applet.getParameter() blaine@worldweb.com Java 4 01-11-2007 08:04 PM
confussed about showStatus in java.applet.Applet yawnmoth Java 1 08-15-2006 05:44 AM
Java Applet loading in Applet Viewer but not in HTML page Archana Java 1 10-24-2004 11:41 PM
Java applet failed when I try to load the avi file in my java applet Krista Java 3 09-15-2004 02:53 AM
Re: play wave files using java.applet.Applet webster Java 0 07-20-2003 01:51 PM



Advertisments