Example usage for javax.swing JSplitPane setDividerLocation

List of usage examples for javax.swing JSplitPane setDividerLocation

Introduction

In this page you can find the example usage for javax.swing JSplitPane setDividerLocation.

Prototype

@BeanProperty(description = "The location of the divider.")
public void setDividerLocation(int location) 

Source Link

Document

Sets the location of the divider.

Usage

From source file:gchisto.gui.panels.gctimeline.ChartPanel.java

/**
 * It creates a chart for the given dataset and adds the chart to the panel.
 *
 * @param dataset The dataset that will provide the values for the chart.
 *//*from   www.j av a 2 s .co  m*/
private void addChart() {
    JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), "Elapsed Time (sec)", false,
            "Time" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false);
    chart.addProgressListener(locker);
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setToolTipGenerator(dataset);

    groupActivatingTable = new GroupActivatingPanel(dataset, locker);

    org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart);
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, groupActivatingTable, chartPanel);
    splitPane.setDividerLocation(200);
    mainPanel().add(BorderLayout.CENTER, splitPane);
}

From source file:gchisto.gui.panels.gcdistribution.ChartPanelSingle.java

/**
 * It creates a chart for the given dataset and adds the chart to the panel.
 *
 * @param dataset The dataset that will provide the values for the chart.
 *///from  ww  w . java 2s.  c  om
private void addChart() {
    JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), "Buckets (sec)", false, "Count", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.addProgressListener(locker);
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setToolTipGenerator(dataset);

    groupActivatingPanel = new GroupActivatingPanel(dataset, locker);

    org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart);
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, groupActivatingPanel, chartPanel);
    splitPane.setDividerLocation(200);
    mainPanel().add(BorderLayout.CENTER, splitPane);
}

From source file:org.datacleaner.widgets.result.CategorizationResultSwingRenderer.java

@Override
public JComponent render(CategorizationResult analyzerResult) {
    final DefaultPieDataset dataset = new DefaultPieDataset();
    final Collection<String> categoryNames = analyzerResult.getCategoryNames();
    for (String categoryName : categoryNames) {
        final Number count = analyzerResult.getCategoryCount(categoryName);
        dataset.setValue(categoryName, count);
    }//from   w w  w  . j  a  va2s .  c o  m

    final DefaultTableModel model = prepareModel(analyzerResult, dataset);

    final DCTable table = new DCTable(model);
    table.setColumnControlVisible(false);
    table.setRowHeight(22);

    final JFreeChart chart = ChartFactory.createPieChart(null, dataset, true, false, false);
    ChartUtils.applyStyles(chart);

    final ChartPanel chartPanel = ChartUtils.createPanel(chart, false);

    final DCPanel leftPanel = WidgetUtils.decorateWithShadow(chartPanel);

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new VerticalLayout());
    rightPanel.add(WidgetUtils.decorateWithShadow(table.toPanel()));

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:com.choicemaker.cm.modelmaker.gui.panels.AsymmetricThresholdVsAccuracyPlotPanel.java

private void layoutPanel() {
    setLayout(new BorderLayout());
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setDividerSize(2);/*from  w w w . j a v  a2s  .c o m*/
    splitPane.setContinuousLayout(true);
    splitPane.setDividerLocation(0.5d);
    splitPane.setResizeWeight(0.5f);
    splitPane.setOneTouchExpandable(true);
    ChartPanel dP = new ChartPanel(dPlot, false, false, false, true, true);
    //      dP.setHorizontalZoom(true);
    //      dP.setVerticalZoom(true);
    splitPane.setTopComponent(dP);
    ChartPanel mP = new ChartPanel(mPlot, false, false, false, true, true);
    //      mP.setHorizontalZoom(true);
    //      mP.setVerticalZoom(true);
    splitPane.setBottomComponent(mP);
    add(splitPane, BorderLayout.CENTER);
}

From source file:ec.ui.view.res.ResidualsView.java

public ResidualsView() {
    this.chartPanel = new ChartPanel(buildResidualViewChart());
    Charts.avoidScaling(chartPanel);/*w  ww .  j a  v  a  2 s .  c o m*/
    this.grid = new JTsGrid();
    this.grid.setTsUpdateMode(TsUpdateMode.None);
    this.grid.setMode(Mode.SINGLETS);

    onDataFormatChange();
    onColorSchemeChange();
    onComponentPopupMenuChange();

    enableProperties();

    JSplitPane splitPane = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chartPanel, grid);
    splitPane.setDividerLocation(0.5);
    splitPane.setResizeWeight(.5);
    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);
}

From source file:org.datacleaner.widgets.result.UniqueKeyCheckAnalyzerResultSwingRenderer.java

