Hi,I want to add component into JTextField as a popup like this.
i want to add my component for example JPanel...
Hi,I want to add component into JTextField as a popup like this.
i want to add my component for example JPanel...
You could use a JPopupMenu
-- launched via your button and placed relative to your text field:
final JTextField textField = ...
JButton button = ...
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu popup = new JPopupMenu();
popup.setLayout(new BorderLayout());
popup.add(new JPanel()); // your component
popup.setPopupSize(100, 100);
popup.show(textField, 0, textField.getHeight());
}
});