test/demo/jvmti/mtrace/JFrameCreateTime.java

Print this page

        

*** 30,43 **** --- 30,47 ---- /* Early in 1.5 it was reported that doing a step into the first JFrame * was very slow (VisualMust debugger people reported this). */ + import java.awt.GraphicsEnvironment; import javax.swing.*; public class JFrameCreateTime { public static void main(String[] args) { + if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { + System.out.println("JFrame test was skipped due to headless mode"); + } else { JFrame f; long start, end; start = System.currentTimeMillis(); f = new JFrame("JFrame");
*** 46,55 **** System.out.println("JFrame first creation took " + (end - start) + " ms"); start = System.currentTimeMillis(); f = new JFrame("JFrame"); end = System.currentTimeMillis(); - System.out.println("JFrame second creation took " + (end - start) + " ms"); System.exit(0); } } --- 50,59 ---- System.out.println("JFrame first creation took " + (end - start) + " ms"); start = System.currentTimeMillis(); f = new JFrame("JFrame"); end = System.currentTimeMillis(); System.out.println("JFrame second creation took " + (end - start) + " ms"); + } System.exit(0); } }