/*
 *
 * Copyright (C) 8 sept. 2003  Jean-Yves Beaujean 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,  59
 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.

 * 
 */
package jxtray.swing;

import javax.swing.JButton;
import javax.swing.SwingConstants;
import javax.swing.ImageIcon;

import java.awt.event.ActionListener;
import java.awt.Insets;

import jxtray.Jxtray;




public class JxtButton extends JButton 
{
		public JxtButton()
		{
			super();
			this.setHorizontalTextPosition(SwingConstants.CENTER);
			this.setFont(Jxtray.getFont());
			apparence();
		}
		
		
		public JxtButton(String text)
		{
			super(text);
			this.setToolTipText(text);
			this.setFont(Jxtray.getFont());
			this.setHorizontalTextPosition(SwingConstants.CENTER);
			apparence();
		}
		
		public JxtButton(String text, ActionListener listener, String actionCommand)
		{
			super(text);
			this.setFont(Jxtray.getFont());
			this.setHorizontalTextPosition(SwingConstants.CENTER);
			this.addActionListener(listener);
			this.setActionCommand(actionCommand);
			apparence();
		}
		
		public JxtButton(ImageIcon icon, String text, ActionListener listener, String actionCommand)
		{
			//super(text);
			this.setToolTipText(text);
			this.setIcon(icon);
			this.setFont(Jxtray.getFont());
			this.setHorizontalTextPosition(SwingConstants.CENTER);
			this.addActionListener(listener);
			this.setActionCommand(actionCommand);
			this.setFocusPainted(false);
			apparence();
		}	
		
		private void apparence()
		{
			this.setMargin(new Insets(3,3,3,3));
		}
		
		
}
