Implementing Java2SAutoTextField to a JtextField

一世执手 提交于 2019-12-04 17:28:18

Adding the main() method below to Java2sAutoTextField produced the expected result after typing "H". It's not crucial for this example, but Swing GUIs should be constructed on the EDT.

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            List<String> list = new ArrayList<String>(Arrays.asList(
                "Austria", "Croatia", "Hungary", "Italy"));
            JFrame f = new JFrame("AutoTest");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new Java2sAutoTextField(list));
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
        }
    });
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!