/** * Called whenever the value of the selection changes. * * @param e the event that characterizes the change. */ public void valueChanged( final ListSelectionEvent e ) { fireChangeEvent(); }
/** * Invoked when the target of the listener has changed its state. * * @param e a ChangeEvent object */ public void stateChanged( final ChangeEvent e ) { final String fontName = basicFontPropertiesPane.getFontFamily(); final int fontSize = basicFontPropertiesPane.getFontSize(); final int fontStyle = basicFontPropertiesPane.getFontStyle(); setValue( new Font( fontName, fontStyle, fontSize ) ); } }
/** * A PropertyEditor may choose to make available a full custom Component that edits its property value. It is the * responsibility of the PropertyEditor to hook itself up to its editor Component itself and to report property value * changes by firing a PropertyChange event. * <p/> * The higher-level code that calls getCustomEditor may either embed the Component in some larger property sheet, or * it may put it in its own individual dialog, or ... * * @return A java.awt.Component that will allow a human to directly edit the current property value. May be null if * this is not supported. */ public Component getCustomEditor() { if ( basicFontPropertiesPane == null ) { basicFontPropertiesPane = new BasicFontPropertiesPane(); basicFontPropertiesPane.setExtendedFontPropertiesShowing( false ); basicFontPropertiesPane.init(); basicFontPropertiesPane.addChangeListener( new FontPropertiesHandler() ); } if ( font != null ) { basicFontPropertiesPane.setFontFamily( font.getFamily() ); basicFontPropertiesPane.setFontStyle( font.getStyle() ); basicFontPropertiesPane.setFontSize( font.getSize() ); } return basicFontPropertiesPane; }
setLayout( new GridBagLayout() ); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets( 5, 5, 0, 5 ); add( new JLabel( Messages.getInstance().getString( "BasicFontPropertiesPane.FontFamily" ) ), gbc ); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets( 5, 5, 0, 5 ); add( new JLabel( Messages.getInstance().getString( "BasicFontPropertiesPane.FontStyle" ) ), gbc ); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets( 5, 5, 0, 5 ); add( new JLabel( Messages.getInstance().getString( "BasicFontPropertiesPane.FontSize" ) ), gbc ); gbc.weightx = 1; gbc.insets = new Insets( 5, 5, 0, 5 ); add( fontFamilyTextBox, gbc ); gbc.weighty = 1; gbc.insets = new Insets( 0, 5, 5, 5 ); add( new JScrollPane( fontFamilyList ), gbc ); gbc.weighty = 1; gbc.insets = new Insets( 5, 5, 5, 5 ); add( new JScrollPane( fontStyleList ), gbc ); gbc.weightx = 1; gbc.insets = new Insets( 5, 5, 0, 5 ); add( fontSizeTextBox, gbc );
public BasicFontPropertiesPane() { eventListenerList = new EventListenerList(); final FontNameUpdateHandler nameUpdateHandler = new FontNameUpdateHandler(); fontFamilyTextBox = new JTextField(); fontFamilyTextBox.getDocument().addDocumentListener( nameUpdateHandler ); fontFamilyList = new JList( createFontNameModel() ); fontFamilyList.addListSelectionListener( nameUpdateHandler ); final FontSizeUpdateHandler sizeUpdateHandler = new FontSizeUpdateHandler(); fontSizeTextBox = new JTextField(); fontSizeTextBox.getDocument().addDocumentListener( sizeUpdateHandler ); fontSizeList = new JList( createFontSizeModel() ); fontSizeList.addListSelectionListener( sizeUpdateHandler ); fontStyleList = new JList( createFontStyleModel() ); fontStyleList.getSelectionModel().addListSelectionListener( new FontStyleUpdateHandler() ); extendedFontPropertiesShowing = true; underlineCheckbox = new JCheckBox( Messages.getInstance().getString( "BasicFontPropertiesPane.Underline" ) ); underlineCheckbox.addChangeListener( new FontStyleUpdateHandler() ); strikethroughCheckbox = new JCheckBox( Messages.getInstance().getString( "BasicFontPropertiesPane.Strikethrough" ) ); strikethroughCheckbox.addChangeListener( new FontStyleUpdateHandler() ); }
/** * Invoked when the target of the listener has changed its state. * * @param e a ChangeEvent object */ public void stateChanged( final ChangeEvent e ) { fireChangeEvent(); } }
public void valueChanged( final ListSelectionEvent e ) { if ( inUpdate ) { return; } try { inUpdate = true; final Object value = fontFamilyList.getSelectedValue(); if ( value != null ) { fontFamilyTextBox.setText( (String) value ); fireChangeEvent(); } } finally { inUpdate = false; } }
public void valueChanged( final ListSelectionEvent e ) { if ( inUpdate ) { return; } try { inUpdate = true; final Object value = fontSizeList.getSelectedValue(); if ( value != null ) { fontSizeTextBox.setText( String.valueOf( value ) ); } fireChangeEvent(); } finally { inUpdate = false; } }
private void updateFromTextField() { if ( inUpdate ) { return; } try { inUpdate = true; final String value = fontFamilyTextBox.getText(); if ( value != null && value.length() != 0 ) { fontFamilyList.setSelectedValue( value, true ); } fireChangeEvent(); } finally { inUpdate = false; } }
private void updateFromTextField() { if ( inUpdate ) { return; } try { inUpdate = true; final String value = fontSizeTextBox.getText(); if ( value != null && value.length() != 0 ) { try { fontSizeList.setSelectedValue( new Integer( value ), true ); } catch ( final NumberFormatException nfe ) { // ignore } fireChangeEvent(); } } finally { inUpdate = false; } }