🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #7858

Re: Monospaced and Higher Unicode Characters

#7858
From: Rich Wilkman
Date: Fri, 01 Dec 2000 00:00
48 lines
2947 bytes
James:

If I knew of a way, I'd tell you. :-) Strings aren't really 'painted' the way
you want.  A few years ago and on Windows I'd have said you need to do "owner
draw" and paint the pixels where you wanted them.  You could still do that in
Java if you really wanted to.

Thinking outside the computer for a moment, you really want your text field to
behave as if it were a bunch of wooden blocks with a particular character
centered on the block.  You'd need to write your own container for those wooden
boxes.  It could even take input from a JTextField on each character stroke if
you wanted.  Maybe you need to investigate your own widget -- it doesn't look
like you're gonna get JTextField to bend to your will on this one.

Have you looked at the info available from java.awt.FontMetrics?  If you can
switch to JDK 1.2 and use Java2D you can get even more info.  I don't know if it
will be enough.

-Rich

"James A. Schulz" wrote:

> Rich,
>
> Thanks for you long note.
>
> I realize I have been working against the "Java way", but I don't have a
> choice.  Let me explain what I am up to.
>
> My app is a kind of calculator.  The user enters an expression in the
> jTextField and then, in a jTable positioned directly above the jTextField,
> and having its columns aligned with the characters of the field (one column
> per character), the app "parses" the expression.  (The main task is to
> diagram the way in which the parentheses in the expression are "nested").
>
> The original DOS version of this app was a "natural" on the old character
> screen.  I have created a Delphi version which works too, but I want to move
> the app to the web, and, as you have seen, I am having a devil of the time.
>
> I don't really care much about the font so long as I can force the
> characters in my expression into a series of equal width "cells" and adjust
> the width of the app to accomodate 50 cells.  I know how to draw a string
> like this using a character iterator, but I don't know how to get jTextField
> to draw like that.  Any suggestions?
>
> thanks,
>
> James
Technical Details
Message-ID: <3A2833BA.499E689B@formlessvoid.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <906d8v$cq63@bornews.inprise.com> <MPG.14912621d190d0f989d82@forums.borland.com> <9088jr$apb4@bornews.inprise.com> <uofyw444r.fsf@sds.no> <908hh3$o9l2@bornews.inprise.com> <3A27EA61.B6E7F02@formlessvoid.com> <90941u$b3e1@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,e7b0355fee419750
X-Google-Attributes: gid111d45,public
From: Rich Wilkman <richw@formlessvoid.com>
Subject: Re: Monospaced and Higher Unicode Characters
Date: 2000/12/01
Message-ID: <3A2833BA.499E689B@formlessvoid.com>
X-Deja-AN: 700114682
Content-Transfer-Encoding: 7bit
References: <906d8v$cq63@bornews.inprise.com> <MPG.14912621d190d0f989d82@forums.borland.com> <9088jr$apb4@bornews.inprise.com> <uofyw444r.fsf@sds.no> <908hh3$o9l2@bornews.inprise.com> <3A27EA61.B6E7F02@formlessvoid.com> <90941u$b3e1@bornews.inprise.com>
X-Accept-Language: ja,en
Content-Type: text/plain; charset=us-ascii
X-Trace: 1 Dec 2000 15:27:57 -0800, 209.144.169.10
MIME-Version: 1.0
Reply-To: richw@formlessvoid.com
Newsgroups: borland.public.jbuilder.java.swing