2011年7月7日 星期四

java 1.4.2 invoke 1.5 method

complation with 1.4.2 has no setAlwaysOnTop but run at 1.5 can use method invoke


try
    {
    JFrame test =new JFrame();
 Method setAlwaysOnTop = null;
 setAlwaysOnTop = test.getClass().getMethod("setAlwaysOnTop", new Class[] { Boolean.TYPE });
 setAlwaysOnTop.invoke(test, new Object[] { new Boolean(true) });
    }
    catch (Throwable  ....