List of usage examples for java.awt Frame Frame
public Frame(String title) throws HeadlessException
From source file:com.mirth.connect.plugins.rtfviewer.RTFViewer.java
@Override public void viewAttachments(List<String> attachmentIds) { // do viewing code Frame frame = new Frame("RTF Viewer"); frame.setLayout(new BorderLayout()); try {/*from www . ja va 2 s . c o m*/ Attachment attachment = parent.mirthClient.getAttachment(attachmentIds.get(0)); byte[] rawRTF = Base64.decodeBase64(attachment.getData()); JEditorPane jEditorPane = new JEditorPane("text/rtf", new String(rawRTF)); if (jEditorPane.getDocument().getLength() == 0) { // decoded when it should not have been. i.e.) the attachment data was not encoded. jEditorPane.setText(new String(attachment.getData())); } jEditorPane.setEditable(false); JScrollPane scrollPane = new javax.swing.JScrollPane(); scrollPane.setViewportView(jEditorPane); frame.add(scrollPane); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().dispose(); } }); frame.setSize(600, 800); Dimension dlgSize = frame.getSize(); Dimension frmSize = parent.getSize(); Point loc = parent.getLocation(); if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) { frame.setLocationRelativeTo(null); } else { frame.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); } frame.setVisible(true); } catch (Exception e) { parent.alertException(parent, e.getStackTrace(), e.getMessage()); } }
From source file:com.mirth.connect.plugins.textviewer.TextViewer.java
@Override public void viewAttachments(String channelId, Long messageId, String attachmentId) { // do viewing code Frame frame = new Frame("Text Viewer"); frame.setLayout(new BorderLayout()); try {/*ww w . j av a2 s . co m*/ Attachment attachment = parent.mirthClient.getAttachment(channelId, messageId, attachmentId); byte[] content = Base64.decodeBase64(attachment.getContent()); boolean isRTF = attachment.getType().toLowerCase().contains("rtf"); //TODO set character encoding JEditorPane jEditorPane = new JEditorPane(isRTF ? "text/rtf" : "text/plain", new String(content)); if (jEditorPane.getDocument().getLength() == 0) { // decoded when it should not have been. i.e.) the attachment data was not encoded. jEditorPane.setText(new String(attachment.getContent())); } jEditorPane.setEditable(false); JScrollPane scrollPane = new javax.swing.JScrollPane(); scrollPane.setViewportView(jEditorPane); frame.add(scrollPane); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().dispose(); } }); frame.setSize(600, 800); Dimension dlgSize = frame.getSize(); Dimension frmSize = parent.getSize(); Point loc = parent.getLocation(); if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) { frame.setLocationRelativeTo(null); } else { frame.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); } frame.setVisible(true); } catch (Exception e) { parent.alertThrowable(parent, e); } }
From source file:MultiBufferTest.java
public MultiBufferTest(int numBuffers, GraphicsDevice device) { try {/* w w w .ja v a2 s. c o m*/ GraphicsConfiguration gc = device.getDefaultConfiguration(); mainFrame = new Frame(gc); mainFrame.setUndecorated(true); mainFrame.setIgnoreRepaint(true); device.setFullScreenWindow(mainFrame); if (device.isDisplayChangeSupported()) { chooseBestDisplayMode(device); } Rectangle bounds = mainFrame.getBounds(); mainFrame.createBufferStrategy(numBuffers); BufferStrategy bufferStrategy = mainFrame.getBufferStrategy(); for (float lag = 2000.0f; lag > 0.00000006f; lag = lag / 1.33f) { for (int i = 0; i < numBuffers; i++) { Graphics g = bufferStrategy.getDrawGraphics(); if (!bufferStrategy.contentsLost()) { g.setColor(COLORS[i]); g.fillRect(0, 0, bounds.width, bounds.height); bufferStrategy.show(); g.dispose(); } try { Thread.sleep((int) lag); } catch (InterruptedException e) { } } } } catch (Exception e) { e.printStackTrace(); } finally { device.setFullScreenWindow(null); } }
From source file:WebCrawler.java
public static void main(String argv[]) { Frame f = new Frame("WebFrame"); WebCrawler applet = new WebCrawler(); f.add("Center", applet); /* Behind a firewall set your proxy and port here! */// w ww . java 2s. com Properties props = new Properties(System.getProperties()); props.put("http.proxySet", "true"); props.put("http.proxyHost", "webcache-cup"); props.put("http.proxyPort", "8080"); Properties newprops = new Properties(props); System.setProperties(newprops); /**/ applet.init(); applet.start(); f.pack(); f.show(); }
From source file:pl.edu.icm.visnow.lib.utils.ImageUtilities.java
public static Frame getNonClearingFrame(String name, Component c) { final Frame f = new Frame(name) { @Override//from w w w.java2 s . com public void update(Graphics g) { paint(g); } }; sizeContainerToComponent(f, c); centerFrame(f); f.setLayout(new BorderLayout()); f.add(c, BorderLayout.CENTER); f.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { f.dispose(); } }); return f; }
From source file:org.opensc.test.pkcs11.PINEntry.java
/** * Contructs a PINEntry instance. /*from ww w. ja va 2 s .co m*/ */ public PINEntry() { super(); Frame frame = new Frame("PIN entry"); frame.setLayout(new GridLayout(2, 2)); frame.add(new Label("Event:")); this.label = new Label("NO_EVENT"); frame.add(this.label); this.prompt = new Label(); frame.add(this.prompt); this.listener = new PINListener(frame); this.textField = new TextField(); this.textField.setEchoChar('*'); this.textField.addKeyListener(this.listener); frame.add(this.textField); frame.addWindowListener(this.listener); frame.pack(); frame.setVisible(true); GraphicsConfiguration gc = frame.getGraphicsConfiguration(); Rectangle r = gc.getBounds(); Point p = new Point((r.width - frame.getWidth()) / 2, (r.height - frame.getHeight()) / 2); frame.setLocation(p); }
From source file:LightTest.java
protected void createLight(LightObject light, BranchGroup objRoot) { Frame frame = new Frame(light.getName()); Panel aPanel = new Panel(); frame.add(aPanel);//from ww w . j av a 2 s. com light.addUiToPanel(aPanel); frame.pack(); frame.setSize(new Dimension(400, 250)); frame.validate(); frame.setVisible(true); // add the geometry that depicts the light // to the scenegraph objRoot.addChild(light.createGeometry()); // finally add the light itself to the scenegraph objRoot.addChild(light.getLight()); }
From source file:ransacBatch.BatchRANSAC.java
public BatchRANSAC(final ArrayList<Pair<Integer, Double>> mts, final File file, ResultsTable rtAll) { nf.setMaximumFractionDigits(5);/* w w w. j av a2s . c o m*/ this.mts = mts; this.points = Tracking.toPoints(mts); this.inputfile = file; this.inputdirectory = file.getParent(); this.rtAll = rtAll; this.dataset = new XYSeriesCollection(); this.chart = Tracking.makeChart(dataset, "Microtubule Length Plot", "Timepoint", "MT Length"); this.jFreeChartFrame = Tracking.display(chart, new Dimension(500, 400)); this.frame = new Frame("Welcome to Ransac Rate Analyzer "); }
From source file:CustomAlphaTest.java
protected void addCanvas3D(Canvas3D c3d) { Frame frame = new Frame("Custom Alpha Test"); Panel aPanel = new Panel(); aPanel.setLayout(new BorderLayout()); aPanel.add(c3d, BorderLayout.CENTER); frame.add(aPanel);//ww w . j a va 2s.c o m frame.pack(); frame.setSize(new Dimension(320, 320)); frame.validate(); frame.setVisible(true); doLayout(); }
From source file:PlotDriver.java
PlotterAWT() { super();//from w w w. ja v a 2 s . c om f = new Frame("Plotter"); p = new PCanvas(MAXX, MAXY); f.add(p); f.pack(); f.setVisible(true); g = p.getOsGraphics(); }