javax.swing.event.ChangeListener#stateChanged()源码实例Demo

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

源代码1 项目: radiance   文件: WeakChangeSupport.java
@Override
public void stateChanged(ChangeEvent e) {
    ChangeListener originalListener = this.listenerRef.get();
    if (originalListener != null) {
        originalListener.stateChanged(e);
    } else {
        // the original is gone - unregister explicitly
        if (this.sourceRef != null) {
            ChangeAware source = this.sourceRef.get();
            if (source != null) {
                source.removeChangeListener(this);
            }
        }
        this.listenerRef = null;
        this.sourceRef = null;
    }
}
 
源代码2 项目: ghidra   文件: DataTypePropertyManager.java
/**
 * Notify listeners that the favorites list changed.
 */
private void notifyListeners() {
	if (changeListeners.isEmpty()) {
		return;
	}

	Runnable notifyRunnable = new Runnable() {
		@Override
		public void run() {
			ChangeEvent event = new ChangeEvent(DataTypePropertyManager.this);
			for (ChangeListener l : changeListeners) {
				l.stateChanged(event);
			}
		}
	};

	SystemUtilities.runSwingNow(notifyRunnable);
}
 
源代码3 项目: darklaf   文件: DefaultTransformModel.java
/**
 * If {!oldValue.equals(newValue)}, a {@link ChangeEvent} will be fired.
 *
 * @param oldValue an old value
 * @param newValue a new value
 */
protected void fireChangeEvent(final Object oldValue, final Object newValue) {
    if (!oldValue.equals(newValue)) {
        ChangeEvent event = new ChangeEvent(this);
        for (ChangeListener listener : listeners.keySet()) {
            listener.stateChanged(event);
        }
    }
}
 
源代码4 项目: darklaf   文件: DarkMenuBarUI.java
@Override
protected ChangeListener createChangeListener() {
    ChangeListener listener = super.createChangeListener();
    return e -> {
        listener.stateChanged(e);
        // Fixes popup graphics creeping into the component when it is not opaque.
        menuBar.repaint();
    };
}
 
源代码5 项目: ghidra   文件: AbstractColumnConstraintEditor.java
/**
 * Notify all monitors that the configuration of the constraint has changed.
 */
protected void notifyConstraintChanged() {
	ChangeEvent changeEvent = new ChangeEvent(this);
	for (ChangeListener changeListener : listeners) {
		changeListener.stateChanged(changeEvent);
	}
}
 
源代码6 项目: ghidra   文件: ClassSearcher.java
private static void fireClassListChanged() {
	for (ChangeListener listener : listenerList) {
		try {
			listener.stateChanged(null);
		}
		catch (Throwable t) {
			Msg.showError(ClassSearcher.class, null, "Exception",
				"Error in listener for class list changed", t);
		}
	}
}
 
源代码7 项目: ghidra   文件: VariousChoicesPanel.java
/**
 * Adds checkbox choices as a row of the table.
 * Check boxes allow you to select one or more choices in the row.
 * 
 * @param title title the is placed at the beginning of the row
 * @param choices the text for each choice in the row
 * @param listener listener that gets notified whenever the state of 
 * one of the checkboxes in this row changes.
 */
void addMultipleChoice(final String title, final String[] choices,
		final ChangeListener listener) {
	adjustColumnCount(choices.length + 1);
	MyLabel titleComp = new MyLabel(title);
	MyCheckBox[] cb = new MyCheckBox[choices.length];
	final int row = rows.size();
	final ChoiceRow choiceRow = new ChoiceRow(titleComp, cb);
	ItemListener itemListener = new ItemListener() {
		@Override
		public void itemStateChanged(ItemEvent e) {
			adjustUseForAllEnablement();
			if (listener != null) {
				ResolveConflictChangeEvent re =
					new ResolveConflictChangeEvent(e.getSource(), row, choiceRow.getChoice());
				listener.stateChanged(re);
			}
		}
	};
	for (int i = 0; i < choices.length; i++) {
		cb[i] = new MyCheckBox(choices[i]);
		cb[i].setName(getComponentName(row, (i + 1)));
		cb[i].addItemListener(itemListener);
	}
	if (choices.length > 0) {
		titleComp.setBorder(checkBoxBorder);
	}
	addRow(choiceRow);
	rowPanel.validate();
	validate();
	invalidate();
	adjustUseForAllEnablement();
}
 
