1 10 11 12 package org.enhydra.jawe.xml; 13 14 import javax.swing.*; 15 import javax.swing.border.*; 16 17 import java.awt.*; 18 import java.net.URL ; 19 20 25 public class XMLButton extends JButton { 26 27 37 public XMLButton (String name,String keyToIcon,Dimension d) { 38 39 super(name); 40 41 URL u = XMLUtil.getResource(keyToIcon+"Image"); 42 if (u!=null) { 43 setIcon(new ImageIcon(u)); 44 } 45 46 setVerticalTextPosition(AbstractButton.CENTER); 47 Insets i=getInsets(); 48 Dimension di=new Dimension(d); 49 di.width=di.width+i.left+i.right; 50 di.height=di.height+i.top+i.bottom; 51 52 setMinimumSize(new Dimension(di)); 53 setMaximumSize(new Dimension(di)); 54 setPreferredSize(new Dimension(di)); 55 56 } 57 58 } 59 60 61 | Popular Tags |