@Override
public JComponent render(UniqueKeyCheckAnalyzerResult result) {
    final int nullCount = result.getNullCount();
    final int nonUniqueCount = result.getNonUniqueCount();

    final DefaultKeyedValues keyedValues = new DefaultKeyedValues();
    keyedValues.addValue("Unique keys", result.getUniqueCount());

    final List<Title> subTitles = new ArrayList<Title>();
    subTitles.add(new ShortTextTitle("Row count: " + result.getRowCount()));
    subTitles.add(new ShortTextTitle("Unique key count: " + result.getUniqueCount()));

    if (nonUniqueCount > 0) {
        keyedValues.addValue("Non-unique keys", nonUniqueCount);
        subTitles.add(new ShortTextTitle("Non-unique key count: " + nonUniqueCount));
    }/*from w w w.  ja  v a2s  .  c o  m*/

    final String title;
    if (nullCount == 0) {
        title = "Unique and non-unique keys";
    } else {
        keyedValues.addValue(LabelUtils.NULL_LABEL, nullCount);
        title = "Unique, non-unique and <null> keys";
        subTitles.add(new ShortTextTitle("<null> key count: " + result.getNullCount()));
    }

    final DefaultPieDataset dataset = new DefaultPieDataset(keyedValues);
    final JFreeChart chart = ChartFactory.createRingChart(title, dataset, true, true, false);

    chart.setSubtitles(subTitles);

    ChartUtils.applyStyles(chart);
    ChartPanel chartPanel = ChartUtils.createPanel(chart, false);

    final DCPanel leftPanel = new DCPanel();
    leftPanel.setLayout(new VerticalLayout());
    leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel));

    final Map<String, Integer> samples = result.getNonUniqueSamples();
    if (samples == null || samples.isEmpty()) {
        return leftPanel;
    }

    final DefaultTableModel samplesTableModel = new DefaultTableModel(new String[] { "Key", "Count" }, 0);
    for (final Entry<String, Integer> entry : samples.entrySet()) {
        final String key = entry.getKey();
        final Integer count = entry.getValue();
        samplesTableModel.addRow(new Object[] { key, count });
    }
    final DCTable samplesTable = new DCTable(samplesTableModel);

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(DCLabel.dark("Sample non-unique keys:"));
    rightPanel.add(samplesTable.toPanel(), BorderLayout.CENTER);

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:org.eobjects.datacleaner.widgets.result.UniqueKeyCheckAnalyzerResultSwingRenderer.java

@Override
public JComponent render(UniqueKeyCheckAnalyzerResult result) {
    final int nullCount = result.getNullCount();
    final int nonUniqueCount = result.getNonUniqueCount();

    final DefaultKeyedValues keyedValues = new DefaultKeyedValues();
    keyedValues.addValue("Unique keys", result.getUniqueCount());

    final List<Title> subTitles = new ArrayList<Title>();
    subTitles.add(new ShortTextTitle("Row count: " + result.getRowCount()));
    subTitles.add(new ShortTextTitle("Unique key count: " + result.getUniqueCount()));

    if (nonUniqueCount > 0) {
        keyedValues.addValue("Non-unique keys", nonUniqueCount);
        subTitles.add(new ShortTextTitle("Non-unique key count: " + nonUniqueCount));
    }/*from   w  w  w. j a va 2  s  . c  om*/

    final String title;
    if (nullCount == 0) {
        title = "Unique and non-unique keys";
    } else {
        keyedValues.addValue(LabelUtils.NULL_LABEL, nullCount);
        title = "Unique, non-unique and <null> keys";
        subTitles.add(new ShortTextTitle("<null> key count: " + result.getNullCount()));
    }

    final DefaultPieDataset dataset = new DefaultPieDataset(keyedValues);
    final JFreeChart chart = ChartFactory.createRingChart(title, dataset, true, true, false);

    chart.setSubtitles(subTitles);

    ChartUtils.applyStyles(chart);
    ChartPanel chartPanel = new ChartPanel(chart);

    final DCPanel leftPanel = new DCPanel();
    leftPanel.setLayout(new VerticalLayout());
    leftPanel.add(WidgetUtils.decorateWithShadow(chartPanel, true, 4));

    final Map<String, Integer> samples = result.getNonUniqueSamples();
    if (samples == null || samples.isEmpty()) {
        return leftPanel;
    }

    final DefaultTableModel samplesTableModel = new DefaultTableModel(new String[] { "Key", "Count" }, 0);
    for (final Entry<String, Integer> entry : samples.entrySet()) {
        final String key = entry.getKey();
        final Integer count = entry.getValue();
        samplesTableModel.addRow(new Object[] { key, count });
    }
    final DCTable samplesTable = new DCTable(samplesTableModel);

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(DCLabel.dark("Sample non-unique keys:"));
    rightPanel.add(samplesTable.toPanel(), BorderLayout.CENTER);

    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);

    return split;
}

From source file:edu.purdue.cc.bionet.ui.MoleculeDetailPanel.java