源代码8 项目: radiance   文件: ColorSliderModel.java
public void fireStateChanged() {
	ChangeEvent event = new ChangeEvent(this);
	for (Iterator<ChangeListener> i = listeners.iterator(); i.hasNext();) {
		ChangeListener l = i.next();
		l.stateChanged(event);
	}
}
 
源代码9 项目: ghidra   文件: VerticalChoicesPanel.java
/**
 * Adds a row with the items in each column. The first item's component is a check box.
 * @param items the text for each column.
 * @param name the name for the check box component.
 * @param conflictOption the conflict option value associated with selecting this row's check box.
 * @param listener listener to be notified when the check box is selected or not selected.
 */
void addCheckBoxRow(final String[] items, final String name, final int conflictOption,
		final ChangeListener listener) {
	adjustColumnCount(items.length);
	int row = rows.size();
	rowTypes.add(CHECK_BOX);
	rows.add(items);
	MyCheckBox firstComp = new MyCheckBox(items[0], conflictOption);
	firstComp.setName(name);
	ItemListener itemListener = new ItemListener() {
		@Override
		public void itemStateChanged(ItemEvent e) {
			if (listener != null) {
				listener.stateChanged(null);
			}
		}
	};
	firstComp.addItemListener(itemListener);
	setRowComponent(firstComp, row, 0, defaultInsets);
	for (int i = 1; i < items.length; i++) {
		MyLabel newComp = new MyLabel(items[i]);
		newComp.setName(getComponentName(row, i));
		setRowComponent(newComp, row, i, textVsCheckBoxInsets);
	}
	rowPanel.validate();
	validate();
	invalidate();
}
 
源代码10 项目: nanoleaf-desktop   文件: ColorEntry.java
protected void fireChangeListeners()
{
    ChangeEvent event = new ChangeEvent(this);
    for (ChangeListener listener : getChangeListeners())
    {
        listener.stateChanged(event);
    }
}
 
源代码11 项目: nanoleaf-desktop   文件: Palette.java
protected void fireChangeListeners()
{
    ChangeEvent event = new ChangeEvent(this);
    for (ChangeListener listener : getChangeListeners())
    {
        listener.stateChanged(event);
    }
}
 
源代码12 项目: ghidra   文件: DecompilerClipboardProvider.java
private void notifyStateChanged() {
	ChangeEvent event = new ChangeEvent(this);
	for (ChangeListener listener : listeners) {
		listener.stateChanged(event);
	}
}
 
源代码13 项目: ghidra   文件: FidFileManager.java
private void notifyListeners() {
	for (ChangeListener listener : listeners) {
		listener.stateChanged(null);
	}
}
 
源代码14 项目: ghidra   文件: ByteViewerClipboardProvider.java
private void notifyStateChanged() {
	ChangeEvent event = new ChangeEvent(this);
	for (ChangeListener listener : listeners) {
		listener.stateChanged(event);
	}
}
 
源代码15 项目: ghidra   文件: MarkerManager.java
private void notifyListeners() {
	for (ChangeListener listener : listeners) {
		listener.stateChanged(null);
	}
}
 
源代码16 项目: ghidra   文件: CodeBrowserClipboardProvider.java
private void notifyStateChanged() {
	ChangeEvent event = new ChangeEvent(this);
	for (ChangeListener listener : listeners) {
		listener.stateChanged(event);
	}
}
 
源代码17 项目: ghidra   文件: ListingMergePanel.java
public void notifyListeners() {
	ChangeEvent event = new ChangeEvent(this);
	for (ChangeListener backgroundListener : backgroundListenerList) {
		backgroundListener.stateChanged(event);
	}
}
 
源代码18 项目: ghidra   文件: VariousChoicesPanel.java
/**
 * Adds radiobutton choices as a row of the table.
 * Radiobuttons allow you to select only one choice in the row.
 * 
 * @param title title the is placed at the beginning of the row
 * @param choices the text for each choice in the row
 * @param listener listener that gets notified whenever the state of 
 * one of the radiobuttons in this row changes.
 */
