Java Code Examples for javax.swing.JComponent#addPropertyChangeListener()
The following examples show how to use
javax.swing.JComponent#addPropertyChangeListener() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: FlatLaf File: FlatToolTipUI.java License: Apache License 2.0 | 6 votes |
@Override protected void installListeners( JComponent c ) { super.installListeners( c ); if( sharedPropertyChangedListener == null ) { sharedPropertyChangedListener = e -> { String name = e.getPropertyName(); if( name == "text" || name == "font" || name == "foreground" ) { JToolTip toolTip = (JToolTip) e.getSource(); FlatLabelUI.updateHTMLRenderer( toolTip, toolTip.getTipText(), false ); } }; } c.addPropertyChangeListener( sharedPropertyChangedListener ); }
Example 2
Source Project: FlatLaf File: MigLayoutVisualPadding.java License: Apache License 2.0 | 6 votes |
/** * Invokes the given function to retrieve the actual visual paddings and sets * the client property. Also adds property change listener to component and * re-invokes the function if one of the given properties have changed. */ public static void install( JComponent c, Function<JComponent, Insets> getPaddingFunction, String... propertyNames ) { if( !migLayoutAvailable ) return; // set client property setVisualPadding( c, getPaddingFunction.apply( c ) ); // add listener c.addPropertyChangeListener( (FlatMigListener) e -> { String propertyName = e.getPropertyName(); for( String name : propertyNames ) { if( name == propertyName ) { setVisualPadding( c, getPaddingFunction.apply( c ) ); break; } } } ); }
Example 3
Source Project: pumpernickel File: PaletteUI.java License: MIT License | 6 votes |
@Override public void installUI(JComponent c) { super.installUI(c); c.addPropertyChangeListener(JPalette.PROPERTY_COLORS, propertyLayoutListener); c.addPropertyChangeListener(PaletteUI.PROPERTY_HIGHLIGHT, propertyRepaintListener); c.setLayout(new PaletteLayoutManager()); c.setRequestFocusEnabled(true); c.addMouseListener(mouseListener); c.addFocusListener(focusListener); c.addKeyListener(keyListener); c.setFocusable(true); Fields fields = getFields((JPalette) c, true); fields.install(); c.setBorder(new CompoundBorder(new LineBorder(new Color(0xB0B0B0)), new FocusedBorder(getDefaultBorder()))); relayoutCells((JPalette) c); }
Example 4
Source Project: pdfxtk File: PrefPropertyWatcher.java License: Apache License 2.0 | 6 votes |
public synchronized Serializable watch(Object o, Serializable preferences) { JComponent component = (JComponent)o; result = preferences == null ? new PropertyState(property, component) : (PropertyState)preferences; component.addPropertyChangeListener(property, new PropertyChangeListener() { PropertyState state = result; public void propertyChange(PropertyChangeEvent e) { System.out.println(e); state.grab(e.getNewValue()); } }); if(preferences != null) result.apply(component); return result; }
Example 5
Source Project: Data_Processor File: UnicornTreeUI.java License: Apache License 2.0 | 5 votes |
public void installUI( JComponent c ) { super.installUI( c ); lineColor = UIManager.getColor( "Tree.line" ); Object lineStyleFlag = c.getClientProperty( LINE_STYLE ); decodeLineStyle(lineStyleFlag); c.addPropertyChangeListener(lineStyleListener); }
Example 6
Source Project: pumpernickel File: AnimatedLayout.java License: MIT License | 5 votes |
private void registerChildren(JComponent c) { String key = "animatedLayout.propertyListener"; for (int a = 0; a < c.getComponentCount(); a++) { JComponent child = (JComponent) c.getComponent(a); if (child.getClientProperty(key) == null) { child.putClientProperty(key, destinationListener); child.addPropertyChangeListener(PROPERTY_DESTINATION, destinationListener); } } }
Example 7
Source Project: pumpernickel File: QOptionPaneUI.java License: MIT License | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); c.addPropertyChangeListener(optionPanePropertyListener); QOptionPane optionPane = (QOptionPane) c; installComponents(optionPane); updateCustomComponent(optionPane); updateIcon(optionPane); updateMainMessage(optionPane); updateSecondaryMessage(optionPane); updateFooter(optionPane); updateDialogTitle(optionPane); }
Example 8
Source Project: pumpernickel File: MultiThumbSliderUI.java License: MIT License | 5 votes |
@Override public void installUI(JComponent slider) { slider.addMouseListener(this); slider.addMouseMotionListener(this); slider.addFocusListener(focusListener); slider.addKeyListener(keyListener); slider.addComponentListener(compListener); slider.addPropertyChangeListener(propertyListener); slider.addPropertyChangeListener(THUMB_SHAPE_PROPERTY, thumbShapeListener); calculateGeometry(); }
Example 9
Source Project: pumpernickel File: BasicAudioPlayerUI.java License: MIT License | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); getFields(c).install(); c.addPropertyChangeListener(AudioPlayerComponent.SOURCE_KEY, updateSourceListener); c.addHierarchyListener(hierarchyListener); }
Example 10
Source Project: pumpernickel File: SubtleScrollBarUI.java License: MIT License | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); c.setOpaque(false); c.addPropertyChangeListener("opaque", opaqueListener); trackColor = new Color(trackColor.getRed(), trackColor.getGreen(), trackColor.getBlue(), 0); c.addPropertyChangeListener(PROPERTY_ROLLOVER_BOOLEAN, rolloverListener); c.addFocusListener(focusListener); refreshActive(); refreshBorder(); }
Example 11
Source Project: pumpernickel File: AudioPlayerUI.java License: MIT License | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); installDefaultSource((AudioPlayerComponent) c); c.addPropertyChangeListener(AudioPlayerComponent.PLAYER_KEY, audioPlayerListener); }
Example 12
Source Project: pumpernickel File: BreadCrumbUI.java License: MIT License | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); c.addMouseListener(mouseListener); c.addPropertyChangeListener(JBreadCrumb.PATH_KEY, refreshUIListener); c.addPropertyChangeListener(JBreadCrumb.FORMATTER_KEY, refreshUIListener); c.addPropertyChangeListener(PROPERTY_SEPARATOR_ICON, refreshUIListener); refreshUI((JBreadCrumb<?>) c); }
Example 13
Source Project: mzmine2 File: ShapeModelerSetupDialog.java License: GNU General Public License v2.0 | 5 votes |
/** * @param parameters * @param massDetectorTypeNumber */ public ShapeModelerSetupDialog(Window parent, boolean valueCheckRequired, ShapeModelerParameters parameters) { super(parent, valueCheckRequired, parameters); // Parameters of local mass detector to get preview values smParameters = parameters; // Set a listener in all parameters's fields to add functionality to // this dialog for (Parameter<?> p : smParameters.getParameters()) { if ((p.getName().equals(ShapeModelerParameters.suffix.getName())) || (p.getName().equals(ShapeModelerParameters.autoRemove.getName()))) continue; JComponent field = getComponentForParameter(p); if (field == null) continue; field.addPropertyChangeListener("value", this); if (field instanceof JCheckBox) ((JCheckBox) field).addActionListener(this); if (field instanceof JComboBox) ((JComboBox<?>) field).addActionListener(this); } addComponents(); }
Example 14
Source Project: PyramidShader File: MultiThumbSliderUI.java License: GNU General Public License v3.0 | 5 votes |
@Override public void installUI(JComponent slider) { slider.addMouseListener(this); slider.addMouseMotionListener(this); slider.addFocusListener(focusListener); slider.addKeyListener(keyListener); slider.addComponentListener(compListener); slider.addPropertyChangeListener(propertyListener); slider.addPropertyChangeListener(THUMB_SHAPE_PROPERTY, thumbShapeListener); calculateGeometry(); }
Example 15
Source Project: pumpernickel File: AquaOpenLocationPaneUI.java License: MIT License | 4 votes |
@Override protected void installGUI(JComponent panel) { panel.addPropertyChangeListener(KEY_INCLUDE_SIDEBAR, propertyChangeListener); if (sourceList.isEmpty()) { File[] array1 = CommonFiles.getUserDirectories(true); IOLocation[] array2 = new FileLocation[array1.length]; for (int a = 0; a < array1.length; a++) { array2[a] = LocationFactory.get().create(array1[a]); } sourceList.add(array2); } boolean includeSidebar = getBoolean(locationPane, KEY_INCLUDE_SIDEBAR, true); boolean includeFooter = getBoolean(locationPane, KEY_INCLUDE_FOOTER, true); panel.removeAll(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(4, 0, 4, 0); panel.add(controls, c); c.gridy++; c.weighty = 1; c.fill = GridBagConstraints.BOTH; if (includeSidebar) { splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sourceListScrollPane, browser); panel.add(splitPane, c); } else { panel.add(browser, c); } if (includeFooter) { c.weighty = 0; c.gridy++; panel.add(footer, c); } sourceListScrollPane.setMinimumSize(new Dimension(100, 40)); sourceListScrollPane.setPreferredSize(new Dimension(150, 40)); }
Example 16
Source Project: seaglass File: SeaGlassViewportUI.java License: Apache License 2.0 | 4 votes |
protected void installListeners(JComponent c) { c.addPropertyChangeListener(this); }
Example 17
Source Project: seaglass File: SeaGlassToolTipUI.java License: Apache License 2.0 | 4 votes |
/** * @inheritDoc */ @Override protected void installListeners(JComponent c) { c.addPropertyChangeListener(this); }
Example 18
Source Project: PolyGlot File: PToolTipUI.java License: MIT License | 4 votes |
protected void installListeners(JComponent c) { propertyChangeListener = createPropertyChangeListener(c); c.addPropertyChangeListener(propertyChangeListener); }