public MoleculeDetailPanel(Molecule molecule, Range range, DetailWindow detailWindow, int correlationMethod) {
    super(new BorderLayout());
    Logger logger = Logger.getLogger(getClass());
    this.molecule = molecule;
    this.correlations = detailWindow.getCorrelations();
    this.correlationMethod = correlationMethod;
    logger.debug(String.format("Showing Molecule detail:\n" + "\tMolecule:   %s\n\tRange:      %s\n",
            this.molecule, range));
    this.correlationRange = range.clone();
    this.detailWindow = detailWindow;

    Language language = Settings.getLanguage();
    this.moleculeDetailTable = DataTable.getMoleculeTable(this.correlations, this.molecule);
    this.correlationsTable = DataTable.getCorrelatedTable(this.correlations, this.molecule,
            this.correlationRange, this.correlationMethod);
    this.selectedMoleculeLabel = new JLabel(language.get("Selected Molecule"));
    this.showElementButton = new JButton(language.get("Show Element"));
    this.showCorrelationButton = new JButton(language.get("Show Correlation"));
    this.coefLabel = new JLabel(String.format(language.get("Correlations between %.3f and %.3f"),
            this.correlationRange.getMin(), this.correlationRange.getMax()));
    //      JPanel leftPanel = new JPanel( new BorderLayout( ));
    //      JPanel rightPanel = new JPanel( new BorderLayout( ));
    JPanel moleculePanel = new JPanel(new BorderLayout());
    JPanel correlationPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel(new BorderLayout());
    this.showElementButton.addActionListener(this);
    this.showCorrelationButton.addActionListener(this);
    buttonPanel.add(this.showElementButton, BorderLayout.WEST);
    buttonPanel.add(this.showCorrelationButton, BorderLayout.EAST);

    moleculePanel.add(this.selectedMoleculeLabel, BorderLayout.NORTH);
    moleculePanel.add(new JScrollPane(this.moleculeDetailTable), BorderLayout.CENTER);

    correlationPanel.add(this.coefLabel, BorderLayout.NORTH);
    correlationPanel.add(new JScrollPane(this.correlationsTable), BorderLayout.CENTER);
    correlationPanel.add(buttonPanel, BorderLayout.SOUTH);

    JSplitPane leftPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, moleculePanel, correlationPanel);
    leftPanel.setDividerLocation(200);
    //      leftPanel.add( moleculePanel, BorderLayout.NORTH );
    //      leftPanel.add( correlationPanel, BorderLayout.CENTER );

    JPanel rightPanel = new ResponseGraph(this.molecule.getSampleMap(this.correlations.getSamples()));

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
    splitPane.setDividerLocation(300);//from  www. j a  va 2s.  c  om
    this.add(splitPane, BorderLayout.CENTER);
}

From source file:gui.accessories.BattleSimFx.java

@Override
public void init() {
    tableModel = new SampleTableModel();
    // create javafx panel for charts
    chartFxPanel = new JFXPanel();
    chartFxPanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, PANEL_HEIGHT_INT));

    //JTable//  w  w  w.ja v  a  2s.c  o  m
    JTable table = new JTable(tableModel);
    table.setAutoCreateRowSorter(true);
    table.setGridColor(Color.DARK_GRAY);
    BattleSimFx.DecimalFormatRenderer renderer = new BattleSimFx.DecimalFormatRenderer();
    renderer.setHorizontalAlignment(JLabel.RIGHT);
    for (int i = 0; i < table.getColumnCount(); i++) {
        table.getColumnModel().getColumn(i).setCellRenderer(renderer);
    }
    JScrollPane tablePanel = new JScrollPane(table);
    tablePanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, TABLE_PANEL_HEIGHT_INT));

    JPanel chartTablePanel = new JPanel();
    chartTablePanel.setLayout(new BorderLayout());

    //Split pane that holds both chart and table
    JSplitPane jsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    jsplitPane.setTopComponent(chartTablePanel);
    jsplitPane.setBottomComponent(tablePanel);
    jsplitPane.setDividerLocation(410);
    chartTablePanel.add(chartFxPanel, BorderLayout.CENTER);

    //          add(tablePanel, BorderLayout.CENTER);
    add(jsplitPane, BorderLayout.CENTER);

    // create JavaFX scene
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            createScene();
        }
    });
}

From source file:SplitPaneDemo2.java

public SplitPaneDemo2() {
    super("SplitPaneDemo2");

    //Create an instance of SplitPaneDemo
    SplitPaneDemo splitPaneDemo = new SplitPaneDemo();
    JSplitPane top = splitPaneDemo.getSplitPane();
    splitPaneDemo.getImageList().addListSelectionListener(this);

    //XXXX: Bug #4131528, borders on nested split panes accumulate.
    //Workaround: Set the border on any split pane within
    //another split pane to null. Components within nested split
    //panes need to have their own border for this to work well.
    top.setBorder(null);//from   w  ww.j  a v  a2s.  c  o m

    //Create a regular old label
    label = new JLabel("Click on an image name in the list.", JLabel.CENTER);

    //Create a split pane and put "top" (a split pane)
    //and JLabel instance in it.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, label);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(180);

    //Provide minimum sizes for the two components in the split pane
    top.setMinimumSize(new Dimension(100, 50));
    label.setMinimumSize(new Dimension(100, 30));

    //Add the split pane to this frame
    getContentPane().add(splitPane);
}