public static void main(String s[]) { if (s.length > 0) j2kfilename = s[0]; else j2kfilename = "girl"; System.out.println(j2kfilename); isApplet = false; JFrame f = new JFrame("ImageViewer"); f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); JApplet applet = new ImageViewer(); f.getContentPane().add("Center", applet); applet.init(); f.pack(); f.setSize(new Dimension(550, 550)); f.show(); }
/** Returns a DebugGraphics for use in buffering window. */ private Graphics debugGraphics() { DebugGraphics debugGraphics; DebugGraphicsInfo info = info(); JFrame debugFrame; if (info.debugFrame == null) { info.debugFrame = new JFrame(); info.debugFrame.setSize(500, 500); } debugFrame = info.debugFrame; debugFrame.show(); debugGraphics = new DebugGraphics(debugFrame.getGraphics()); debugGraphics.setFont(getFont()); debugGraphics.setColor(getColor()); debugGraphics.translate(xOffset, yOffset); debugGraphics.setClip(getClipBounds()); if (debugFlash()) { debugGraphics.setDebugOptions(FLASH_OPTION); } return debugGraphics; }
void main() { CommonSwing.setDefaultColor(); fMain = new JFrame("HSQL Database Manager"); // (ulrivo): An actual icon. fMain.getContentPane().add(createToolBar(), "North"); fMain.setIconImage(CommonSwing.getIcon()); fMain.addWindowListener(this); JMenuBar bar = new JMenuBar(); // used shortcuts: CERGTSIUDOLM String fitems[] = { "-Connect...", "--", "-Open Script...", "-Save Script...", "-Save Result...", "--", "-Exit" }; addMenu(bar, "File", fitems); String vitems[] = {"RRefresh Tree", "--", "GResults in Grid", "TResults in Text"}; addMenu(bar, "View", vitems); String sitems[] = { "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "---", "-CREATE TABLE", "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-CHECKPOINT", "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script" }; addMenu(bar, "Command", sitems); mRecent = new JMenu("Recent"); bar.add(mRecent); String soptions[] = { "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--", "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on", "-Logging off", "--", "-Insert test data" }; addMenu(bar, "Options", soptions); String stools[] = {"-Dump", "-Restore", "-Transfer"}; addMenu(bar, "Tools", stools); fMain.setJMenuBar(bar); initGUI(); sRecent = new String[iMaxRecent]; Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = fMain.getSize(); // (ulrivo): full size on screen with less than 640 width if (d.width >= 640) { fMain.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2); } else { fMain.setLocation(0, 0); fMain.setSize(d); } fMain.show(); // (ulrivo): load query from command line if (defScript != null) { if (defDirectory != null) { defScript = defDirectory + File.separator + defScript; } // if insert stmet is thousands of records...skip showing it // as text. Too huge. StringBuffer buf = new StringBuffer(); ifHuge = DatabaseManagerCommon.readFile(defScript); if (4096 <= ifHuge.length()) { buf.append("This huge file cannot be edited. Please execute\n"); txtCommand.setText(buf.toString()); } else { txtCommand.setText(ifHuge); } } txtCommand.requestFocus(); }