Example usage for javax.swing JDialog add

List of usage examples for javax.swing JDialog add

Introduction

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

Prototype

public Component add(Component comp) 

Source Link

Document

Appends the specified component to the end of this container.

Usage

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);//  w w  w  . ja v  a2  s  .  c om
    view.iniciaVista();
    dialog.add(view);
    dialog.validate();
    dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}

From source file:org.nekorp.workflow.desktop.view.resource.imp.WizardDialogFactory.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("Nuevo Servicio");
    wizard.setParentWindow(dialog);//  w  w w  . j ava 2  s  . c  o m
    wizard.iniciaVista();
    dialog.add(wizard);
    dialog.validate();
    dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}

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

@Override
public JDialog createDialog(Frame frame, boolean modal) {
    HistorialServiciosJTableModel model = new HistorialServiciosJTableModel();
    model.setDatos(historialController.getHistorial());
    JDialog dialog = new JDialog(mainFrame, true);
    dialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setTitle("Historial Servicio");
    historialView.setParent(dialog);//from  w  ww.  j a  va 2 s  .c  om
    historialView.iniciaVista();
    historialView.setHistoricoModel(model);
    dialog.add(historialView);
    dialog.validate();
    dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}

From source file:org.nekorp.workflow.desktop.view.resource.imp.ServicioPreviewDialogFactory.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("Consulta Servicio " + " Nmero: " + viewServicioModel.getId());
    servicioPreview.setParent(dialog);/*from   w  w  w  .j ava 2 s .c om*/
    servicioPreview.iniciaVista();
    servicioPreview.setEditableStatus(false);
    dialog.add(servicioPreview);
    dialog.validate();
    dialog.pack();
    dialog.setLocationRelativeTo(mainFrame);
    return dialog;
}

From source file:dk.cubing.liveresults.uploader.engine.ResultsEngine.java

/**
 * Create preferences dialog/*from www . j av a2s.  c om*/
 */
public void createAndShowPreferencesDialog() {
    JDialog dialog = new JDialog(frame, "Preferences");
    dialog.add(new PreferencesPanel(dialog, this));
    dialog.setResizable(false);
    dialog.pack();
    dialog.setVisible(true);
}

From source file:edu.ucla.stat.SOCR.motionchart.MotionMouseListener.java

/**
 * Callback method for receiving notification of a mouse click on a chart.
 *
 * @param event information about the event.
 *///from   w w  w . j av a2s . co  m
public void chartMouseClicked(ChartMouseEvent event) {
    if (event.getTrigger().getClickCount() > 1) {
        if (event.getEntity() instanceof XYItemEntity) {
            XYItemEntity item = (XYItemEntity) event.getEntity();
            Component c = event.getTrigger().getComponent();
            final JDialog dialog = new JDialog(JOptionPane.getFrameForComponent(c), "Item Data", false);
            dialog.setSize(400, 300);
            dialog.setLocation(getDialogLocation(dialog, c));
            dialog.add(getItemPanel(dialog, item, event));
            dialog.setVisible(true);
        } else {
            XYItemEntity item = (XYItemEntity) event.getEntity();
            Component c = event.getTrigger().getComponent();
            final JDialog dialog = new JDialog(JOptionPane.getFrameForComponent(c), "Item Data", false);
            dialog.setSize(400, 300);
            dialog.setLocation(getDialogLocation(dialog, c));
            dialog.add(getSeriesPanel(dialog, event));
            dialog.setVisible(true);
        }
    } else {
        if (!(event.getChart().getXYPlot().getRenderer() instanceof MotionBubbleRenderer)) {
            return;
        }

        MotionBubbleRenderer renderer = (MotionBubbleRenderer) event.getChart().getXYPlot().getRenderer();
        MotionDataSet dataset = (MotionDataSet) event.getChart().getXYPlot().getDataset();

        if (event.getEntity() instanceof XYItemEntity) {
            boolean selected;
            XYItemEntity entity = (XYItemEntity) event.getEntity();
            int series = entity.getSeriesIndex();
            int item = entity.getItem();
            Object category = dataset.getCategory(series, item);

            if (category == null) {
                selected = !renderer.isSelectedItem(series, item);
                renderer.setSelectedItem(series, item, selected);
            } else {
                selected = !renderer.isSelectedCategory(category);
                renderer.setSelectedCategory(category, selected);
            }
        }
    }
}

From source file:biomine.bmvis2.pipeline.sources.QueryGraphSource.java

