1 2 3 package org.krysalis.jcharts.designer.tabs.allChart.items; 4 5 6 import java.awt.FlowLayout ; 7 8 import javax.swing.BorderFactory ; 9 import javax.swing.JPanel ; 10 11 import org.krysalis.jcharts.designer.common.LabelledTextfield; 12 import org.krysalis.jcharts.designer.exceptions.DesignerException; 13 14 15 public class EdgePadding extends JPanel 16 { 17 private String title; 18 private LabelledTextfield padding; 19 20 21 25 public EdgePadding( String title ) 26 { 27 super(); 28 this.title= title; 29 30 super.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( this.title ), 31 BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) ) ); 32 33 this.setLayout( new FlowLayout () ); 34 35 this.padding = new LabelledTextfield( "Pixels:", 4 ); 36 this.padding.setText( Float.toString( 5 ) ); 37 this.add( this.padding ); 38 } 39 40 41 45 public float getEdgePadding() throws DesignerException 46 { 47 if( this.padding.getText().trim().equals( "" ) ) 48 { 49 throw new DesignerException( "Edge Padding can not be NULL." ); 50 } 51 52 return Float.parseFloat( this.padding.getText() ); 53 } 54 } 55 | Popular Tags |