1 43 44 package org.jfree.ui; 45 46 import java.awt.Insets ; 47 import java.util.ResourceBundle ; 48 49 import javax.swing.JTextField ; 50 51 56 public class InsetsTextField extends JTextField { 57 58 59 protected static ResourceBundle localizationResources = 60 ResourceBundle.getBundle("org.jfree.ui.LocalizationBundle"); 61 62 68 public InsetsTextField(final Insets insets) { 69 super(); 70 setInsets(insets); 71 setEnabled(false); 72 } 73 74 81 public String formatInsetsString(Insets insets) { 82 insets = (insets == null) ? new Insets (0, 0, 0, 0) : insets; 83 return 84 localizationResources.getString("T") + insets.top + ", " 85 + localizationResources.getString("L") + insets.left + ", " 86 + localizationResources.getString("B") + insets.bottom + ", " 87 + localizationResources.getString("R") + insets.right; 88 } 89 90 97 public void setInsets(final Insets insets) { 98 setText(formatInsetsString(insets)); 99 } 100 101 } 102 | Popular Tags |