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:emailplugin.MailCreator.java

/**
 * Gives the User the opportunity to specify which Desktop he uses (KDE or
 * Gnome)/*  w  ww.j  a va  2s . co  m*/
 *
 * @param parent
 *          Parent Dialog
 * @return true if KDE or Gnome has been selected, false if the User wanted to
 *         specify the App
 */
private boolean showKdeGnomeDialog(Frame parent) {
    final JDialog dialog = new JDialog(parent, true);

    dialog.setTitle(mLocalizer.msg("chooseTitle", "Choose"));

    JPanel panel = (JPanel) dialog.getContentPane();
    panel.setLayout(new FormLayout("10dlu, fill:pref:grow",
            "default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu:grow, default"));
    panel.setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    panel.add(UiUtilities.createHelpTextArea(mLocalizer.msg("cantConfigure", "Can't configure on your system")),
            cc.xyw(1, 1, 2));

    JRadioButton kdeButton = new JRadioButton(mLocalizer.msg("kde", "I am using KDE"));
    panel.add(kdeButton, cc.xy(2, 3));

    JRadioButton gnomeButton = new JRadioButton(mLocalizer.msg("gnome", "I am using Gnome"));
    panel.add(gnomeButton, cc.xy(2, 5));

    JRadioButton selfButton = new JRadioButton(mLocalizer.msg("self", "I want to configure by myself"));
    panel.add(selfButton, cc.xy(2, 7));

    ButtonGroup group = new ButtonGroup();
    group.add(kdeButton);
    group.add(gnomeButton);
    group.add(selfButton);

    selfButton.setSelected(true);

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
        }
    });

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(ok);
    panel.add(buttonPanel, cc.xy(2, 9));

    UiUtilities.registerForClosing(new WindowClosingIf() {
        public void close() {
            dialog.setVisible(false);
        }

        public JRootPane getRootPane() {
            return dialog.getRootPane();
        }
    });

    dialog.getRootPane().setDefaultButton(ok);

    dialog.pack();
    UiUtilities.centerAndShow(dialog);

    if (kdeButton.isSelected()) {
        mSettings.setApplication("kfmclient");
        mSettings.setParameter("exec {content}");
    } else if (gnomeButton.isSelected()) {
        mSettings.setApplication("gnome-open");
        mSettings.setParameter("{content}");
    } else {
        Plugin.getPluginManager().showSettings(mPlugin);
        return false;
    }

    return true;
}

From source file:com.apatar.http.HttpNode.java

