JPanel pan = (JPanel) getContentPane();
JLabel piccy;
if (img == null) {
piccy = new JLabel();
} else {
piccy = new JLabel(img);
}
piccy.setBorder(BorderFactory.createLineBorder(Color.black, 1));
text = new JLabel("Building....", JLabel.CENTER);
text.setFont(new Font("Sans-Serif", Font.BOLD, 12));
text.setBorder(BorderFactory.createEtchedBorder());
pb = new JProgressBar(MIN, MAX);
pb.setBorder(BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
JPanel pan2 = new JPanel();
pan2.setLayout(new BorderLayout());
pan2.add(text, BorderLayout.NORTH);
pan2.add(pb, BorderLayout.SOUTH);
pan.setLayout(new BorderLayout());
pan.add(piccy, BorderLayout.CENTER);
pan.add(pan2, BorderLayout.SOUTH);
pan.setBorder(BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
pack();
Dimension size = getSize();
Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
int x = (scr.width - size.width) / 2;
int y = (scr.height - size.height) / 2;
setBounds(x, y, size.width, size.height);