Button inside text box
- by user542719
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);