public void actionPerformed(final ActionEvent evt) { getSelector().transferFocus(); } });
/** * Allow the user to change the outline stroke. */ private void attemptOutlineStrokeSelection() { StrokeChooserPanel panel = new StrokeChooserPanel( this.outlineStrokeSample, this.availableStrokeSamples); int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { this.outlineStrokeSample.setStroke(panel.getSelectedStroke()); } }
/** * 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(); } }); }
/** * 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(); } }); }
public void actionPerformed(final ActionEvent evt) { getSelector().transferFocus(); } });
/** * Handle a grid stroke selection. */ private void attemptGridStrokeSelection() { StrokeChooserPanel panel = new StrokeChooserPanel(this.gridStrokeSample, this.availableStrokeSamples); int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { this.gridStrokeSample.setStroke(panel.getSelectedStroke()); } }
public void actionPerformed(final ActionEvent evt) { getSelector().transferFocus(); } });