本文整理匯總了Java中javax.swing.RepaintManager.setCurrentManager方法的典型用法代碼示例。如果您正苦於以下問題:Java RepaintManager.setCurrentManager方法的具體用法?Java RepaintManager.setCurrentManager怎麽用?Java RepaintManager.setCurrentManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.RepaintManager
的用法示例。
在下文中一共展示了RepaintManager.setCurrentManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testPropertySheetRepaintsCellOnPropertyChange
import javax.swing.RepaintManager; //導入方法依賴的package包/類
public void testPropertySheetRepaintsCellOnPropertyChange() throws Exception {
if (!canSafelyRunFocusTests()) {
return;
}
Node n = new TNode(new SingleTagEditor());
setCurrentNode(n, ps);
Rectangle test = ps.table.getCellRect(1, 1, true);
RM rm = new RM(test, ps.table);
RepaintManager.setCurrentManager(rm);
sleep();
sleep();
Node.Property prop = n.getPropertySets()[0].getProperties()[0];
prop.setValue("new value");
Thread.currentThread().sleep(1000);
sleep();
rm.assertRectRepainted();
}
示例2: init
import javax.swing.RepaintManager; //導入方法依賴的package包/類
public static void init( Window applicationWindow ) {
if ( inited ) {
throw new RuntimeException( "Multiple inits." );
}
// System.out.println( "Setting repaintManagerPhet." );
RepaintManager.setCurrentManager( repaintManagerPhet );
offscreen = new JWindow( applicationWindow ) {
public void invalidate() {
}
public void paint( Graphics g ) {
}
}; //this seems to work. I thought you might have needed a visible component, though (maybe for some JVM implementations?)
// System.out.println( "offscreen.getOwner() = " + offscreen.getOwner() );
// offscreen.getOwner().setVisible( true );
offscreen.setSize( 0, 0 );
offscreen.setVisible( true );
offscreenContentPane.setOpaque( false );
offscreen.setContentPane( offscreenContentPane );
inited = true;
}
示例3: setAlpha
import javax.swing.RepaintManager; //導入方法依賴的package包/類
/**
* Set the alpha transparency level for this component. This automatically
* causes a repaint of the component.
*
* @param alpha must be a value between 0 and 1 inclusive.
*/
public void setAlpha(float alpha) {
if (alpha < 0 || alpha > 1) {
throw new IllegalArgumentException("Alpha must be between 0 and 1 inclusive");
}
if (this.alpha != alpha) {
float oldAlpha = this.alpha;
this.alpha = alpha;
if (alpha > 0f && alpha < 1f) {
if (oldAlpha == 1) {
//it used to be 1, but now is not. Save the oldOpaque
oldOpaque = isOpaque();
setOpaque(false);
}
//TODO this was quite the controversial choice, in automatically
//replacing the repaint manager. In retrospect, I'd probably
//opt for making this a manual choice. There really isn't a clear
//win, no matter the approach.
RepaintManager manager = RepaintManager.currentManager(this);
if (!manager.getClass().isAnnotationPresent(TranslucentRepaintManager.class)) {
RepaintManager.setCurrentManager(new RepaintManagerX());
}
} else if (alpha == 1) {
//restore the oldOpaque if it was true (since opaque is false now)
if (oldOpaque) {
setOpaque(true);
}
}
firePropertyChange("alpha", oldAlpha, alpha);
repaint();
}
}
示例4: installRepaintManager
import javax.swing.RepaintManager; //導入方法依賴的package包/類
void installRepaintManager() {
if (!JVM.current().isOrLater(JVM.JDK1_7)) {
RepaintManager manager = RepaintManager.currentManager(this);
RepaintManager trm = SwingXUtilities.getTranslucentRepaintManager(manager);
RepaintManager.setCurrentManager(trm);
}
}
示例5: setDebug
import javax.swing.RepaintManager; //導入方法依賴的package包/類
private static void setDebug() throws IOException {
if (AppPreferences.getPreferences().getSection("debug").get("debug.edt", Boolean.class, false)) {
RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager(false));
}
String levelName = AppPreferences.getPreferences().getSection("debug").get("debug.log4j.level", "DEBUG");
Level level = Level.toLevel(levelName, Level.DEBUG);
setLoggingLevelImpl(level);
}
示例6: setup
import javax.swing.RepaintManager; //導入方法依賴的package包/類
/**
* Initialize maximum of things to get uniform application running inn the scientific context.
* Initialization are done only on the first call of this method (which should be from a main method)
*/
public static void setup() {
// avoid reentrance:
if (_alreadyDone) {
return;
}
_alreadyDone = true;
setSwingDefaults();
if (DEBUG_EDT_VIOLATIONS) {
RepaintManager.setCurrentManager(new ThreadCheckingRepaintManager());
}
// Install exception handlers:
if (Bootstrapper.isHeadless()) {
// Use logging exception handler:
MCSExceptionHandler.installLoggingHandler();
} else {
// Use Swing exception handler:
MCSExceptionHandler.installSwingHandler();
// Apply UI scale & LaF settings:
setLAFDefaults();
setDefaultLookAndFeel();
}
_logger.info("Swing settings set.");
}
示例7: register
import javax.swing.RepaintManager; //導入方法依賴的package包/類
public static void register(JComponent component) {
if (RepaintManager.currentManager(component) != INSTANCE) {
RepaintManager.setCurrentManager(INSTANCE);
}
INSTANCE.addLogComponent(component);
}
示例8: initRepaintManager
import javax.swing.RepaintManager; //導入方法依賴的package包/類
private void initRepaintManager() {
final RepaintManager repaintManager = RepaintManager.currentManager(this);
if (!(repaintManager instanceof PSwingRepaintManager)) {
RepaintManager.setCurrentManager(new PSwingRepaintManager());
}
}
示例9: setUp
import javax.swing.RepaintManager; //導入方法依賴的package包/類
public void setUp() {
RepaintManager.setCurrentManager(new PSwingRepaintManager());
}
示例10: ScreenCapture
import javax.swing.RepaintManager; //導入方法依賴的package包/類
/** Constructs a <code>ScreenCapture</code> object that will
* record the entire screen.
*/
public ScreenCapture() {
//I tried Toolkit.addEventListener() and Toolkit.getSystemEventQueue().push()
//and neither approach would reveal PaintEvents to me.
//this approach, however, will tell me what's repainted:
Runnable repaintRunnable = new Runnable() {
public void run() {
RepaintManager.setCurrentManager(filteredRepaintManager);
}
};
SwingUtilities.invokeLater(repaintRunnable);
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
Map<Component, Rectangle> table = new HashMap<Component, Rectangle>();
public void eventDispatched(AWTEvent event) {
if(stop) {
table.clear();
return;
}
if(event instanceof ComponentEvent) {
ComponentEvent c = (ComponentEvent)event;
Component t = c.getComponent();
Point p = new Point(0,0);
SwingUtilities.convertPointToScreen(p, t);
Rectangle r = new Rectangle(p.x,p.y,t.getWidth(),t.getHeight());
r.setFrame(r.x-12,r.y-12,r.width+24,r.height+30); //on Mac OS, allow for shadows.
Rectangle repaintArea = r;
/** Can't rely on JComponents and the clientProperties here,
* because tooltips can take place in a heavyweight window
*/
Rectangle lastBounds = table.get(t);
if(lastBounds!=null) {
repaintArea = r.union(lastBounds);
}
table.put(t, (Rectangle)r.clone());
SwingUtilities.invokeLater(new CaptureRunnable(repaintArea));
}
}
}, AWTEvent.COMPONENT_EVENT_MASK);
}
示例11: installRepaintManager
import javax.swing.RepaintManager; //導入方法依賴的package包/類
private void installRepaintManager() {
ReflectionRepaintManager manager = new ReflectionRepaintManager();
RepaintManager.setCurrentManager(manager);
}
示例12: setUp
import javax.swing.RepaintManager; //導入方法依賴的package包/類
public void setUp() {
RepaintManager.setCurrentManager(new PSwingRepaintManager());
}
示例13: setCurrentManager
import javax.swing.RepaintManager; //導入方法依賴的package包/類
public static void setCurrentManager(RepaintManager repaintManager) {
RepaintManager.setCurrentManager(repaintManager);
}
示例14: install
import javax.swing.RepaintManager; //導入方法依賴的package包/類
/**
Installs the NullRepaintManager.
*/
public static void install() {
RepaintManager repaintManager = new NullRepaintManager();
repaintManager.setDoubleBufferingEnabled(false);
RepaintManager.setCurrentManager(repaintManager);
}
示例15: NormalFrame
import javax.swing.RepaintManager; //導入方法依賴的package包/類
/**
* Builds a new frame.
*
* @throws ParserConfigurationException
* Problem while accessing the game data.
* @throws SAXException
* Problem while accessing the game data.
* @throws IOException
* Problem while accessing the game data.
* @throws IllegalArgumentException
* Problem while accessing the game data.
* @throws SecurityException
* Problem while accessing the game data.
* @throws IllegalAccessException
* Problem while accessing the game data.
* @throws NoSuchFieldException
* Problem while accessing the game data.
* @throws ClassNotFoundException
* Problem while accessing the game data.
*/
public NormalFrame() throws ParserConfigurationException, SAXException, IOException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException
{ // init
super("TBB v."+GameData.VERSION);
// UI manager
UIManager.put("MenuItemUI","CustomMenuItemUI");
RepaintManager.setCurrentManager(new FullRepaintManager());
// put panel
mainMenuPanel = new MainMenu(this,null);
currentPanel = mainMenuPanel;
getContentPane().add(mainMenuPanel, BorderLayout.CENTER);
}