001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: KToggleButton.java,v $
023   Revision 1.5  2004/05/12 19:08:30  markl
024   comment block updates
025
026   Revision 1.4  2004/03/20 05:14:47  markl
027   code cleanup
028
029   Revision 1.3  2003/01/19 09:50:53  markl
030   Javadoc & comment header updates.
031
032   Revision 1.2  2001/03/12 09:27:57  markl
033   Source code and Javadoc cleanup.
034
035   Revision 1.1  2000/10/11 10:45:57  markl
036   New class.
037   ----------------------------------------------------------------------------
038*/
039
040package kiwi.ui;
041
042import javax.swing.*;
043
044import kiwi.util.KiwiUtils;
045
046/** A trivial extension to <code>JToggleButton</code> that performs some simple
047 * customizations.
048 *
049 * @see javax.swing.JToggleButton
050 *
051 * @author Mark Lindner
052 */
053
054public class KToggleButton extends JToggleButton
055  {
056  
057  /** Construct a new <code>KToggleButton</code>. A new, transparent button
058   * will be created.
059   *
060   * @param text The text to display in the button.
061   */
062  
063  public KToggleButton(String text)
064    {
065    super(text);
066
067    _init();
068    }
069
070  /** Construct a new <code>KToggleButton</code>. A new, transparent button
071   * will be created.
072   *
073   * @param text The text to display in the button.
074   * @param icon The icon to display in the button.
075   */
076
077  public KToggleButton(String text, Icon icon)
078    {
079    super(text, icon);
080
081    _init();
082    }
083
084  /** Construct a new <code>KToggleButton</code>. A new, transparent button
085   * will be created with zero-pixel margins and focus painting turned off.
086   *
087   * @param icon The icon to display in the button.
088   */
089
090  public KToggleButton(Icon icon)
091    {
092    super(icon);
093
094    _init();
095    }
096
097  /*
098   */
099
100  private void _init()
101    {
102    setOpaque(!UIChangeManager.getInstance().getButtonsAreTransparent());
103    }
104
105  }
106
107/* end of source file */