jdialog

Dynamically Add Components to a JDialog

烈酒焚心 提交于 2019-11-25 23:31:54
问题 I am having trouble adding JComponents to a JDialog when the user clicks a button on the JDialog. Basically I want it to look like this: Then, when the user clicks \"Add New Field\" I want it to look like this: I cannot seem to get the dialog to add the new JLabel or JTextField. Can anyone point me in the right direction? EDIT : This is the action for the \"Add New Field\" button (Just trying a label now). @Action public void addNewField() { Container contentPane = getContentPane(); JLabel

Setting the maximum size of a JDialog?

半腔热情 提交于 2019-11-25 22:51:13
The short version: do I need to do something tricky to get JDialog's setMaximumSize() to work? The full version: I've got a JDialog (layout manager: BorderLayout) which contains a scroll pane and a JPanel on the bottom with the commit buttons. The scroll pane contains a JPanel which is built dynamically elsewhere in the system. What I want is for the dialog to dynamically size itself around the JPanel up to a certain size, and then start growing scrollbars. This is, more or less, what happens by default, except the maximum size seems to be the size of my monitor. I thought this is what the

Remove Top-Level Container on Runtime

强颜欢笑 提交于 2019-11-25 21:48:15
问题 Unfortunately, it looks like this recently closed question was not well understood. Here is the typical output: run: Trying to Remove JDialog Remove Cycle Done :-) Checking if still exists any of TopLayoutContainers JFrame JDialog Will Try Remove Dialog again, CycleNo. 1 ----------------------------------------------------------- Trying to Remove JDialog Remove Cycle Done :-) Checking if still exists any of TopLayoutContainers JFrame JDialog Will Try Remove Dialog again, CycleNo. 2 ----------