public class FontProgressFrame extends JFrame { JProgressBar jpb; public FontProgressFrame(int count) { super("Progress..."); Container cp=this.getContentPane(); cp.setLayout(new GridBagLayout()); GridBagConstraints gbc=new GridBagConstraints(); gbc.gridx=0; gbc.gridy=0; gbc.anchor=gbc.NORTHWEST; gbc.gridwidth=1; gbc.gridheight=1; gbc.fill=gbc.HORIZONTAL; Insets i1=new Insets(5,10,5,5); Insets i2=new Insets(5,5,5,5); gbc.insets=i1; cp.add(new JLabel("Loading Fonts..."),gbc); gbc.gridy++; gbc.insets=i2; jpb=new JProgressBar(); jpb.setMaximum(count); cp.add(jpb,gbc); Point point=jpb.getLocation(); jpb.setOrientation(JProgressBar.HORIZONTAL); jpb.setBounds(point.x,point.y,300,40); this.pack(); Dimension d=Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((int)d.getWidth()/2-this.getWidth()/2, (int)d.getHeight()/2-this.getHeight()/2); this.setVisible(true); }