Example usage for java.awt Frame setVisible

List of usage examples for java.awt Frame setVisible

Introduction

In this page you can find the example usage for java.awt Frame setVisible.

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:org.geoserver.wms.WMSTestSupport.java

/**
 * Shows <code>image</code> in a Frame.
 * //from   www. j a  v  a 2  s .  c  o m
 * @param frameName
 * @param timeOut
 * @param image
 */
public static void showImage(String frameName, long timeOut, final BufferedImage image) {
    int width = image.getWidth();
    int height = image.getHeight();

    if (((System.getProperty("java.awt.headless") == null)
            || !System.getProperty("java.awt.headless").equals("true")) && INTERACTIVE) {
        Frame frame = new Frame(frameName);
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                e.getWindow().dispose();
            }
        });

        Panel p = new Panel(null) { // no layout manager so it respects
                                    // setSize
            public void paint(Graphics g) {
                g.drawImage(image, 0, 0, this);
            }
        };

        frame.add(p);
        p.setSize(width, height);
        frame.pack();
        frame.setVisible(true);

        try {
            Thread.sleep(timeOut);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        frame.dispose();
    }
}

From source file:org.kalypso.ogc.sensor.view.observationDialog.ObservationViewer.java

private void createDiagramForm(final Composite parent) {
    try {//from   w w w  . j  a v a  2 s  .  c  om
        m_chart = new ObservationChart(m_diagView);
    } catch (final SensorException e) {
        e.printStackTrace();
        throw new IllegalStateException(e.getLocalizedMessage());
    }

    final Composite chartComp = new Composite(parent, SWT.NO_BACKGROUND | SWT.EMBEDDED | SWT.BORDER);
    final Frame vFrame = SWT_AWT.new_Frame(chartComp);
    vFrame.add(ChartFactory.createChartPanel(m_chart));
    vFrame.setVisible(true);
}

From source file:org.kalypso.ogc.sensor.view.observationDialog.ObservationViewer.java

private void createMetadataAndTableForm(final Composite parent) {
    final SashForm form = new SashForm(parent, SWT.VERTICAL);

    // METADATA//w  w  w  .  j  av a  2s . c o m
    m_mdViewer = new SimplePropertySheetViewer(form);

    // TABLE
    m_table = new ObservationTable(m_tableView, false, false);

    final Composite tableComp = new Composite(form, SWT.NO_BACKGROUND | SWT.EMBEDDED);
    final Frame vFrame = SWT_AWT.new_Frame(tableComp);
    vFrame.setVisible(true);
    vFrame.add(m_table);

    final int[] mainWeights = getWeightsFromSettings(new int[] { 2, 5 }, SETTINGS_WEIGHTS_MAIN);
    form.setWeights(mainWeights);
    addWeightsListener(form, SETTINGS_WEIGHTS_MAIN);

    if ((getStyle() & HIDE_PROPERTIES) != 0)
        form.setMaximizedControl(tableComp);
}

From source file:org.kalypso.ui.editor.obstableeditor.ObservationTableEditor.java

/**
 * @see org.kalypso.ui.editor.AbstractWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 *//*  w  ww. j  a va 2 s.  c  o m*/
@Override
public void createPartControl(final Composite parent) {
    super.createPartControl(parent);

    m_swingContainer = new Composite(parent, SWT.RIGHT | SWT.EMBEDDED);
    final Frame vFrame = SWT_AWT.new_Frame(m_swingContainer);

    vFrame.add(m_table);

    vFrame.setVisible(true);
}

From source file:org.opensc.test.pkcs11.PINEntry.java

/**
 * Contructs a PINEntry instance. // w  w w  .j  a va2s .com
 */
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:org.paxle.desktop.impl.DialogueServices.java

private static void show(final Frame frame) {
    final int extstate = frame.getExtendedState();
    if ((extstate & Frame.ICONIFIED) == Frame.ICONIFIED)
        frame.setExtendedState(extstate ^ Frame.ICONIFIED);
    if (!frame.isVisible())
        frame.setVisible(true);
    frame.toFront();/*from w ww  .j av  a2s  . co  m*/
}