Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2005

Tip: Looking for answers? Try searching our database.

visible area of JTextField

Thread view: 
jobs239@hotmail.com - 20 Oct 2005 18:37 GMT
I want to make the visible area of some Jtextfield to be the leftmost
part and for some the rightmost part. How can I do that?
Christian Kaufhold - 20 Oct 2005 19:26 GMT
> I want to make the visible area of some Jtextfield to be the leftmost
> part and for some the rightmost part. How can I do that?

setCaretPosition
jobs239@hotmail.com - 20 Oct 2005 20:31 GMT
When is the BoundedrangeModel used to set visibility.
example:
BoundedrangeModel visibility = getHorizontalVisibility();
visibility.setValue(text_align == TEXT_LEFT
                       ? visibility.getMinimum() :
visibility.getMaximum());
Christian Kaufhold - 23 Oct 2005 12:26 GMT
> When is the BoundedrangeModel used to set visibility.
> example:
> BoundedrangeModel visibility = getHorizontalVisibility();
> visibility.setValue(text_align == TEXT_LEFT
>                        ? visibility.getMinimum() :
> visibility.getMaximum());

That will be undone when the caret is moved the next time.

Christian
Roedy Green - 21 Oct 2005 04:14 GMT
>I want to make the visible area of some Jtextfield to be the leftmost
>part and for some the rightmost part. How can I do that?
I would put a value in with some spaces in the middle.

Perhaps some background would stimulate other ideas.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Andrew Thompson - 21 Oct 2005 04:30 GMT
> I want to make the visible area of some Jtextfield to be the leftmost
> part and for some the rightmost part. How can I do that?

(against my better judgement, I'm going to take a wild guess)

Is this what you mean?
<http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTextField.html#setHorizonta
lAlignment(int
)>
Roedy Green - 23 Oct 2005 23:52 GMT
>I want to make the visible area of some Jtextfield to be the leftmost
>part and for some the rightmost part. How can I do that?

Back in the DOS days invented something in my home brew language
Abundance  I called "humps" which might be relevant to your problem.

A hump is a decorative character in the middle of an editable field
that displays, but otherwise behaves as if it were not there.
Sometimes humps look like spaces, (in a postal code V5N VW5 so you
don't have to key the space) dash in a date e.g. ( 2005-10-23) so you
can just key 20051023 or use backspace to get to the previous keyed
char.

My generic formatted edit methods worked on a keystroke by keystroke
level.

In Java you might you could get away with repainting the entire field
on every keystroke without imperceptible overhead.

You likely don't want to go to all that work for this one problem, but
if you wanted a  data entry suite that did keystroke by keystroke
validation, it might be worth the effort.  You can do both checks on
individual char as some total field checks on a keystroke basis. E.g.
you can safely check that the field's numeric value is not larger than
a positive  high bound.  For a date, you can check the year bounds
even before you have the rest of the date.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 23 Oct 2005 23:59 GMT
>In Java you might you could get away with repainting the entire field
>on every keystroke without imperceptible overhead.

oops
In Java, you might you could get away with repainting the entire field
on every keystroke with imperceptible overhead.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.