@Override
public void createDatabaseParam(Wizard wizard) {
    JDialog wd = wizard.getDialog();

    wd.setTitle(title + " Property");
    try {// w ww.jav  a2s  . c  om
        WizardPanelDescriptor descriptor1;

        descriptor1 = new DBConnectionDescriptor(this, new JPropertySheetPage(wd),
                TableSchemaDescriptor.IDENTIFIER,
                ApplicationData.classForName("com.apatar.http.HttpConnection"), "db_connector", "http");
        wizard.registerWizardPanel(DBConnectionDescriptor.IDENTIFIER, descriptor1);

        SchemaTable schema = getTiForConnection(AbstractDataBaseNode.OUT_CONN_POINT_NAME).getSchemaTable();
        TableSchemaDescriptor descriptor2 = new TableSchemaDescriptor(
                new JTableSchemaPanel(ApplicationData.getTempDataBase().getDataBaseInfo().getAvailableTypes(),
                        schema.getRecords()),
                this);
        wizard.registerWizardPanel(TableSchemaDescriptor.IDENTIFIER, descriptor2);

        wizard.setKeyForReferringToDescription("help.connector.http");
        wizard.setCurrentPanel(DBConnectionDescriptor.IDENTIFIER, Wizard.NEXT_BUTTON_ACTION_COMMAND);

        wizard.showModalDialog();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:com.apatar.buzzsaw.BuzzsawNode.java

@Override
public void createDatabaseParam(Wizard wizard) {
    JDialog wd = wizard.getDialog();

    wd.setTitle(title + " Property");

    try {/* w  ww. ja  v a 2  s.co m*/
        WizardPanelDescriptor descriptor1 = new DBConnectionDescriptor(this,
                new JPropertySheetPage(wizard.getDialog()), BuzzsawFolderTreeDescriptor.IDENTIFIER,
                ApplicationData.classForName("com.apatar.buzzsaw.BuzzsawConnection"), "db_connector",
                "buzzsaw");
        wizard.registerWizardPanel(DBConnectionDescriptor.IDENTIFIER, descriptor1);

        WizardPanelDescriptor descriptor2 = new BuzzsawFolderTreeDescriptor(this,
                DBConnectionDescriptor.IDENTIFIER, WebDavModeDescriptor.IDENTIFIER);
        wizard.registerWizardPanel(BuzzsawFolderTreeDescriptor.IDENTIFIER, descriptor2);

        WizardPanelDescriptor descriptor3 = new WebDavModeDescriptor(this,
                BuzzsawFolderTreeDescriptor.IDENTIFIER, WizardPanelDescriptor.FINISH);
        wizard.registerWizardPanel(WebDavModeDescriptor.IDENTIFIER, descriptor3);

        wizard.setKeyForReferringToDescription("help.connector.buzzsaw");
        wizard.setCurrentPanel(DBConnectionDescriptor.IDENTIFIER, Wizard.NEXT_BUTTON_ACTION_COMMAND);

        wizard.showModalDialog();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.net2plan.gui.GUINet2Plan.java

private void showKeyCombinations() {
    Component component = container.getComponent(0);
    if (!(component instanceof IGUIModule)) {
        ErrorHandling.showErrorDialog("No tool is active", "Unable to show key associations");
        return;//from  w  ww .ja  va  2 s.  c o  m
    }

    final JDialog dialog = new JDialog();
    dialog.setTitle("Key combinations");
    SwingUtils.configureCloseDialogOnEscape(dialog);
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    dialog.setSize(new Dimension(500, 300));
    dialog.setLocationRelativeTo(null);
    dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    dialog.setLayout(new MigLayout("fill, insets 0 0 0 0"));

    final String[] tableHeader = StringUtils.arrayOf("Key combination", "Action");

    DefaultTableModel model = new ClassAwareTableModel();
    model.setDataVector(new Object[1][tableHeader.length], tableHeader);

    AdvancedJTable table = new AdvancedJTable(model);
    JScrollPane scrollPane = new JScrollPane(table);
    dialog.add(scrollPane, "grow");

    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);

    table.getTableHeader().addMouseListener(new ColumnFitAdapter());

    IGUIModule module = (IGUIModule) component;
    Map<String, KeyStroke> keyCombinations = module.getKeyCombinations();
    if (!keyCombinations.isEmpty()) {
        model.removeRow(0);

        for (Entry<String, KeyStroke> keyCombination : keyCombinations.entrySet()) {
            String description = keyCombination.getKey();
            KeyStroke keyStroke = keyCombination.getValue();
            model.addRow(StringUtils.arrayOf(description, keyStroke.toString().replaceAll(" pressed ", " ")));
        }
    }

    dialog.setVisible(true);
}

From source file:com.net2plan.gui.utils.onlineSimulationPane.OnlineSimulationPane.java

/**
 * Shows the future event list.//from w w  w.  j a va  2  s. c o m
 *
 * @since 0.3.0
 */
public void viewFutureEventList() {
    final JDialog dialog = new JDialog();
    dialog.setTitle("Future event list");
    SwingUtils.configureCloseDialogOnEscape(dialog);
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    dialog.setSize(new Dimension(500, 300));
    dialog.setLocationRelativeTo(null);
    dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    dialog.setLayout(new MigLayout("fill, insets 0 0 0 0"));

    final String[] tableHeader = StringUtils.arrayOf("Id", "Time", "Priority", "Type", "To module",
            "Custom object");
    Object[][] data = new Object[1][tableHeader.length];

    DefaultTableModel model = new ClassAwareTableModel();
    model.setDataVector(new Object[1][tableHeader.length], tableHeader);

    JTable table = new AdvancedJTable(model);
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);
    JScrollPane scrollPane = new JScrollPane(table);
    dialog.add(scrollPane, "grow");

    PriorityQueue<SimEvent> futureEventList = simKernel.getSimCore().getFutureEventList().getPendingEvents();
    if (!futureEventList.isEmpty()) {
        int numEvents = futureEventList.size();
        SimEvent[] futureEventList_array = futureEventList.toArray(new SimEvent[numEvents]);
        Arrays.sort(futureEventList_array, futureEventList.comparator());
        data = new Object[numEvents][tableHeader.length];

        for (int eventId = 0; eventId < numEvents; eventId++) {
            //            List<SimAction> actions = futureEventList_array[eventId].getEventActionList();
            Object customObject = futureEventList_array[eventId].getEventObject();
            data[eventId][0] = eventId;
            data[eventId][1] = StringUtils
                    .secondsToYearsDaysHoursMinutesSeconds(futureEventList_array[eventId].getEventTime());
            data[eventId][2] = futureEventList_array[eventId].getEventPriority();
            data[eventId][3] = futureEventList_array[eventId].getEventType();
            data[eventId][4] = futureEventList_array[eventId].getEventDestinationModule().toString();
            data[eventId][5] = customObject == null ? "none" : customObject;
        }
    }

    model.setDataVector(data, tableHeader);
    table.getTableHeader().addMouseListener(new ColumnFitAdapter());
    table.setDefaultRenderer(Double.class, new CellRenderers.NumberCellRenderer());

    dialog.setVisible(true);
}

From source file:com.apatar.webdav.WebDavNode.java

@Override
public void createDatabaseParam(Wizard wizard) {
    JDialog wd = wizard.getDialog();

    wd.setTitle(title + " Property");

    try {//from  w w w .ja va2 s .com
        WizardPanelDescriptor descriptor1 = new DBConnectionDescriptor(this,
                new JPropertySheetPage(wizard.getDialog()), WebDavFolderTreeDescriptor.IDENTIFIER,
                ApplicationData.classForName("com.apatar.webdav.WebDavConnection"), "db_connector", "webdav");
        wizard.registerWizardPanel(DBConnectionDescriptor.IDENTIFIER, descriptor1);

        WizardPanelDescriptor descriptor2 = new WebDavFolderTreeDescriptor(this,
                DBConnectionDescriptor.IDENTIFIER, WebDavModeDescriptor.IDENTIFIER);
        wizard.registerWizardPanel(WebDavFolderTreeDescriptor.IDENTIFIER, descriptor2);

        WizardPanelDescriptor descriptor3 = new WebDavModeDescriptor(this,
                WebDavFolderTreeDescriptor.IDENTIFIER, WizardPanelDescriptor.FINISH);
        wizard.registerWizardPanel(WebDavModeDescriptor.IDENTIFIER, descriptor3);

        wizard.setKeyForReferringToDescription("help.connector.webdav");
        wizard.setCurrentPanel(DBConnectionDescriptor.IDENTIFIER, Wizard.NEXT_BUTTON_ACTION_COMMAND);

        wizard.showModalDialog();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.eviware.soapui.support.SoapUIVersionUpdate.java

public void showNewVersionDownloadDialog() {

    JPanel versionUpdatePanel = new JPanel(new BorderLayout());
    JDialog dialog = new JDialog();
    versionUpdatePanel.add(UISupport.buildDescription("New Version of SoapUI is Available", "", null),
            BorderLayout.NORTH);//from w w w.j a  va  2s. com
    JEditorPane text = createReleaseNotesPane();
    JScrollPane scb = new JScrollPane(text);
    versionUpdatePanel.add(scb, BorderLayout.CENTER);
    JPanel toolbar = buildToolbar(dialog);
    versionUpdatePanel.add(toolbar, BorderLayout.SOUTH);
    dialog.setTitle("New Version Update");

    dialog.setModal(true);
    dialog.getContentPane().add(versionUpdatePanel);
    dialog.setSize(new Dimension(500, 640));
    UISupport.centerDialog(dialog, SoapUI.getFrame());
    dialog.setVisible(true);
}

From source file:idontwant2see.IDontWant2See.java

public ActionMenu getButtonAction() {
    final ContextMenuAction baseAction = new ContextMenuAction(mLocalizer.msg("name", "I don't want to see!"),
            createImageIcon("apps", "idontwant2see", 16));

    final ContextMenuAction openExclusionList = new ContextMenuAction(
            mLocalizer.msg("editExclusionList", "Edit exclusion list"),
            createImageIcon("apps", "idontwant2see", 16));
    openExclusionList.putValue(Plugin.BIG_ICON, createImageIcon("apps", "idontwant2see", 22));
    openExclusionList.setActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            final Window w = UiUtilities.getLastModalChildOf(getParentFrame());

            JDialog temDlg = null;

            if (w instanceof JDialog) {
                temDlg = new JDialog((JDialog) w, true);
            } else {
                temDlg = new JDialog((JFrame) w, true);
            }/*from   ww w  .j  a v  a2s . co  m*/

            final JDialog exclusionListDlg = temDlg;
            exclusionListDlg.setTitle(mLocalizer.msg("name", "I don't want to see!") + " - "
                    + mLocalizer.msg("editExclusionList", "Edit exclusion list"));

            UiUtilities.registerForClosing(new WindowClosingIf() {
                public void close() {
                    exclusionListDlg.dispose();
                }

                public JRootPane getRootPane() {
                    return exclusionListDlg.getRootPane();
                }
            });

            final ExclusionTablePanel exclusionPanel = new ExclusionTablePanel(mSettings);

            final JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
            ok.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent e) {
                    exclusionPanel.saveSettings(mSettings);
                    exclusionListDlg.dispose();
                }
            });

            final JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
            cancel.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent e) {
                    exclusionListDlg.dispose();
                }
            });

            final FormLayout layout = new FormLayout("0dlu:grow,default,3dlu,default",
                    "fill:500px:grow,2dlu,default,5dlu,default");
            layout.setColumnGroups(new int[][] { { 2, 4 } });

            final CellConstraints cc = new CellConstraints();
            final PanelBuilder pb = new PanelBuilder(layout, (JPanel) exclusionListDlg.getContentPane());
            pb.setDefaultDialogBorder();

            pb.add(exclusionPanel, cc.xyw(1, 1, 4));
            pb.addSeparator("", cc.xyw(1, 3, 4));
            pb.add(ok, cc.xy(2, 5));
            pb.add(cancel, cc.xy(4, 5));

            layoutWindow("exclusionListDlg", exclusionListDlg, new Dimension(600, 450));
            exclusionListDlg.setVisible(true);
        }
    });

    final ContextMenuAction undo = new ContextMenuAction(
            mLocalizer.msg("undoLastExclusion", "Undo last exclusion"),
            createImageIcon("actions", "edit-undo", 16));
    undo.putValue(Plugin.BIG_ICON, createImageIcon("actions", "edit-undo", 22));
    undo.setActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            String lastEnteredExclusionString = mSettings.getLastEnteredExclusionString();
            if (lastEnteredExclusionString.length() > 0) {
                for (int i = mSettings.getSearchList().size() - 1; i >= 0; i--) {
                    if (mSettings.getSearchList().get(i).getSearchText().equals(lastEnteredExclusionString)) {
                        mSettings.getSearchList().remove(i);
                    }
                }

                mSettings.setLastEnteredExclusionString("");

                updateFilter(true);
            }
        }
    });

    return new ActionMenu(baseAction, new Action[] { openExclusionList, undo });
}

