public LabeledTextField(boolean isIndentedLabel, String label, String format) { super(); super.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); tag = new JLabel(label); if (isIndentedLabel) { JPanel tag_panel = new JPanel(); tag_panel.setLayout(new BoxLayout(tag_panel, BoxLayout.X_AXIS)); tag_panel.add(Box.createHorizontalStrut(Const.LABEL_INDENTATION)); tag_panel.add(tag); tag_panel.add(Box.createHorizontalGlue()); tag_panel.setAlignmentX(Component.LEFT_ALIGNMENT); super.add(tag_panel); } else { tag.setAlignmentX(Component.LEFT_ALIGNMENT); super.add(tag); } fld = new ActableTextField(); tag.setLabelFor(fld); fld.setAlignmentX(Component.LEFT_ALIGNMENT); super.add(fld); // preferred_height = fld.getPreferredSize().height + this.TEXT_HEIGHT; if (format != null) { int num_col; fmt = (DecimalFormat) NumberFormat.getInstance(); fmt.applyPattern(format); num_col = Routines.getAdjNumOfTextColumns(fld, format.length()); fld.setColumns(num_col); } else fmt = null; /* No self DocumentListener by default */ self_listener = null; // tag.setBorder( BorderFactory.createEtchedBorder() ); fld.setBorder(BorderFactory.createEtchedBorder()); if (FONT != null) { tag.setFont(FONT); fld.setFont(FONT); } }