@@ -0,0 +1,2267 @@
+import javax.swing.*;%0Aimport java.awt.*;%0A%0Apublic class HelloProgressBar extends JFrame %7B%0A    public HelloProgressBar() %7B%0A        super(%22HelloProgressBar%22);%0A        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A%0A        JButton goBtn = new JButton(%22Go%22);%0A        goBtn.setPreferredSize(new Dimension(200, 23));%0A        goBtn.addActionListener(e -%3E %7B%0A            go();%0A        %7D);%0A%0A        getContentPane().add(goBtn, BorderLayout.CENTER);%0A%0A        pack();%0A    %7D%0A%0A    private void go() %7B%0A        PBarDbox pb = new PBarDbox(this);%0A        pb.setLocationRelativeTo(this);%0A%0A        OurWorker ow = new OurWorker(pb);%0A%0A        try %7B%0A            ow.execute();%0A            pb.setVisible(true);%0A            Object value = ow.get();%0A            System.out.println(String.format(%22Got %25s%22, value.toString()));%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A    %7D%0A%0A    public static void main(String... args) %7B%0A        System.out.println(%22Hello Progress Bar!%22);%0A%0A        HelloProgressBar hpb = new HelloProgressBar();%0A        hpb.setVisible(true);%0A    %7D%0A%0A    class PBarDbox extends JDialog %7B%0A        private JProgressBar pbar;%0A%0A        PBarDbox(JFrame parent) %7B%0A            super(parent, %22Progress%22, true);%0A%0A            pbar = new JProgressBar(0, 100);%0A%0A            getContentPane().add(pbar, BorderLayout.CENTER);%0A%0A            pack();%0A        %7D%0A%0A        void setProgress(final int value) %7B%0A            pbar.setValue(value);%0A        %7D%0A    %7D%0A%0A    class OurWorker extends SwingWorker %7B%0A%0A        PBarDbox pbdb;%0A%0A        OurWorker(PBarDbox pbdb) %7B%0A            super();%0A            this.pbdb = pbdb;%0A        %7D%0A%0A        @Override%0A        protected Object doInBackground() throws Exception %7B%0A            System.out.println(%22Executing in background%22);%0A%0A            for (int i = 0; i %3C 10; i++) %7B%0A                Thread.sleep(1000);%0A%0A                int j = (i + 1) * 10;%0A                System.out.println(j);%0A%0A                Runnable r = () -%3E %7B%0A                    pbdb.setProgress(j);%0A                %7D;%0A%0A                SwingUtilities.invokeLater(r);%0A            %7D%0A            return %22Our Value%22;%0A        %7D%0A%0A        @Override%0A        protected void done () %7B%0A            pbdb.setVisible(false);%0A            System.out.println(%22Done%22);%0A        %7D%0A    %7D%0A%7D%0A

Create HelloProgressBar.java