> 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
>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.
> 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)>
>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.