I use the GUI builder of NetBeans and put a panel on a frame and controls on the panel.
How do I then apply GridBagLayout to these controls?
I have tried re-adding the control to the panel in code but in this example changing the x,y to anything other than 0,0 makes my label disappear.
I found lots of help using GridBagLayout and all of them build the control in code and add it to the frame.public MyFrame() { // constructor initComponents(); InitInputPanel(); } private void InitInputPanel(){ JPanel p = this.InputPanel; GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 11; gbc.gridheight = 84; gbc.gridx = 1; gbc.gridy = 80; p.add(this.lblCustomerName, gbc);
How do I use GridBagLayout with already placed controls?