From source file:org.fhcrc.cpl.viewer.ms2.Fractionation2DUtilities.java

public static void showHeatMapChart(FractionatedAMTDatabaseStructure amtDatabaseStructure,
        double[] dataForChart, String chartName, boolean showLegend) {
    int chartWidth = 1000;
    int chartHeight = 1000;

    double globalMinValue = Double.MAX_VALUE;
    double globalMaxValue = Double.MIN_VALUE;

    for (double value : dataForChart) {
        if (value < globalMinValue)
            globalMinValue = value;/*from  w  w w .  jav a2 s.com*/
        if (value > globalMaxValue)
            globalMaxValue = value;
    }

    _log.debug("showHeatMapChart: experiment structures:");
    List<double[][]> amtPeptidesInExperiments = new ArrayList<double[][]>();
    for (int i = 0; i < amtDatabaseStructure.getNumExperiments(); i++) {
        int experimentWidth = amtDatabaseStructure.getExperimentStructure(i).columns;
        int experimentHeight = amtDatabaseStructure.getExperimentStructure(i).rows;
        _log.debug("\t" + amtDatabaseStructure.getExperimentStructure(i));
        amtPeptidesInExperiments.add(new double[experimentWidth][experimentHeight]);
    }
    for (int i = 0; i < dataForChart.length; i++) {
        Pair<Integer, int[]> positionInExperiments = amtDatabaseStructure.calculateExperimentAndPosition(i);
        int xpos = positionInExperiments.second[0];
        int ypos = positionInExperiments.second[1];
        int experimentIndex = positionInExperiments.first;
        //System.err.println("i, xpos, ypos: " + i + ", " + xpos + ", " + ypos);            
        amtPeptidesInExperiments.get(experimentIndex)[xpos][ypos] = dataForChart[i];

    }

    JDialog cd = new JDialog(ApplicationContext.getFrame(), "Heat Map(s)");
    cd.setSize(chartWidth, chartHeight);
    cd.setPreferredSize(new Dimension(chartWidth, chartHeight));
    cd.setLayout(new FlowLayout());

    int nextPerfectSquareRoot = 0;
    while (true) {
        nextPerfectSquareRoot++;
        if ((nextPerfectSquareRoot * nextPerfectSquareRoot) >= amtPeptidesInExperiments.size()) {
            break;
        }
    }

    int plotWidth = (int) ((double) (chartWidth - 20) / (double) nextPerfectSquareRoot);
    int plotHeight = (int) ((double) (chartHeight - 20) / (double) nextPerfectSquareRoot);

    _log.debug("Rescaled chart dimensions: " + plotWidth + "x" + plotHeight);

    LookupPaintScale paintScale = PanelWithHeatMap.createPaintScale(globalMinValue, globalMaxValue, Color.BLUE,
            Color.RED);

    for (int i = 0; i < amtPeptidesInExperiments.size(); i++) {
        PanelWithHeatMap pwhm = new PanelWithHeatMap(amtPeptidesInExperiments.get(i), "Experiment " + (i + 1));
        //            pwhm.setPalette(PanelWithHeatMap.PALETTE_BLUE_RED);
        pwhm.setPaintScale(paintScale);
        pwhm.setPreferredSize(new Dimension(plotWidth, plotHeight));
        pwhm.setAxisLabels("AX Fraction", "RP Fraction");
        if (!showLegend)
            pwhm.getChart().removeLegend();
        cd.add(pwhm);
    }
    cd.setTitle(chartName);
    cd.setVisible(true);
}

From source file:com.anrisoftware.prefdialog.spreadsheetimportdialog.dialog.SpreadsheetImportDialogWorker.java

@Override
protected JDialog createDialog() {
    JDialog jdialog = new JDialog(parentWindow, APPLICATION_MODAL);
    jdialog.setLocale(getLocale());//from w ww . ja v  a  2 s. co  m
    SpreadsheetImportDialog importDialog;
    importDialog = spreadsheetImportDialogFactory.create(savedProperties);
    importDialog.setParentInjector(parent);
    importDialog.setDialog(jdialog);
    importDialog.createDialog(parentWindow, importerFactory);
    setupSavedProperties(properties, savedProperties);
    importDialog.setPropertiesNoChecks(properties);
    jdialog.pack();
    jdialog.setSize(size);
    jdialog.setTitle(getDialogTitleFromResource());
    jdialog.setLocationRelativeTo(parentWindow);
    insertListeners(importDialog);
    this.importDialog = new SoftReference<SpreadsheetImportDialog>(importDialog);
    return jdialog;
}