java applet GUI question

Discussion in 'Java' started by Claus K., Mar 10, 2009.

  1. Claus K.

    Claus K. Guest

    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?
     
    Claus K., Mar 10, 2009
    #1
    1. Advertising

  2. 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
     
    Knute Johnson, Mar 11, 2009
    #2
    1. Advertising

  3. Claus K.

    Daniel Pitts Guest

    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/>
     
    Daniel Pitts, Mar 11, 2009
    #3
  4. Claus K.

    Roedy Green Guest

    On Tue, 10 Mar 2009 14:35:29 -0700 (PDT), "Claus K."
    <> 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
     
    Roedy Green, Mar 12, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. webster
    Replies:
    0
    Views:
    877
    webster
    Jul 20, 2003
  2. Krista
    Replies:
    3
    Views:
    2,343
    Andrew Thompson
    Sep 15, 2004
  3. Archana
    Replies:
    1
    Views:
    1,398
    Andrew Thompson
    Oct 25, 2004
  4. yawnmoth
    Replies:
    1
    Views:
    917
    Andrew Thompson
    Aug 15, 2006
  5. Replies:
    4
    Views:
    5,921
    Laurent D.A.M. MENTEN
    Jan 11, 2007
Loading...

Share This Page