how to center jlabel in jpanel code example Example: jlabel on the center of a jpanel panel.setLayout(new GridBagLayout()); panel.add(label);