package jtaDiscRack.presentation.delements;
import jtaDiscRack.*;
import javax.swing.*;
import java.awt.*;
import java.net.URL;
/**
* The button.
*
* @author Sasa Bojanic
* @version 1.0
*/
public class DButton extends JButton {
/**
* Creates 'push' button with specified attributes.
*
* @param name the name to be written on the button.
* @param keyToIcon when an <i>imageSuffix</i> is added to
* this keyword, it presents the resource
* path keyword within property file. This
* resource represents an image file.
* @param d dimension of button.
*/
public DButton (String name,String keyToIcon,Dimension d) {
super(name);
URL u = ResourceManager.getResource(keyToIcon+"Image");
if (u!=null) {
setIcon(new ImageIcon(u));
}
setVerticalTextPosition(AbstractButton.CENTER);
Insets i=getInsets();
Dimension di=new Dimension(d);
di.width=di.width+i.left+i.right;
di.height=di.height+i.top+i.bottom;
setMinimumSize(new Dimension(di));
setMaximumSize(new Dimension(di));
setPreferredSize(new Dimension(di));
}
}
|