Revision 10819 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/histogram/ui/HistogramIncrement.java
HistogramIncrement.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package org.gvsig.rastertools.histogram.ui; |
20 | 20 |
|
21 |
import java.awt.Dimension; |
|
22 |
import java.awt.FlowLayout; |
|
23 |
import java.awt.Toolkit; |
|
24 |
|
|
25 |
import javax.swing.JFrame; |
|
26 |
import javax.swing.JLabel; |
|
27 |
import javax.swing.JPanel; |
|
28 |
|
|
29 | 21 |
import org.cresques.i18n.Messages; |
22 |
import org.gvsig.gui.beans.progressPanel.ProgressPanel; |
|
30 | 23 |
import org.gvsig.rastertools.histogram.Histogram; |
31 | 24 |
/** |
32 | 25 |
* <code>HistogramIncrement</code>. Ventana de incremento para la construcci?n |
... | ... | |
39 | 32 |
public class HistogramIncrement extends Thread { |
40 | 33 |
private HistogramPanelListener histogramPanelListener = null; |
41 | 34 |
|
42 |
private JPanel panel = null; |
|
43 |
private JLabel label = null; |
|
44 |
private JFrame window = new JFrame(); |
|
35 |
private ProgressPanel window = new ProgressPanel(); |
|
45 | 36 |
|
46 | 37 |
/** |
47 | 38 |
* Constructor del <code>HistogramIncrement</code>. |
... | ... | |
56 | 47 |
* histograma. |
57 | 48 |
*/ |
58 | 49 |
public void showWindow(){ |
59 |
window.getContentPane().add(getJPanel()); |
|
60 |
Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); |
|
61 |
window.setLocation( ((int)d.getWidth()) >> 1, |
|
62 |
((int)d.getHeight()) >> 1); |
|
63 |
window.setSize(200, 60); |
|
50 |
window.setTitle("Actualizando datos"); |
|
51 |
window.showLog(true); |
|
64 | 52 |
window.show(); |
53 |
|
|
65 | 54 |
if(this.isAlive()) |
66 | 55 |
this.resume(); |
67 | 56 |
else |
... | ... | |
69 | 58 |
} |
70 | 59 |
|
71 | 60 |
/** |
72 |
* Obtiene el panel del interior de la ventana de incremento |
|
73 |
* @return JPanel |
|
74 |
*/ |
|
75 |
private JPanel getJPanel(){ |
|
76 |
if (panel == null){ |
|
77 |
FlowLayout f = new FlowLayout(); |
|
78 |
panel = new JPanel(); |
|
79 |
panel.setLayout(f); |
|
80 |
label = new JLabel(); |
|
81 |
label.setText(Messages.getText("calculando... ") + 0 + "%"); |
|
82 |
panel.add(label, null); |
|
83 |
} |
|
84 |
return panel; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 | 61 |
* Este thread va leyendo el porcentaje hasta que se completa el histograma. |
89 | 62 |
*/ |
90 | 63 |
public synchronized void run(){ |
91 | 64 |
while(true){ |
92 | 65 |
Histogram hist = this.getHistogramPanelListener().getHistogram(); |
93 | 66 |
while (hist.getPercent() < 100){ |
94 |
label.setText(Messages.getText("calculando ...") + hist.getPercent() +"%"); |
|
67 |
window.setLabel(Messages.getText("calculando ...") + hist.getPercent() +"%"); |
|
68 |
window.setPercent(hist.getPercent()); |
|
95 | 69 |
try { |
96 | 70 |
sleep(100); |
97 | 71 |
} catch (InterruptedException e) { |
Also available in: Unified diff