1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.gui;
|
---|
3 |
|
---|
4 | import java.awt.Component;
|
---|
5 | import java.awt.GridBagLayout;
|
---|
6 |
|
---|
7 | import javax.swing.BorderFactory;
|
---|
8 | import javax.swing.BoundedRangeModel;
|
---|
9 | import javax.swing.JButton;
|
---|
10 | import javax.swing.JDialog;
|
---|
11 | import javax.swing.JLabel;
|
---|
12 | import javax.swing.JOptionPane;
|
---|
13 | import javax.swing.JPanel;
|
---|
14 | import javax.swing.JProgressBar;
|
---|
15 |
|
---|
16 | import org.openstreetmap.josm.Main;
|
---|
17 | import org.openstreetmap.josm.tools.GBC;
|
---|
18 | import org.openstreetmap.josm.tools.I18n;
|
---|
19 |
|
---|
20 | public class PleaseWaitDialog extends JDialog {
|
---|
21 |
|
---|
22 | private final JProgressBar progressBar = new JProgressBar();
|
---|
23 |
|
---|
24 | public final JLabel currentAction = new JLabel(I18n.tr("Contacting the OSM server..."));
|
---|
25 | public final BoundedRangeModel progress = progressBar.getModel();
|
---|
26 | public final JButton cancel = new JButton(I18n.tr("Cancel"));
|
---|
27 |
|
---|
28 | public PleaseWaitDialog(Component parent) {
|
---|
29 | super(JOptionPane.getFrameForComponent(parent), true);
|
---|
30 | setLayout(new GridBagLayout());
|
---|
31 | JPanel pane = new JPanel(new GridBagLayout());
|
---|
32 | pane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
|
---|
33 | pane.add(currentAction, GBC.eol().fill(GBC.HORIZONTAL));
|
---|
34 | pane.add(progressBar, GBC.eop().fill(GBC.HORIZONTAL));
|
---|
35 | pane.add(cancel, GBC.eol().anchor(GBC.CENTER));
|
---|
36 | setContentPane(pane);
|
---|
37 | setSize(400,100);
|
---|
38 | setLocationRelativeTo(Main.parent);
|
---|
39 | }
|
---|
40 | }
|
---|