Search in sources :

Example 1 with ColorChangedListener

use of net.sf.mzmine.framework.listener.ColorChangedListener in project mzmine2 by mzmine.

the class JFontSpecs method addListener.

public void addListener(final Consumer<FontSpecs> f) {
    ColorChangedListener ccl = e -> f.accept(getFontSpecs());
    ItemListener il = e -> f.accept(getFontSpecs());
    dl = new DelayedDocumentListener() {

        @Override
        public void documentChanged(DocumentEvent e) {
            f.accept(getFontSpecs());
        }
    };
    fontBox.addItemListener(il);
    styleBox.addItemListener(il);
    txtSize.getDocument().addDocumentListener(dl);
    color.addColorChangedListener(ccl);
}
Also used : Color(java.awt.Color) DocumentListener(javax.swing.event.DocumentListener) JTextField(javax.swing.JTextField) Font(java.awt.Font) ItemListener(java.awt.event.ItemListener) SwingConstants(javax.swing.SwingConstants) Consumer(java.util.function.Consumer) DelayedDocumentListener(net.sf.mzmine.framework.listener.DelayedDocumentListener) Paint(java.awt.Paint) ColorChangedListener(net.sf.mzmine.framework.listener.ColorChangedListener) DocumentEvent(javax.swing.event.DocumentEvent) JPanel(javax.swing.JPanel) JColorPickerButton(net.sf.mzmine.framework.JColorPickerButton) ColorChangedListener(net.sf.mzmine.framework.listener.ColorChangedListener) DelayedDocumentListener(net.sf.mzmine.framework.listener.DelayedDocumentListener) ItemListener(java.awt.event.ItemListener) DocumentEvent(javax.swing.event.DocumentEvent)

Aggregations

Color (java.awt.Color)1 Font (java.awt.Font)1 Paint (java.awt.Paint)1 ItemListener (java.awt.event.ItemListener)1 Consumer (java.util.function.Consumer)1 JPanel (javax.swing.JPanel)1 JTextField (javax.swing.JTextField)1 SwingConstants (javax.swing.SwingConstants)1 DocumentEvent (javax.swing.event.DocumentEvent)1 DocumentListener (javax.swing.event.DocumentListener)1 JColorPickerButton (net.sf.mzmine.framework.JColorPickerButton)1 ColorChangedListener (net.sf.mzmine.framework.listener.ColorChangedListener)1 DelayedDocumentListener (net.sf.mzmine.framework.listener.DelayedDocumentListener)1