🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: jTextField: String justification problem

#10234
From: Redding Bacon
Date: Mon, 01 Nov 1999 00:00
83 lines
3375 bytes
Rich,

I tried to set the cursor postion to 0 like you suggested, but I can not
find any properties or methods that would facilitate that  (anybody know how
to do that with swing, Java2).  I'm using Java2 swing (javax) components.
One thought I had was to create a KeyEvent that would imitate a Home Button
pressed (which moves the cursor to the begining of the component) then send
it to the JTextField in hopes that it would move its cursor to the
beginning. The problem is that:
1) I'm not sure what event to create.  I think that KeyEvent is AWT.  If I'm
not mistaken I should be using only swing events since I'm using swing
components.
2) I don't know how to send an event to the components.

Well, the bottom line is that I can't get the JTextField components to
justify to the left when they display a string, like in the example I gave
yesterday.  If anyone can help please feel free to do so.

Thanks again,
Redding



Rich Wilkman <rwilkman@inprise.com> wrote in message
news:381DD20C.E4C0D212@inprise.com...
> Redding:
>
> This is the same behaviour as awt.TextField, etc.  One gets the feeling
> that this is how Javasoft thinks it should work.  Can you set the cursor
> position to 0?
>
> -Rich
>
> Redding Bacon wrote:
> >
> > Hey all,
> >
> > I am using JB3 to create Java2 applets and I am using all swing
components.
> > Each applet has several JTextComponents that it uses to display text.
The
> > text that is displayed is sometimes longer than the TextComponent used
to
> > display it.  When this happens you can only see the end of the string in
the
> > text field.  For example,  say that I have the following JTextField and
set
> > its text:
> >
> >     JTextField jt = new JTextField();
> >     jt.setSize(20, 20);                           /* really short text
field
> > */
> >     String string = "This is a test string for the test JTextField";
> >     jt.setText(string);
> >
> > In this example, when I run the applet the jt text field will display
the
> > string but you will only see the last few characters of it.  It would
much
> > better if it could display the first part of the string instead.  How
can I
> > do that?  I've looked everywhere, but can't figure it out.  Anyone have
a
> > sugestion?
> >
> > Thanks,
> > Redding
>
> --
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Rich Wilkman
> Quality Assurance Manager
> Borland JBuilder Team
>
> If you see something that looks like an opinion up there,
> it's mine and mine alone.
>
> Mail sent to me from the newsgroups won't bounce but will
> be ignored.  If I have time, I'll respond, but you  have
> a better chance if you confine your posts to the newsgroups
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <7vkpa8$7022@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7vi8ut$eos7@forums.borland.com> <381DD20C.E4C0D212@inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,439b8cbe49d2cafd
X-Google-Attributes: gid111d45,public
From: "Redding Bacon" <reddingbacon@msn.com>
Subject: Re: jTextField:  String justification problem
Date: 1999/11/01
Message-ID: <7vkpa8$7022@forums.borland.com>
X-Deja-AN: 543201655
References: <7vi8ut$eos7@forums.borland.com> <381DD20C.E4C0D212@inprise.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: RMS
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing