public static void main(String[] args) throws Exception { XMLWindow xmlWindow = new XMLWindow(); xmlWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (args.length > 0) { String filename = args[0]; xmlWindow.setXML(new File(filename)); xmlWindow.setTitle("XML Window - " + filename); } else { BufferedReader in = new BufferedReader( new InputStreamReader(System.in, Constants.ENCODING)); final StringBuilder sb = new StringBuilder(); while (true) { String line = in.readLine(); if (line == null) break; sb.append(line); sb.append("\n"); } xmlWindow.setXML(sb.toString()); xmlWindow.setTitle("XML Window - <stdin>"); } xmlWindow.setLocation(200, 200); xmlWindow.setVisible(true); }
/** Displays the OME-XML metadata window onscreen. */ public void showMetadataWindow() { // center window and show Rectangle r = getBounds(); Dimension w = metaWindow.getSize(); int x = r.x + (r.width - w.width) / 2; int y = r.y + (r.height - w.height) / 2; if (x < 5) x = 5; if (y < 5) y = 5; metaWindow.setLocation(x, y); metaWindow.setVisible(true); }
/** Displays the OME-XML metadata window onscreen. */ public void showMetadataWindow() { // center window and show Rectangle r = getBounds(); Dimension w = metaWindow.getSize(); int x = r.x + (r.width - w.width) / 2; int y = r.y + (r.height - w.height) / 2; if (x < 5) x = 5; if (y < 5) y = 5; metaWindow.setLocation(x, y); metaWindow.setVisible(true); }
public static void main(String[] args) throws Exception { XMLWindow xmlWindow = new XMLWindow(); xmlWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (args.length > 0) { String filename = args[0]; xmlWindow.setXML(new File(filename)); xmlWindow.setTitle("XML Window - " + filename); } else { BufferedReader in = new BufferedReader( new InputStreamReader(System.in, Constants.ENCODING)); final StringBuilder sb = new StringBuilder(); while (true) { String line = in.readLine(); if (line == null) break; sb.append(line); sb.append("\n"); } xmlWindow.setXML(sb.toString()); xmlWindow.setTitle("XML Window - <stdin>"); } xmlWindow.setLocation(200, 200); xmlWindow.setVisible(true); }