Button inside text box
Posted
by
user542719
on Stack Overflow
See other posts from Stack Overflow
or by user542719
Published on 2011-01-01T01:24:28Z
Indexed on
2011/01/01
1:53 UTC
Read the original article
Hit count: 564
My code shows a button inside a textbox, but when the input value changes, the size of the text box also changes. That I don't like. Is there any solution such that the textbox size remains fixed? Or any other idea on how to create a button inside textbox? The following is my code:
JPanel panel = new JPanel();
panel.setLayout( new FlowLayout(FlowLayout.CENTER, 0, 0) );
panel.add(textField);
panel.add(button);
panel.setBackground( textField.getBackground() );
panel.setBorder( textField.getBorder() );
textField.setBorder(null);
© Stack Overflow or respective owner