Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

set.Size  RSS feed

 
Rich Wilson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to figure out the correct way to setSize on the following:

JFormattedTextField apr = new JFormattedTextField(percentFormat);

I tried adding set.Size(100,50); and various other sizes in the add statement is this the correct way to do it or am I way off course?
 
Timmy Marks
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The setColumns method will be able to adjust the width, and you can also override getPreferredSize to give it the width and height you require.

The default implementation of getPreferredSize returns:

If a non-zero number of columns has been set, the width is set to the columns multiplied by the column width.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing/AWT...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!