Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFormattedTextField, anybody helps?

 
Wilder C Rodrigues
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I'm doing this:

I think it's okay. But when I put this component in a JPanel, for example, it shows very small. I tried to use setSize(Dimension d), but it isn't work.
What I have to do?
Tx
Wilder
SCPJ
SCWCD
Fortaleza/CE/BRZ
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wilder,
Which Layout in the JPanel do you use?
Vlad
 
Wilder C Rodrigues
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm using FlowLayout.
tx,
Wilder
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wilder,
I tried to use setSize(Dimension d),

JPanel.setSize or JFormattedTF.setSize()?
Wilder, could you please just show this block in your code? I can then test it and find a solution.
Vlad
[ October 28, 2003: Message edited by: Vlad Rabkin ]
 
Stephen Galbraith
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've not tried to code an example for you, but this from from the sun swing tutorial we site

Note: No matter how you specify your component's size, be sure that your component's container uses a layout manager that respects the requested size of the component. The FlowLayout and GridBagLayout managers use the component's preferred size (the latter depending on the constraints that you set), but BorderLayout and GridLayout usually don't. The BoxLayout manager generally uses a component's preferred size (although components can be larger), and is the only layout manager that respects the component's maximum size.
If you specify new size hints for a component that's already visible, you then need to invoke the revalidate method on it, to make sure that its containment hierarchy is laid out again. Then invoke the repaint method.

So that would appear to say don't use setSize, but use setPreferredSize etc instead as you are using a layout manager.
 
Wilder C Rodrigues
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vlad,
Tx a lot for you help.
I made some tests and got it.
I was setting up a document in my JTextField. When I change to JFormattedTextField I forgot of delete the line with setDocument() method.
Now everything is okay.
Bests,
Wilder C. Rodrigues
Sun Certified Programmer for Java 2 - Platform 1.4
Sun Certified Web Component Developer for Java 2 - Enterprise Edition
JUGLeader
Unimed Fortaleza - Projeto S@bius
"If you look into the sun too long do the things you see begin to burn your eyes?"
Steve Hogarth - Marillion
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wilder,
Tx a lot for you help.

Glad to help you
Best,
Vlad
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephen,
Welcome to this forum.
Which assignment did you get ?
Best,
Phil.
 
Stephen Galbraith
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got URLyBird 1.3.1 which is one of the NX ones I believe.
I've just started to look at the assignment and I'm still getting into reading it in the detail everyone else seems to.
Looking forward to reading more on this site!
(although the thread looks a bit scary!)
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephen,
I got URLyBird 1.3.1 which is one of the NX ones I believe.

Yes. I've got URLyBird 1.3.1, quite similar - which is an NX too.
(although the thread looks a bit scary!)

Which "the" ? (Well I guess, but ...)
Best,
Phil.
 
Stephen Galbraith
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. I've got URLyBird 1.3.1, quite similar - which is an NX too.

Or the same!
Which "the" ? (Well I guess, but ...)

I think you guess correctly. Which thread has 130 or so messages! :roll:
Regards,
Steve
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, that one ! Great threads never die ...
(although the thread looks a bit scary!)

Messy but not scary ! Should have been closed on October 14, 2003 02:55 AM anyway.
Stephen:
I got URLyBird 1.3.1 which is one of the NX ones I believe.

Phil:
Yes. I've got URLyBird 1.3.1, quite similar - which is an NX too.

Stephen:
Or the same!

Was a typo : I have 1.2.1 ...
Best,
Phil.
 
Stephen Galbraith
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would reply bit then we'd have the flashing star on this topic!
Doh!
Looking forward to more productive discussions as I start implementation!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic