JProgressBar nie

0

Siemka tworze JProgressBar i mam problem z wypisaniem zmian do JProgressBara

   InfoPane ip = new InfoPane("Wait for initializing...");
   SwingUtilities.invokeLater(() -> {
			initGui();
			ip.pb.setValue(50);
		    readFiles();
			ip.exit();
			setVisible(true);
   });

Problem jest taki ze nie aktualizuje mi sie progressbar po uzyciu metody setValue w invokeLater a jesli nie użyje InvokeLater to nie wyrysowuje mi się InfoPane

public class InfoPane extends JFrame{

	static Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
	JProgressBar pb;
	
	InfoPane(String txt){
		setMinimumSize(new Dimension(300,200));
		setResizable(false);
		setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
		setLayout(new GridLayout(2,1));
		
		JLabel l = new JLabel(txt,SwingUtilities.CENTER);
		l.setPreferredSize(new Dimension(200,150));
		l.setOpaque(true);
		l.setBackground(Color.LIGHT_GRAY);
		l.setForeground(Color.BLACK);
		l.setFont(new Font("Helvetica", Font.BOLD, 22));
		l.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		
		pb = new JProgressBar();
        pb.setForeground(Color.BLACK);
		pb.setBackground(Color.LIGHT_GRAY);
		pb.setStringPainted(true);
		pb.setValue(0);
		pb.setBorder(BorderFactory.createTitledBorder("Processing..."));
		
		add(l);
		add(pb);
		this.setVisible(true);
	}
		
	public void exit(){
		isDone = true;
		this.setVisible(false);
		this.dispose();
	}
}
0

Co robi initGui() ?

1 użytkowników online, w tym zalogowanych: 0, gości: 1