Example usage for javax.swing JInternalFrame setPreferredSize

List of usage examples for javax.swing JInternalFrame setPreferredSize

Introduction

In this page you can find the example usage for javax.swing JInternalFrame setPreferredSize.

Prototype

@BeanProperty(preferred = true, description = "The preferred size of the component.")
public void setPreferredSize(Dimension preferredSize) 

Source Link

Document

Sets the preferred size of this component.

Usage

From source file:guineu.modules.dataanalysis.PCA.PCADataset.java

public void run() {

    setStatus(TaskStatus.PROCESSING);/*ww w  . ja v a2 s .c o  m*/

    logger.info("Computing projection plot");

    double[][] rawData = new double[selectedSamples.length][selectedRows.length];
    for (int rowIndex = 0; rowIndex < selectedRows.length; rowIndex++) {
        PeakListRow peakListRow = selectedRows[rowIndex];
        for (int fileIndex = 0; fileIndex < selectedSamples.length; fileIndex++) {
            String rawDataFile = selectedSamples[fileIndex];
            Object p = peakListRow.getPeak(rawDataFile);
            try {
                rawData[fileIndex][rowIndex] = (Double) p;
            } catch (Exception e) {
                // e.printStackTrace();
            }

        }
    }
    this.progress = 0.25f;

    int numComponents = xAxisPC;
    if (yAxisPC > numComponents) {
        numComponents = yAxisPC;
    }

    PCA pca = new PCA(selectedSamples.length, selectedRows.length);

    Matrix X = new Matrix(rawData, selectedSamples.length, selectedRows.length);

    String[] rowNames = new String[selectedRows.length];
    for (int j = 0; j < selectedRows.length; j++) {
        rowNames[j] = selectedRows[j].getName();
    }

    X = pca.center(X);
    X = pca.scale(X);
    pca.nipals(X, this.selectedSamples, rowNames, this.components);
    mainComponents = pca.getPCs();
    Collections.sort(mainComponents);
    if (status == TaskStatus.CANCELED) {
        return;
    }
    this.progress = 0.75f;

    for (PrincipleComponent comp : mainComponents) {
        this.totalVariation += comp.eigenValue;
    }

    if (mainComponents.size() > yAxisPC - 1) {
        component1Coords = mainComponents.get(xAxisPC - 1).eigenVector;
        component2Coords = mainComponents.get(yAxisPC - 1).eigenVector;

        Desktop desktop = GuineuCore.getDesktop();
        ProjectionPlotWindow newFrame = new ProjectionPlotWindow(this.datasetTitle, this, parameters);
        desktop.addInternalFrame(newFrame);

        if (this.showLoadings) {
            ChartPanel loadings = pca.loadingsplot(this.getXLabel(), this.getYLabel());
            JInternalFrame frame = new JInternalFrame();
            frame.setTitle("Principal Components Analysis: Loadings");
            frame.setResizable(true);
            frame.setClosable(true);
            frame.setMaximizable(true);
            frame.add(loadings, BorderLayout.CENTER);
            frame.setPreferredSize(new Dimension(700, 500));
            frame.pack();
            desktop.addInternalFrame(frame);
        }
    }
    this.progress = 1.0f;
    setStatus(TaskStatus.FINISHED);
    logger.info("Finished computing projection plot.");

}