01: package org.krysalis.jcharts.designer.tabs.allChart.items;
02:
03: import java.awt.FlowLayout;
04:
05: import javax.swing.BorderFactory;
06: import javax.swing.JPanel;
07:
08: import org.krysalis.jcharts.designer.common.LabelledTextfield;
09: import org.krysalis.jcharts.designer.exceptions.DesignerException;
10:
11: public class EdgePadding extends JPanel {
12: private String title;
13: private LabelledTextfield padding;
14:
15: /***********************************************************************************
16: *
17: * @param title
18: **********************************************************************************/
19: public EdgePadding(String title) {
20: super ();
21: this .title = title;
22:
23: super .setBorder(BorderFactory.createCompoundBorder(
24: BorderFactory.createTitledBorder(this .title),
25: BorderFactory.createEmptyBorder(5, 5, 5, 5)));
26:
27: this .setLayout(new FlowLayout());
28:
29: this .padding = new LabelledTextfield("Pixels:", 4);
30: this .padding.setText(Float.toString(5));
31: this .add(this .padding);
32: }
33:
34: /*********************************************************************************
35: *
36: * @return float
37: ********************************************************************************/
38: public float getEdgePadding() throws DesignerException {
39: if (this .padding.getText().trim().equals("")) {
40: throw new DesignerException("Edge Padding can not be NULL.");
41: }
42:
43: return Float.parseFloat(this.padding.getText());
44: }
45: }
|