001: /*
002: * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of Substance Kirill Grouchnikov nor the names of
015: * its contributors may be used to endorse or promote products derived
016: * from this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030: package test;
031:
032: import java.awt.Dimension;
033: import java.awt.FlowLayout;
034:
035: import javax.swing.*;
036:
037: import org.jvnet.substance.SubstanceLookAndFeel;
038: import org.jvnet.substance.shaperpack.button.*;
039: import org.jvnet.substance.theme.*;
040:
041: public class TestButtons extends JFrame {
042: private JButton getButton(String text, Class buttonShaperClass,
043: SubstanceTheme theme) {
044: JButton button = new JButton(text);
045: button.putClientProperty(
046: SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY,
047: buttonShaperClass.getName());
048: button.putClientProperty(
049: SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY,
050: Boolean.TRUE);
051: button.putClientProperty(SubstanceLookAndFeel.THEME_PROPERTY,
052: theme.getDisplayName());
053: return button;
054: }
055:
056: public TestButtons() {
057: super ("Button shapes");
058: this .setLayout(new FlowLayout(FlowLayout.CENTER));
059: this .add(this .getButton("rhino", RhinoButtonShaper.class,
060: new SubstanceSteelBlueTheme()));
061: this .add(this .getButton("big rhino", RhinoButtonShaper.class,
062: new SubstanceSteelBlueTheme()));
063: this
064: .add(this .getButton("<html>rhino<br>rhino</html>",
065: RhinoButtonShaper.class,
066: new SubstanceSteelBlueTheme()));
067:
068: this .add(this .getButton("fish", FishButtonShaper.class,
069: new SubstanceAquaTheme()));
070: this .add(this .getButton("big fish", FishButtonShaper.class,
071: new SubstanceAquaTheme()));
072: this .add(this .getButton("<html>fish<br>fish</html>",
073: FishButtonShaper.class, new SubstanceAquaTheme()));
074:
075: this .add(this .getButton("racecar", RaceCarButtonShaper.class,
076: new SubstanceSunsetTheme()));
077: this .add(this .getButton("big racecar",
078: RaceCarButtonShaper.class, new SubstanceSunsetTheme()));
079: this .add(this .getButton("<html>racecar<br>racecar</html>",
080: RaceCarButtonShaper.class, new SubstanceSunsetTheme()));
081:
082: this .add(this .getButton("butterfly",
083: ButterflyButtonShaper.class,
084: new SubstanceBarbyPinkTheme()));
085: this .add(this .getButton("big butterfly",
086: ButterflyButtonShaper.class,
087: new SubstanceBarbyPinkTheme()));
088: this .add(this .getButton("<html>butterfly<br>butterfly</html>",
089: ButterflyButtonShaper.class,
090: new SubstanceBarbyPinkTheme()));
091:
092: this .add(this .getButton("foot", FootButtonShaper.class,
093: new SubstanceTerracottaTheme()));
094: this .add(this .getButton("big foot", FootButtonShaper.class,
095: new SubstanceTerracottaTheme()));
096: this
097: .add(this .getButton("<html>foot<br>foot</html>",
098: FootButtonShaper.class,
099: new SubstanceTerracottaTheme()));
100:
101: this .add(this .getButton("icecream", IceCreamButtonShaper.class,
102: new SubstanceRaspberryTheme()));
103: this .add(this .getButton("big icecream",
104: IceCreamButtonShaper.class,
105: new SubstanceRaspberryTheme()));
106: this .add(this .getButton("<html>icecream<br>icecream</html>",
107: IceCreamButtonShaper.class,
108: new SubstanceRaspberryTheme()));
109:
110: this .add(this .getButton("stegosaurus",
111: StegosaurusButtonShaper.class,
112: new SubstanceBottleGreenTheme()));
113: this .add(this .getButton("big stegosaurus",
114: StegosaurusButtonShaper.class,
115: new SubstanceBottleGreenTheme()));
116: this .add(this .getButton(
117: "<html>stegosaurus<br>stegosaurus</html>",
118: StegosaurusButtonShaper.class,
119: new SubstanceBottleGreenTheme()));
120:
121: this .add(this .getButton("dolphin", DolphinButtonShaper.class,
122: new SubstanceAquaTheme()));
123: this .add(this .getButton("big dolphin",
124: DolphinButtonShaper.class, new SubstanceAquaTheme()));
125: this .add(this .getButton("<html>dolphin<br>dolphin</html>",
126: DolphinButtonShaper.class, new SubstanceAquaTheme()));
127:
128: this .add(new JButton("simple"));
129: this .add(new JButton("big simple"));
130: this .add(new JButton("<html>simple<br>simple</html>"));
131: }
132:
133: public static void main(String... args) {
134: try {
135: UIManager.setLookAndFeel(new SubstanceLookAndFeel());
136: } catch (Exception exc) {
137: }
138: JFrame.setDefaultLookAndFeelDecorated(true);
139: TestButtons tb = new TestButtons();
140: tb.setPreferredSize(new Dimension(600, 520));
141: tb.setSize(tb.getPreferredSize());
142: tb.setLocation(250, 150);
143: tb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
144: tb.setVisible(true);
145: }
146: }
|