javax.swing.JComponent#addPropertyChangeListener ( )源码实例Demo

下面列出了javax.swing.JComponent#addPropertyChangeListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FlatLaf   文件: FlatToolTipUI.java
@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 );
}
 
源代码2 项目: FlatLaf   文件: MigLayoutVisualPadding.java
/**
 * 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;
			}
		}
	} );
}
 
源代码3 项目: pumpernickel   文件: PaletteUI.java
@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);
}
 
源代码4 项目: pdfxtk   文件: PrefPropertyWatcher.java
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;
 }
 
源代码5 项目: Data_Processor   文件: UnicornTreeUI.java
public void installUI( JComponent c ) {
	super.installUI( c );
	lineColor = UIManager.getColor( "Tree.line" );

	Object lineStyleFlag = c.getClientProperty( LINE_STYLE );
	decodeLineStyle(lineStyleFlag);
	c.addPropertyChangeListener(lineStyleListener);

}
 
源代码6 项目: pumpernickel   文件: AnimatedLayout.java
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);
		}
	}
}
 
源代码7 项目: pumpernickel   文件: QOptionPaneUI.java
@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);
}
 
源代码8 项目: pumpernickel   文件: MultiThumbSliderUI.java
@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();
}
 
源代码9 项目: pumpernickel   文件: BasicAudioPlayerUI.java
@Override
public void installUI(JComponent c) {
	super.installUI(c);

	getFields(c).install();
	c.addPropertyChangeListener(AudioPlayerComponent.SOURCE_KEY,
			updateSourceListener);
	c.addHierarchyListener(hierarchyListener);
}
 
源代码10 项目: pumpernickel   文件: SubtleScrollBarUI.java
@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();

}
 
源代码11 项目: pumpernickel   文件: AudioPlayerUI.java
@Override
public void installUI(JComponent c) {
	super.installUI(c);
	installDefaultSource((AudioPlayerComponent) c);
	c.addPropertyChangeListener(AudioPlayerComponent.PLAYER_KEY,
			audioPlayerListener);
}
 
源代码12 项目: pumpernickel   文件: BreadCrumbUI.java
@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);
}
 
源代码13 项目: mzmine2   文件: ShapeModelerSetupDialog.java
/**
 * @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();

}
 
源代码14 项目: PyramidShader   文件: MultiThumbSliderUI.java
@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();
}
 
源代码15 项目: pumpernickel   文件: AquaOpenLocationPaneUI.java
@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));
}
 
源代码16 项目: seaglass   文件: SeaGlassViewportUI.java
protected void installListeners(JComponent c) {
    c.addPropertyChangeListener(this);
}
 
源代码17 项目: seaglass   文件: SeaGlassToolTipUI.java
/**
 * @inheritDoc
 */
@Override
protected void installListeners(JComponent c) {
    c.addPropertyChangeListener(this);
}
 
源代码18 项目: PolyGlot   文件: PToolTipUI.java
protected void installListeners(JComponent c) {
    propertyChangeListener = createPropertyChangeListener(c);

    c.addPropertyChangeListener(propertyChangeListener);
}