1 package discRack.presentation.delements; 2 3 import discRack.*; 4 import discRack.presentation.*; 5 6 import javax.swing.*; 7 import javax.swing.border.*; 8 9 import java.awt.*; 10 import java.net.URL ; 11 12 18 public class DButton extends JButton { 19 20 30 public DButton (String name,String keyToIcon,Dimension d) { 31 32 super(name); 33 34 URL u = ResourceManager.getResource(keyToIcon+"Image"); 35 if (u!=null) { 36 setIcon(new ImageIcon(u)); 37 } 38 39 setVerticalTextPosition(AbstractButton.CENTER); 40 Insets i=getInsets(); 41 Dimension di=new Dimension(d); 42 di.width=di.width+i.left+i.right; 43 di.height=di.height+i.top+i.bottom; 44 45 setMinimumSize(new Dimension(di)); 46 setMaximumSize(new Dimension(di)); 47 setPreferredSize(new Dimension(di)); 48 49 } 50 51 } 52 | Popular Tags |