Example usage for javax.swing JDialog setTitle

List of usage examples for javax.swing JDialog setTitle

Introduction

In this page you can find the example usage for javax.swing JDialog setTitle.

Prototype

public void setTitle(String title) 

Source Link

Document

Sets the title of the Dialog.

Usage

From source file:Main.java

public static void main(String[] args) {
    int result = JOptionPane.showConfirmDialog(null, "Show over parent?");
    for (int i = 1; i < 4; i++) {
        JFrame f = new JFrame("Frame " + i);
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        Component parent = (JOptionPane.OK_OPTION == result ? f : null);

        f.setSize(400, 300);/*from   ww  w  .  j a v a  2s  . com*/
        f.setLocationByPlatform(true);
        f.setVisible(true);

        JDialog d = new JDialog(f);
        d.setTitle("Dialog " + i);
        d.setSize(300, 200);
        d.setLocationRelativeTo(parent);
        d.setVisible(true);
    }
}

From source file:com.ohalo.cn.awt.JFreeChartTest.java

public static void main(String[] args) throws Exception {
    JFreeChartTest test = new JFreeChartTest();
    List<JFreeChart> charts = test.printHardDiskCharts();

    JPanel mainPanel = new JPanel();
    JFreeChart chart = charts.get(0);/*  ww w . j a v  a  2  s.  c o m*/
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(400, 300));
    panel.add(chartPanel, BorderLayout.CENTER);
    mainPanel.add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(20, 20, 10, 10), 0, 0));

    chart = charts.get(1);
    panel = new JPanel();
    ChartPanel chartPanel2 = new ChartPanel(chart);
    chartPanel2.setPreferredSize(new Dimension(400, 300));
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel2, BorderLayout.CENTER);
    mainPanel.add(panel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));

    chart = charts.get(2);
    panel = new JPanel();
    ChartPanel chartPanel3 = new ChartPanel(chart);
    chartPanel3.setPreferredSize(new Dimension(400, 300));
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel3, BorderLayout.CENTER);
    mainPanel.add(panel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));

    chart = charts.get(3);
    panel = new JPanel();
    ChartPanel chartPanel4 = new ChartPanel(chart);
    chartPanel4.setPreferredSize(new Dimension(400, 300));
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel4, BorderLayout.CENTER);

    mainPanel.add(panel, new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(10, 10, 20, 20), 0, 0));

    JDialog dialog = new JDialog(new JFrame(), true);
    dialog.setTitle("?");
    dialog.setSize(850, 650);
    dialog.getContentPane().add(mainPanel);
    dialog.setVisible(true);
}

From source file:org.matsim.contrib.util.chart.ChartWindowUtils.java

private static JDialog newChartDialog(JFreeChart chart, String title, boolean modal) {
    chart.setTitle(title);/*  w  w  w.  java 2 s . c o m*/
    JDialog dialog = new JDialog();
    dialog.setTitle(title);
    dialog.setContentPane(new ChartPanel(chart));
    dialog.setModal(modal);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    return dialog;
}

From source file:Main.java

/**
 * Mostra uma caixa de menssagem para que seja ensirido um valor.
 * @param frame// www .ja  v  a 2 s .c o m
 * @param texto
 * @param title
 * @param valorInicial
 * @param type
 * @return
 * @author Thiago Benega
 * @since 13/04/2009
 */
public static String showTextboxDialog(javax.swing.JFrame frame, String texto, String title,
        String valorInicial, int type) {
    Object txt = null;
    JDialog jDialog = new JDialog();
    jDialog.setTitle(title);
    jDialog.setFocusableWindowState(true);

    if (frame != null) {
        frame.setExtendedState(Frame.ICONIFIED);
        frame.pack();
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    }

    switch (type) {
    case JOptionPane.OK_CANCEL_OPTION:
        txt = JOptionPane.showInputDialog(jDialog, texto, title, type, null, null, valorInicial);//.toString();
        break;
    case JOptionPane.YES_NO_OPTION:
        txt = JOptionPane.showConfirmDialog(jDialog, texto, title, type, JOptionPane.INFORMATION_MESSAGE);
        break;
    default:
        JOptionPane.showMessageDialog(jDialog, texto, title, type);
        break;
    }

    jDialog = null;
    return txt != null ? txt.toString() : null;

}

From source file:Main.java

private static JDialog dialogRaw(String title, final Window frame, ModalityType modal) {
    final JDialog dialog = new JDialog(frame, modal);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setTitle(title);
    return dialog;
}

From source file:Main.java

