I'm wondering if it is possible to control certain aspects in my function. All my it does is control how an object gets placed on my gui.
I'm wondering if there is a way to control GridBagConstraints.fill and GridBagConstraints.anchor
Function:
public void gridBagControl(Component ob, JPanel p, Insets in, int row, int w_y, int g_x, int fill) {
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = g_x;
gridBagConstraints.gridy = row;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = w_y;
gridBagConstraints.anchor = GridBagConstraints.CENTER; //want to add CENTER as a param
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; //want to add HORIZONTAL as a param
gridBagConstraints.insets = in;
p.add(ob,gridBagConstraints);
}
Just thought I would post and see if anyone knew how to get those to work with the function. They seem to be ints which is what I tried at first however encountered some issues.
Anyways, I'm sure this will be a thread that is solved quickly. In advance, thanks for the help.