/** 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); }
/** Displays XML from the given document. */ public void setDocument(Document doc) { this.doc = doc; getContentPane().removeAll(); if (doc == null) setVisible(false); else { // populate metadata window and size intelligently JTree tree = XMLCellRenderer.makeJTree(doc); for (int i=0; i<tree.getRowCount(); i++) tree.expandRow(i); getContentPane().add(new JScrollPane(tree)); pack(); Dimension dim = getSize(); final int pad = 20; dim.width += pad; dim.height += pad; Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int maxWidth = 3 * ss.width / 4; int maxHeight = 3 * ss.height / 4; if (dim.width > maxWidth) dim.width = maxWidth; if (dim.height > maxHeight) dim.height = maxHeight; setSize(dim); } }
/** Displays XML from the given document. */ public void setDocument(Document doc) { this.doc = doc; getContentPane().removeAll(); if (doc == null) setVisible(false); else { // populate metadata window and size intelligently JTree tree = XMLCellRenderer.makeJTree(doc); for (int i=0; i<tree.getRowCount(); i++) tree.expandRow(i); getContentPane().add(new JScrollPane(tree)); pack(); Dimension dim = getSize(); final int pad = 20; dim.width += pad; dim.height += pad; Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int maxWidth = 3 * ss.width / 4; int maxHeight = 3 * ss.height / 4; if (dim.width > maxWidth) dim.width = maxWidth; if (dim.height > maxHeight) dim.height = maxHeight; setSize(dim); } }