static public JDialog addModelessWindow(Window mainWindow, Component jpanel, String title) {
    JDialog dialog;
    if (mainWindow != null) {
        dialog = new JDialog(mainWindow, title);
    } else {/*from  w  w  w . j  a  v a 2 s  . com*/
        dialog = new JDialog();
        dialog.setTitle(title);
    }
    dialog.getContentPane().setLayout(new BorderLayout());
    dialog.getContentPane().add(jpanel, BorderLayout.CENTER);
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.pack();
    dialog.setLocationRelativeTo(mainWindow);
    dialog.setModalityType(ModalityType.MODELESS);
    dialog.setSize(jpanel.getPreferredSize());
    dialog.setVisible(true);
    return dialog;
}

From source file:org.duracloud.syncui.SyncUIDriver.java

/**
 * Note: The embedded Jetty server setup below is based on the example configuration in the Eclipse documentation:
 * https://www.eclipse.org/jetty/documentation/9.4.x/embedded-examples.html#embedded-webapp-jsp
 *//*from   www . j a va2s .c  om*/
private static void launchServer(final String url, final CloseableHttpClient client) {
    try {
        final JDialog dialog = new JDialog();
        dialog.setSize(new java.awt.Dimension(400, 75));
        dialog.setModalityType(ModalityType.MODELESS);
        dialog.setTitle("DuraCloud Sync");
        dialog.setLocationRelativeTo(null);

        JPanel panel = new JPanel();
        final JLabel label = new JLabel("Loading...");
        final JProgressBar progress = new JProgressBar();
        progress.setStringPainted(true);

        panel.add(label);
        panel.add(progress);
        dialog.add(panel);
        dialog.setVisible(true);

        port = SyncUIConfig.getPort();
        contextPath = SyncUIConfig.getContextPath();
        Server srv = new Server(port);

        // Setup JMX
        MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
        srv.addBean(mbContainer);

        ProtectionDomain protectionDomain = org.duracloud.syncui.SyncUIDriver.class.getProtectionDomain();
        String warFile = protectionDomain.getCodeSource().getLocation().toExternalForm();

        log.debug("warfile: {}", warFile);
        WebAppContext context = new WebAppContext();
        context.setContextPath(contextPath);
        context.setWar(warFile);
        context.setExtractWAR(Boolean.TRUE);

        Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(srv);
        classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
                "org.eclipse.jetty.annotations.AnnotationConfiguration");

        context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");

        srv.setHandler(context);

        new Thread(new Runnable() {
            @Override
            public void run() {
                createSysTray(url, srv);

                while (true) {
                    if (progress.getValue() < 100) {
                        progress.setValue(progress.getValue() + 3);
                    }

                    sleep(2000);
                    if (isAppRunning(url, client)) {
                        break;
                    }
                }

                progress.setValue(100);

                label.setText("Launching browser...");
                launchBrowser(url);
                dialog.setVisible(false);
            }
        }).start();

        srv.start();

        srv.join();
    } catch (Exception e) {
        log.error("Error launching server: " + e.getMessage(), e);
    }
}

From source file:org.nekorp.workflow.desktop.view.resource.imp.EvidenciaViewDialogFactory.java

@Override
public JDialog createDialog(Frame frame, boolean modal) {
    JDialog dialog = new JDialog(mainFrame, true);
    dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setTitle("Evidencia");
    evidenciaView.iniciaVista();//from  ww  w .j a v a 2  s  . c  o  m
    dialog.add(evidenciaView);
    dialog.setSize(980, 640);//hardcode para que no cresca en medida de imagenes en el preview
    dialog.validate();
    //dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}

From source file:org.nekorp.workflow.desktop.view.resource.imp.ParametrosReporteGlobalDialogFactory.java

@Override
public JDialog createDialog(Frame frame, boolean modal) {
    JDialog dialog = new JDialog(mainFrame, true);
    dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setTitle("Reporte Global");
    datePickView.setParent(dialog);//  w ww  .  j a  va  2  s  . com
    datePickView.iniciaVista();
    dialog.add(datePickView);
    dialog.validate();
    dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}

From source file:org.nekorp.workflow.desktop.view.resource.imp.DamageCaptureDetailDialogFactory.java

@Override
public JDialog createDialog(Frame frame, boolean modal) {
    JDialog dialog = new JDialog(mainFrame, true);
    dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setTitle("Descripcin del Dao");
    view.setParentWindow(dialog);/*from w  ww  . j a v  a2 s  . c o m*/
    view.iniciaVista();
    dialog.add(view);
    dialog.validate();
    dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}