• Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing button in a text-field  RSS feed

 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

Im trying to create a "lookup" button in a text box so that the user can either insert a agent code or push the button and a selection of current agent codes pops up. I managed to get the button in the text-field but now it takes up the whole text field and resizing it doen't make any difference.

Here is my code:



I am trying to set the button size to a small square on the right hand side of the text-field. Any idea's would be greatly appreciated.

Thanks
 
Bartek Myszkowski
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have You tried methods like setMinimumSize, setPreferredSize, setMaximumSize?
@edit: doesn't work, sorry
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi got it to work if you take line 12 and change it so it looks like that instead "Agent Code : ", agentCodeF, then the setSize() works.

Although now does anyone have any idea how i would get it to the right hand side of the dialog box(currently it is stuck on the left) agentLookup.setAlignmentY(12) doesn't work.

thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> so that the user can either insert a agent code or push the button and a selection of current agent codes pops up

sounds like an editable JComboBox should do what you want
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yip that would work if it was only a single list, but it's supposed to bring up a whole table so i thought adding a button would be better?
thanks though
 
Maja Gralewska
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys it works ended up using the setLocationMethod();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!