@Override
public BMGraph getBMGraph() throws GraphOperationException {
    try {//  w  ww. j a  v a2s  .c  o  m
        if (fetch == null) {
            fetch = new CrawlerFetch(query, neighborhood, database);
        }
        if (ret == null) {
            final JDialog dial = new JDialog((JFrame) null);

            dial.setTitle("BMVIS II - Query to database");
            dial.setSize(400, 200);
            dial.setMinimumSize(new Dimension(400, 200));
            dial.setResizable(false);
            final JTextArea text = new JTextArea();
            text.setEditable(false);

            dial.add(text);
            text.setText("...");

            class Z {
                Exception runExc = null;
            }

            final Z z = new Z();
            Runnable fetchThread = new Runnable() {
                public void run() {
                    try {
                        long startTime = System.currentTimeMillis();
                        while (!fetch.isDone()) {
                            fetch.update();
                            Thread.sleep(500);
                            long time = System.currentTimeMillis();
                            long elapsed = time - startTime;

                            if (elapsed > 30000) {
                                throw new GraphOperationException("Timeout while querying " + query);
                            }
                            final String newText = fetch.getState() + ":\n" + fetch.getMessages();
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    text.setText(newText);
                                }
                            });
                        }

                        SwingUtilities.invokeAndWait(new Runnable() {
                            public void run() {
                                dial.setVisible(false);
                            }
                        });

                    } catch (Exception e) {
                        z.runExc = e;
                    }

                }

            };

            new Thread(fetchThread).start();
            dial.setModalityType(ModalityType.APPLICATION_MODAL);
            dial.setVisible(true);
            ret = fetch.getBMGraph();
            if (ret == null)
                throw new GraphOperationException(fetch.getMessages());
            if (z.runExc != null) {
                if (z.runExc instanceof GraphOperationException)
                    throw (GraphOperationException) z.runExc;
                else
                    throw new GraphOperationException(z.runExc);
            }
        }

    } catch (IOException e) {
        throw new GraphOperationException(e);
    }
    updateInfo();
    return ret;
}

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 .  j a v  a2s .c  om*/
        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:de.cismet.verdis.CidsAppBackend.java

/**
 * DOCUMENT ME!// www  .ja va 2 s  .  c  om
 *
 * @param  locks  DOCUMENT ME!
 */
public void showObjectsLockedDialog(final Collection<CidsBean> locks) {
    final JDialog dialog = new JDialog((JFrame) null, "Gesperrte Objekte...", true);
    dialog.add(new AlreadyLockedObjectsPanel(locks));
    dialog.setResizable(false);
    dialog.pack();
    StaticSwingTools.showDialog(dialog);
}

From source file:org.fhcrc.cpl.viewer.amt.AmtDatabaseMatcher.java

/**
 * Separating this out so the interesting code flows better
 * @param matchingResult// w  ww  . j  av a  2s . co m
 */
public void createMassTimeErrorPlots(FeatureSetMatcher.FeatureMatchingResult matchingResult) {

    int numUnambiguousMatches = 0;
    for (Feature ms1Feature : matchingResult.getMasterSetFeatures()) {
        if (matchingResult.get(ms1Feature).size() == 1)
            numUnambiguousMatches++;
    }
    double[] ms1FeatureMasses = new double[numUnambiguousMatches];
    double[] ms1FeatureHydrophobicities = new double[numUnambiguousMatches];
    double[] massErrorData = new double[numUnambiguousMatches];
    double[] elutionErrorData = new double[numUnambiguousMatches];
    int i = 0;
    for (Feature ms1Feature : matchingResult.getMasterSetFeatures()) {
        ms1FeatureMasses[i] = ms1Feature.getMass();
        ms1FeatureHydrophobicities[i] = AmtExtraInfoDef.getObservedHydrophobicity(ms1Feature);

        if (matchingResult.get(ms1Feature).size() > 1)
            continue;

        Feature matchedAmtFeature = matchingResult.get(ms1Feature).get(0);
        //convert to ppm
        massErrorData[i] = (ms1Feature.getMass() - matchedAmtFeature.getMass())
                * (1000000 / ms1Feature.getMass());
        //System.err.println("Error: " + histogramData[i-1] + ", " +ms1Feature.getMass() + ", " + result.get(ms1Feature).get(0).getMass());

        elutionErrorData[i] = (AmtExtraInfoDef.getObservedHydrophobicity(ms1Feature)
                - (AmtExtraInfoDef.getObservedHydrophobicity(matchedAmtFeature)));
        i++;
    }

    //3D mass-elution histogram
    JDialog perspDialog = new JDialog();
    perspDialog.setSize(1000, 800);
    massTimeErrorPerspectivePlot = new PanelWithRPerspectivePlot();
    massTimeErrorPerspectivePlot.setChartHeight(800);
    massTimeErrorPerspectivePlot.setChartWidth(1000);

    massTimeErrorPerspectivePlot.setSize(1000, 800);
    massTimeErrorPerspectivePlot.setTiltAngle(25);
    massTimeErrorPerspectivePlot.setRotationAngle(-30);
    massTimeErrorPerspectivePlot.setAxisRVariableNames("Hydrophobicity", "Mass_ppm", "Matches");
    double xBinSize = .002;
    double yBinSize = 1;
    massTimeErrorPerspectivePlot.plotPointsSummary(elutionErrorData, massErrorData, xBinSize, yBinSize);
    perspDialog.add(massTimeErrorPerspectivePlot);
    perspDialog.setVisible(true);

    //scatterplot of mass vs. deltaMass
    ScatterPlotDialog spd = new ScatterPlotDialog(ms1FeatureMasses, massErrorData,
            "MS1 feature mass vs. (signed) match mass error");
    spd.setAxisLabels("MS1 Feature Mass", "PPM error (MS1 - AMT)");
    massDeltaMassScatterPlot = spd.getPanelWithScatterPlot().getChart();
    spd.setVisible(true);

    //scatterplot of hydrophobicity error vs. mass error
    ScatterPlotDialog spdHandM = new ScatterPlotDialog(elutionErrorData, massErrorData,
            "MS1 feature mass error vs. H error");
    spdHandM.setAxisLabels("H error", "PPM error");
    spdHandM.setVisible(true);
}