1
如何在Java中創建動態組合框,在單擊按鈕時添加和刪除動態組合框?
嗨。我想用上面的例子製作一個動態組合框,當按下「+」時,下面出現新的組合框,當按下「 - 」時,組合框消失。
如何在Java中執行此操作?非常感謝你。
如何在Java中創建動態組合框,在單擊按鈕時添加和刪除動態組合框?
嗨。我想用上面的例子製作一個動態組合框,當按下「+」時,下面出現新的組合框,當按下「 - 」時,組合框消失。
如何在Java中執行此操作?非常感謝你。
在你的ActionListeners的按鈕,你需要這樣的代碼:
panel.add(another panel containing combo box and buttons)
panel.revalidate();
panel.repaint();
或
panel.remove(the current panel containing the remove button)
panel.revalidate();
panel.repaint();