开发者

Method is java swing that clear a Jlist?

Is there a method in Java swing that clear a JList and a JTextField?

for example I have开发者_JAVA百科 a string in a Jlist and a string in a JtextField and I want to press a "cancel" button, what method do i need to have in the mouse Listener in order for the Jlist and JtextField to clear?


For JTextField you can use the setText(""); method. See more here

For JList you can use the setListData(new Object[0]); method. If you want the list to stay but only remove the selection you can use the clearSelection() method. See more here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