1   package org.wcb.gui.component;
2   
3   //import com.sun.java.swing.SwingUtilities2;
4   
5   import javax.swing.JButton;
6   import javax.swing.ImageIcon;
7   import javax.swing.plaf.ComponentUI;
8   import java.awt.Color;
9   
10  /**
11   * <small>
12   * <p/>
13   * Copyright (c)  2006  wbogaardt.
14   * This library is free software; you can redistribute it and/or
15   * modify it under the terms of the GNU Lesser General Public
16   * License as published by the Free Software Foundation; either
17   * version 2.1 of the License, or (at your option) any later version.
18   *
19   * This library is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22   * Lesser General Public License for more details.
23   *
24   * You should have received a copy of the GNU Lesser General Public
25   * License along with this library; if not, write to the Free Software
26   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27   * <p/>
28   * $File:  $ <br>
29   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Sep 12, 2006 10:31:10 AM $ <br>
30   * </small>
31   *
32   * @author wbogaardt
33   *         Creates a pretty wavey button.
34   */
35  
36  
37  public class WaveButton extends JButton {
38  
39      /**
40       * Creates a wave button with text.
41       * @param text text to display on button
42       */
43      public WaveButton(String text) {
44          super(text);
45          getUI().uninstallUI(this);
46          ComponentUI ui = WaveButtonUI.createUI(this);
47          setUI(ui);
48          //setBackground(new Color(183, 234, 98));
49          setBackground(new Color(0x522aec));
50          //putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, Boolean.TRUE);
51      }
52  
53      /**
54       * wave button with icon image.
55       * @param icon image to put on button.
56       */
57      public WaveButton(ImageIcon icon) {
58          super(icon);
59          getUI().uninstallUI(this);
60          ComponentUI ui = WaveButtonUI.createUI(this);
61          setUI(ui);
62          //setBackground(new Color(183, 234, 98));
63          setBackground(new Color(0x522aec));
64          //putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, Boolean.TRUE);
65      }
66  
67  }