void addSingleChoice(final String title, final String[] choices,
		final ChangeListener listener) {
	adjustColumnCount(choices.length + 1);
	for (int i = 0; i < choices.length; i++) {
		if (choices[i] == null) {
			choices[i] = "-- none --";
		}
		else if (choices[i].length() == 0) {
			choices[i] = "-- empty --";
		}
	}
	MyLabel titleComp = new MyLabel(title);
	MyRadioButton[] rb = new MyRadioButton[choices.length];
	final int row = rows.size();
	final ChoiceRow choiceRow = new ChoiceRow(titleComp, rb);
	ItemListener itemListener = new ItemListener() {
		@Override
		public void itemStateChanged(ItemEvent e) {
			adjustUseForAllEnablement();
			if (listener != null) {
				Object source = e.getSource();
				if (((MyRadioButton) source).isSelected()) {
					ResolveConflictChangeEvent re =
						new ResolveConflictChangeEvent(source, row, choiceRow.getChoice());
					listener.stateChanged(re);
				}
			}
		}
	};
	ButtonGroup group = new ButtonGroup();
	for (int i = 0; i < choices.length; i++) {
		rb[i] = new MyRadioButton(choices[i]);
		rb[i].setName("ChoiceComponentRow" + row + "Col" + (i + 1));
		group.add(rb[i]);
		rb[i].addItemListener(itemListener);
	}
	if (choices.length > 0) {
		titleComp.setBorder(radioButtonBorder);
	}
	addRow(choiceRow);
	rowPanel.validate();
	validate();
	invalidate();
	adjustUseForAllEnablement();
}
 
源代码19 项目: ghidra   文件: OpenCloseManager.java
private void notifyDataToggled() {
	for (ChangeListener l : listeners) {
		l.stateChanged(null);
	}
}
 
源代码20 项目: radiance   文件: ColorWheelPanel.java
public void setColor(Color c) {
	systemColor = null;

	if (c != null) {
		int r = c.getRed();
		int g = c.getGreen();
		int b = c.getBlue();
		if (useWebColors.isSelected()) {
			r = Math.round(r / 51) * 51;
			g = Math.round(g / 51) * 51;
			b = Math.round(b / 51) * 51;
		}
		chooserColor = new ModelColor(r, g, b);
	}
	// else
	c = new Color(chooserColor.R, chooserColor.G, chooserColor.B);

	values = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), values);
	if (values[1] == 0.0F) {
		s = values[1];
		b = values[2];
	} else if (values[2] == 0.0F) {
		b = values[2];
	} else {
		h = values[0];
		s = values[1];
		b = values[2];
	}
	h = Math.min(Math.max(h, 0.0), 1.0);
	s = Math.min(Math.max(s, 0.0), 1.0);
	b = Math.min(Math.max(b, 0.0), 1.0);

	if (values[1] != 0.0F) {
		if (values[1] != 0.0F)
			setHue();
		setSaturation();
	}
	setBrightness();

	busy = true;
	brightnessSlider.setValue(Integer.parseInt(brightEdit.getText()));
	saturationSlider.setValue(Integer.parseInt(satEdit.getText()));
	busy = false;

	baseColorLabel.setBackground(new Color(chooserColor.R, chooserColor.G,
			chooserColor.B));

	if (SubstanceColorUtilities.getColorBrightness(
			baseColorLabel.getBackground().getRGB()) < 128)
		baseColorLabel.setForeground(Color.white);
	else
		baseColorLabel.setForeground(Color.black);

	String colorStr;
	if (decimalRGB.isSelected()) {
		// Output decimal values
		colorStr = " " + c.getRed() + "."
				+ c.getGreen() + "."
				+ c.getBlue();
	} else {
		// Output HEX values
		colorStr = " " + ModelColor.toHexString(c.getRed())
				+ ModelColor.toHexString(c.getGreen())
				+ ModelColor.toHexString(c.getBlue());
	}
	baseColorLabel.setText(colorStr);
	baseColorEdit.setText(colorStr);

	ChangeEvent evt = new ChangeEvent(this);
	int numListeners = changeListeners.size();
	for (int i = 0; i < numListeners; i++) {
		ChangeListener l = changeListeners.get(i);
		l.stateChanged(evt);
	}

	if (hasChooser)
		getColorSelectionModel().setSelectedColor(c);
}