I am making a simple game and I cant seem to get the line to center. I would like it all to be in a column and centered. I have this line of code that is not centering
JLabel numberOfChangesLabel = new JLabel("" + totalChanges);
pane.add (new JPanel ().add(numberOfChangesLabel));
this should act like me creating another JPanel and then adding the component to that panel, then adding the component to the main panel. When I do create a new panel then add the component to the panel, then add the panel to the main panel it centers. Why doesnt that line work correctly.
Thanks for any help.