List of usage examples for org.jfree.ui FontDisplayField FontDisplayField
public FontDisplayField(final Font font)
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultTitleEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified title.//from www .j a v a 2s .com * * @param title * the title, which should be changed. */ public DefaultTitleEditor(Title title) { if (title == null) { this.showTitle = false; this.titleFont = SimulationDiagramTheme.DEFAULT_TITLE_FONT; this.titleField = new JTextField(); this.titlePaint = new PaintSample(Color.BLACK); } else { TextTitle t = (TextTitle) title; this.showTitle = title.isVisible(); this.titleFont = t.getFont(); this.titleField = new JTextField(t.getText()); this.titlePaint = new PaintSample(t.getPaint()); } System.out.println(this.titleFont.getName()); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(4)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Show_Title"))); this.showTitleCheckBox = new JCheckBox(); this.showTitleCheckBox.setSelected(this.showTitle); this.showTitleCheckBox.setActionCommand("ShowTitle"); this.showTitleCheckBox.addActionListener(this); interior.add(new JPanel()); interior.add(this.showTitleCheckBox); JLabel titleLabel = new JLabel(localizationResources.getString("Text")); interior.add(titleLabel); interior.add(this.titleField); interior.add(new JPanel()); JLabel fontLabel = new JLabel(localizationResources.getString("Font")); this.fontfield = new FontDisplayField(this.titleFont); this.selectFontButton = new JButton(localizationResources.getString("Select...")); this.selectFontButton.setActionCommand("SelectFont"); this.selectFontButton.addActionListener(this); interior.add(fontLabel); interior.add(this.fontfield); interior.add(this.selectFontButton); JLabel colorLabel = new JLabel(localizationResources.getString("Color")); this.selectPaintButton = new JButton(localizationResources.getString("Select...")); this.selectPaintButton.setActionCommand("SelectPaint"); this.selectPaintButton.addActionListener(this); interior.add(colorLabel); interior.add(this.titlePaint); interior.add(this.selectPaintButton); this.enableOrDisableControls(); general.add(interior); add(general, BorderLayout.NORTH); }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified axis./* w ww. ja va2s.c om*/ * * @param axis * the axis whose properties are to be displayed/edited in the * panel. */ public DefaultAxisEditor(Axis axis) { this.labelFont = axis.getLabelFont(); this.labelPaintSample = new PaintSample(axis.getLabelPaint()); this.tickLabelFont = axis.getTickLabelFont(); this.tickLabelPaintSample = new PaintSample(axis.getTickLabelPaint()); // Insets values this.tickLabelInsets = axis.getTickLabelInsets(); this.labelInsets = axis.getLabelInsets(); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(5)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Label"))); this.label = new JTextField(axis.getLabel()); interior.add(this.label); interior.add(new JPanel()); interior.add(new JLabel(localizationResources.getString("Font"))); this.labelFontField = new FontDisplayField(this.labelFont); interior.add(this.labelFontField); JButton b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectLabelFont"); b.addActionListener(this); interior.add(b); interior.add(new JLabel(localizationResources.getString("Paint"))); interior.add(this.labelPaintSample); b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectLabelPaint"); b.addActionListener(this); interior.add(b); general.add(interior); add(general, BorderLayout.NORTH); this.slot1 = new JPanel(new BorderLayout()); JPanel other = new JPanel(new BorderLayout()); other.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("Other"))); this.otherTabs = new JTabbedPane(); this.otherTabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); JPanel ticks = new JPanel(new LCBLayout(3)); ticks.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.showTickLabelsCheckBox = new JCheckBox(localizationResources.getString("Show_tick_labels"), axis.isTickLabelsVisible()); ticks.add(this.showTickLabelsCheckBox); ticks.add(new JPanel()); ticks.add(new JPanel()); ticks.add(new JLabel(localizationResources.getString("Tick_label_font"))); this.tickLabelFontField = new FontDisplayField(this.tickLabelFont); ticks.add(this.tickLabelFontField); b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectTickLabelFont"); b.addActionListener(this); ticks.add(b); this.showTickMarksCheckBox = new JCheckBox(localizationResources.getString("Show_tick_marks"), axis.isTickMarksVisible()); ticks.add(this.showTickMarksCheckBox); ticks.add(new JPanel()); ticks.add(new JPanel()); this.otherTabs.add(localizationResources.getString("Ticks"), ticks); other.add(this.otherTabs); this.slot1.add(other); this.slot2 = new JPanel(new BorderLayout()); this.slot2.add(this.slot1, BorderLayout.NORTH); add(this.slot2); }