/** * Creates a panel containing a combo-box that allows the user to select * one stroke from a list of available strokes. * * @param current the current stroke sample. * @param available an array of 'available' stroke samples. */ public StrokeChooserPanel(final StrokeSample current, final StrokeSample[] available) { setLayout(new BorderLayout()); this.selector = new JComboBox(available); this.selector.setSelectedItem(current); this.selector.setRenderer(new StrokeSample(new BasicStroke(1))); add(this.selector); // Changes due to focus problems!! DZ this.selector.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { getSelector().transferFocus(); } }); }
/** * Creates a panel containing a combo-box that allows the user to select * one stroke from a list of available strokes. * * @param current the current stroke sample. * @param available an array of 'available' stroke samples. */ public StrokeChooserPanel(StrokeSample current, StrokeSample[] available) { setLayout(new BorderLayout()); // we've changed the behaviour here to populate the combo box // with Stroke objects directly - ideally we'd change the signature // of the constructor too...maybe later. DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < available.length; i++) { model.addElement(available[i].getStroke()); } this.selector = new JComboBox(model); this.selector.setSelectedItem(current.getStroke()); this.selector.setRenderer(new StrokeSample(null)); add(this.selector); // Changes due to focus problems!! DZ this.selector.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { getSelector().transferFocus(); } }); }
this.gridStrokeSample = new StrokeSample(new BasicStroke(1.0f)); this.availableStrokeSamples[0] = new StrokeSample( new BasicStroke(1.0f)); this.availableStrokeSamples[1] = new StrokeSample( new BasicStroke(2.0f)); this.availableStrokeSamples[2] = new StrokeSample( new BasicStroke(3.0f));
/** * Creates a panel containing a combo-box that allows the user to select * one stroke from a list of available strokes. * * @param current the current stroke sample. * @param available an array of 'available' stroke samples. */ public StrokeChooserPanel(StrokeSample current, StrokeSample[] available) { setLayout(new BorderLayout()); // we've changed the behaviour here to populate the combo box // with Stroke objects directly - ideally we'd change the signature // of the constructor too...maybe later. DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < available.length; i++) { model.addElement(available[i].getStroke()); } this.selector = new JComboBox(model); this.selector.setSelectedItem(current.getStroke()); this.selector.setRenderer(new StrokeSample(null)); add(this.selector); // Changes due to focus problems!! DZ this.selector.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { getSelector().transferFocus(); } }); }
this.plotInsets = plot.getInsets(); this.backgroundPaintSample = new PaintSample(plot.getBackgroundPaint()); this.outlineStrokeSample = new StrokeSample(plot.getOutlineStroke()); this.outlinePaintSample = new PaintSample(plot.getOutlinePaint()); if (plot instanceof CategoryPlot) { this.availableStrokeSamples[0] = new StrokeSample(null); this.availableStrokeSamples[1] = new StrokeSample( new BasicStroke(1.0f)); this.availableStrokeSamples[2] = new StrokeSample( new BasicStroke(2.0f)); this.availableStrokeSamples[3] = new StrokeSample( new BasicStroke(3.0f));