?? storekeeper.java
字號(hào):
/*
* StoreKeeper.java - Keeps track of all RText instances (windows) that are
* open, and provides an interface to update their Look and
* Feels together.
*/
package org.fife.rtext;
import java.util.ArrayList;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
/**
* Keeps track of all <code>org.fife.rtext.RText</code> instances (windows) that
* are open, and provides an interface to update their Look and Feels together.
*/
public class StoreKeeper {
private static ArrayList rtextInstances;
/*****************************************************************************/
/**
* Notes that a new <code>RText</code> window is open.
*
* @param rtext The <code>RText</code> instance to remember.
*/
public static void addRTextInstance(RText rtext) {
if (rtextInstances == null) {
rtextInstances = new ArrayList(1);
}
rtextInstances.add(rtext);
}
/*****************************************************************************/
/**
* Gets the number of <code>RText</code> instances (windows) that are
* currently open.
*
* @return The number of <code>RText</code> instances open.
*/
public static int getInstanceCount() {
return rtextInstances.size();
}
/*****************************************************************************/
/**
* Removes an <code>RText</code> instance.
*
* @param rtext The <code>RText</code> to remove.
* @throws NullPointerException If no <code>RText</code> instances have
* been remembered yet.
*/
public static void removeRTextInstance(RText rtext) {
int index = rtextInstances.indexOf(rtext);
if (index == -1) {
//throw new RTextNotFoundException();
return;
}
rtextInstances.remove(index);
}
/*****************************************************************************/
/**
* Updates the Look and Feel of all <code>RText</code> instances.
*
* @param lnf The Look and Feel to change to.
*/
public static void updateLookAndFeels(final LookAndFeel lnf) {
final Runnable updateUIThread = new Runnable() {
public void run() {
int count = getInstanceCount();
for (int i = 0; i < count; i++) {
( (RText) rtextInstances.get(i)).updateLookAndFeel(lnf);
}
}
};
// Ensure we update Look and Feels on event dispatch thread.
try {
SwingUtilities.invokeLater(updateUIThread);
}
catch (Exception e) {
e.printStackTrace();
}
}
/*****************************************************************************/
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -