Dépôt officiel du code source de l'ERP OpenConcerto
Rev 41 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.config;
import org.openconcerto.ui.ReloadPanel;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.SplashScreen;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class InProgressFrame extends JDialog {
public InProgressFrame() {
}
public void show(String title) {
try {
final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null) {
Graphics2D g = splash.createGraphics();
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
g.setColor(Color.WHITE);
g.fillRect(0, (int) splash.getSize().getHeight() - 24, (int) splash.getSize().getWidth(), 24);
g.setFont(g.getFont().deriveFont(Font.BOLD).deriveFont(11f));
g.setColor(Color.DARK_GRAY);
g.drawString(title, 20, ((int) splash.getSize().getHeight()) - 8);
splash.update();
return;
}
} catch (Throwable e) {
// OpenJDK bug on linux
e.printStackTrace();
}
setTitle("Veuillez patienter");
JPanel p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 5));
final ReloadPanel rlPanel = new ReloadPanel();
rlPanel.setMode(ReloadPanel.MODE_ROTATE);
p.add(new JLabel(title));
p.add(rlPanel);
setContentPane(p);
pack();
setLocationRelativeTo(null);
setVisible(true);
}
}