2
* Copyright 2005-2008 Kirill Grouchnikov, based on work by
3
* Sun Microsystems, Inc. All rights reserved.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
import java.awt.Component;
25
import javax.swing.plaf.ComponentUI;
27
import org.fest.swing.core.BasicRobot;
28
import org.fest.swing.core.Robot;
29
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
30
import org.pushingpixels.substance.api.SubstanceSkin;
31
import org.pushingpixels.substance.api.skin.SkinInfo;
32
import org.pushingpixels.substance.swingx.SubstanceErrorPaneUI;
35
* The main method for taking screenshots for Substance documentation.
37
* @author Kirill Grouchnikov
39
public class ErrorPaneRunner {
40
public static class MyErrorPaneUI extends SubstanceErrorPaneUI {
41
public static ComponentUI createUI(JComponent c) {
42
return new MyErrorPaneUI();
46
public JDialog getErrorDialog(Component owner) {
47
JDialog result = super.getErrorDialog(owner);
48
result.setModal(false);
54
* Runs the specified screenshot robot.
60
public static void main(String[] args) throws Exception {
61
JFrame.setDefaultLookAndFeelDecorated(true);
62
UIManager.put("ErrorPaneUI", MyErrorPaneUI.class.getName());
64
String subfolder = "errorpane";
65
Map<String, SkinInfo> skins = SubstanceLookAndFeel.getAllSkins();
66
Robot robot = BasicRobot.robotWithNewAwtHierarchy();
67
for (Map.Entry<String, SkinInfo> skinEntry : skins.entrySet()) {
68
String key = skinEntry.getKey();
69
String normalized = key.toLowerCase().replaceAll(" ", "");
70
new ErrorPaneRobot((SubstanceSkin) Class.forName(
71
skinEntry.getValue().getClassName()).newInstance(),
72
"C:/jprojects/substance-swingx/www/images/" + subfolder
73
+ "/" + normalized, robot).run();