uiswitchlistener.java

来自「采用GUI格式调用的库函数直接写的源码」· Java 代码 · 共 28 行

JAVA
28
字号
import java.awt.*;
import java.beans.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

//This class listens for UISwitches, and Updates the Components.

public class UISwitchListener implements PropertyChangeListener {

	JComponent componentToSwitch;

	public UISwitchListener (JComponent c) { componentToSwitch = c; }

	public void propertyChange (PropertyChangeEvent e) {

		String name = e.getPropertyName ();

		if (name.equals ("lookAndFeel")) {
			SwingUtilities.updateComponentTreeUI (componentToSwitch);
			componentToSwitch.invalidate ();
			componentToSwitch.validate ();
			componentToSwitch.repaint ();
		}

	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?