1 19 20 package org.netbeans.modules.tasklist.core.editors; 21 22 import java.beans.PropertyEditorSupport ; 23 import javax.swing.JLabel ; 24 import javax.swing.SwingConstants ; 25 26 31 public final class ColumnPropertyEditor extends PropertyEditorSupport { 32 private static final JLabel LABEL = new JLabel (); 33 34 static { 35 LABEL.setHorizontalAlignment(SwingConstants.RIGHT); 36 } 37 38 public boolean isPaintable() { 39 return true; 40 } 41 42 public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { 43 if (getIntValue() <= 0) return; 44 45 gfx.translate(box.x, box.y); 46 LABEL.setText(String.valueOf(getIntValue())); 47 LABEL.setSize(box.width, box.height); 48 LABEL.paint(gfx); 49 gfx.translate(-box.x, -box.y); 50 } 51 52 57 private int getIntValue() { 58 Integer a = ((Integer ) getValue()); 59 if (a != null) 60 return a.intValue(); 61 else 62 return 0; 63 } 64 } 65 | Popular Tags |