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:org.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java

public JSplitPane renderGroupResult(final ValueCountingAnalyzerResult result) {
    final Integer distinctCount = result.getDistinctCount();
    final Integer unexpectedValueCount = result.getUnexpectedValueCount();
    final int totalCount = result.getTotalCount();

    _valueCounts = result.getReducedValueFrequencies(_preferredSlices);
    _valueCounts = moveUniqueToEnd(_valueCounts);

    for (ValueFrequency valueCount : _valueCounts) {
        setDataSetValue(valueCount.getName(), valueCount.getCount());
    }/*  w w w. j a va2s .  c  o  m*/

    logger.info("Rendering with {} slices", getDataSetItemCount());
    drillToOverview(result);

    // chart for display of the dataset
    String title = "Value distribution of " + _groupOrColumnName;
    final JFreeChart chart = ChartFactory.createBarChart(title, "Value", "Count", _dataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    List<Title> titles = new ArrayList<Title>();
    titles.add(new ShortTextTitle("Total count: " + totalCount));
    if (distinctCount != null) {
        titles.add(new ShortTextTitle("Distinct count: " + distinctCount));
    }
    if (unexpectedValueCount != null) {
        titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount));
    }
    chart.setSubtitles(titles);

    ChartUtils.applyStyles(chart);

    // code-block for tweaking style and coloring of chart
    {
        final CategoryPlot plot = (CategoryPlot) chart.getPlot();
        plot.getDomainAxis().setVisible(false);

        int colorIndex = 0;
        for (int i = 0; i < getDataSetItemCount(); i++) {
            final String key = getDataSetKey(i);
            final Color color;
            final String upperCaseKey = key.toUpperCase();
            if (_valueColorMap.containsKey(upperCaseKey)) {
                color = _valueColorMap.get(upperCaseKey);
            } else {
                if (i == getDataSetItemCount() - 1) {
                    // the last color should not be the same as the first
                    if (colorIndex == 0) {
                        colorIndex++;
                    }
                }

                Color colorCandidate = SLICE_COLORS[colorIndex];
                int darkAmount = i / SLICE_COLORS.length;
                for (int j = 0; j < darkAmount; j++) {
                    colorCandidate = WidgetUtils.slightlyDarker(colorCandidate);
                }
                color = colorCandidate;

                colorIndex++;
                if (colorIndex >= SLICE_COLORS.length) {
                    colorIndex = 0;
                }
            }

            plot.getRenderer().setSeriesPaint(i, color);
        }
    }

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

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

    _backButton.setMargin(new Insets(0, 0, 0, 0));
    _backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            drillToOverview(result);
        }
    });

    _rightPanel.setLayout(new VerticalLayout());
    _rightPanel.add(_backButton);
    _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:ec.ui.view.RevisionSaSeriesView.java

/**
 * Constructs a new view/*  ww  w . ja v a2 s  .c o m*/
 */
public RevisionSaSeriesView() {
    setLayout(new BorderLayout());

    sRenderer = new XYLineAndShapeRenderer();
    sRenderer.setBaseShapesVisible(false);
    //sRenderer.setSeriesStroke(1, new BasicStroke(0.75f, 1, 1, 1.0f, new float[]{2f, 3f}, 0.0f));
    sRenderer.setBasePaint(themeSupport.getLineColor(ColorScheme.KnownColor.RED));

    revRenderer = new XYLineAndShapeRenderer(false, true);

    mainChart = createMainChart();

    chartpanel_ = new JChartPanel(ChartFactory.createLineChart(null, null, null, null, PlotOrientation.VERTICAL,
            false, false, false));

    documentpanel_ = ComponentFactory.getDefault().newHtmlView();

    JSplitPane splitpane = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chartpanel_,
            NbComponents.newJScrollPane(documentpanel_));
    splitpane.setDividerLocation(0.5);
    splitpane.setResizeWeight(.5);

    popup = new ChartPopup(null, false);

    chartpanel_.addChartMouseListener(new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent e) {
            if (lastIndexSelected != -1) {
                revRenderer.setSeriesShapesFilled(lastIndexSelected, false);
            }
            if (e.getEntity() != null) {
                if (e.getEntity() instanceof XYItemEntity) {
                    XYItemEntity item = (XYItemEntity) e.getEntity();
                    if (item.getDataset().equals(mainChart.getXYPlot().getDataset(REV_INDEX))) {
                        int i = item.getSeriesIndex();

                        revRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6));
                        revRenderer.setSeriesShapesFilled(i, true);
                        revRenderer.setSeriesPaint(i, themeSupport.getLineColor(ColorScheme.KnownColor.BLUE));

                        lastIndexSelected = i;

                        showRevisionPopup(e);
                    }
                }
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    chartpanel_.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(JChartPanel.ZOOM_SELECTION_CHANGED)) {
                showSelectionPopup((Rectangle2D) evt.getNewValue());
            }
        }
    });

    this.add(splitpane, BorderLayout.CENTER);
    splitpane.setResizeWeight(0.5);

    onColorSchemeChange();
}

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

public JSplitPane renderGroupResult(final ValueCountingAnalyzerResult result) {
    final Integer distinctCount = result.getDistinctCount();
    final Integer unexpectedValueCount = result.getUnexpectedValueCount();
    final int totalCount = result.getTotalCount();

    _valueCounts = result.getReducedValueFrequencies(_preferredSlices);
    for (ValueFrequency valueCount : _valueCounts) {
        setDataSetValue(valueCount.getName(), valueCount.getCount());
    }//from w ww. ja  v a  2  s.c o  m

    logger.info("Rendering with {} slices", getDataSetItemCount());
    drillToOverview(result);

    // chart for display of the dataset
    String title = "Value distribution of " + _groupOrColumnName;
    final JFreeChart chart = ChartFactory.createBarChart(title, "Value", "Count", _dataset,
            PlotOrientation.HORIZONTAL, true, true, false);

    List<Title> titles = new ArrayList<Title>();
    titles.add(new ShortTextTitle("Total count: " + totalCount));
    if (distinctCount != null) {
        titles.add(new ShortTextTitle("Distinct count: " + distinctCount));
    }
    if (unexpectedValueCount != null) {
        titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount));
    }
    chart.setSubtitles(titles);

    ChartUtils.applyStyles(chart);

    // code-block for tweaking style and coloring of chart
    {
        final CategoryPlot plot = (CategoryPlot) chart.getPlot();
        plot.getDomainAxis().setVisible(false);

        int colorIndex = 0;
        for (int i = 0; i < getDataSetItemCount(); i++) {
            final String key = getDataSetKey(i);
            final Color color;
            final String upperCaseKey = key.toUpperCase();
            if (_valueColorMap.containsKey(upperCaseKey)) {
                color = _valueColorMap.get(upperCaseKey);
            } else {
                if (i == getDataSetItemCount() - 1) {
                    // the last color should not be the same as the first
                    if (colorIndex == 0) {
                        colorIndex++;
                    }
                }

                Color colorCandidate = SLICE_COLORS[colorIndex];
                int darkAmount = i / SLICE_COLORS.length;
                for (int j = 0; j < darkAmount; j++) {
                    colorCandidate = WidgetUtils.slightlyDarker(colorCandidate);
                }
                color = colorCandidate;

                colorIndex++;
                if (colorIndex >= SLICE_COLORS.length) {
                    colorIndex = 0;
                }
            }

            plot.getRenderer().setSeriesPaint(i, color);
        }
    }

    final ChartPanel chartPanel = new ChartPanel(chart);

    // chartPanel.addChartMouseListener(new ChartMouseListener() {
    //
    // @Override
    // public void chartMouseMoved(ChartMouseEvent event) {
    // ChartEntity entity = event.getEntity();
    // if (entity instanceof PieSectionEntity) {
    // PieSectionEntity pieSectionEntity = (PieSectionEntity) entity;
    // String sectionKey = (String) pieSectionEntity.getSectionKey();
    // if (_groups.containsKey(sectionKey)) {
    // chartPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    // } else {
    // chartPanel.setCursor(Cursor.getDefaultCursor());
    // }
    // } else {
    // chartPanel.setCursor(Cursor.getDefaultCursor());
    // }
    // }
    //
    // @Override
    // public void chartMouseClicked(ChartMouseEvent event) {
    // ChartEntity entity = event.getEntity();
    // if (entity instanceof PieSectionEntity) {
    // PieSectionEntity pieSectionEntity = (PieSectionEntity) entity;
    // String sectionKey = (String) pieSectionEntity.getSectionKey();
    // if (_groups.containsKey(sectionKey)) {
    // drillToGroup(result, sectionKey, true);
    // }
    // }
    // }
    // });

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

    _backButton.setMargin(new Insets(0, 0, 0, 0));
    _backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            drillToOverview(result);
        }
    });

    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(_backButton, BorderLayout.NORTH);
    rightPanel.add(_table.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.ucla.stat.SOCR.chart.demo.PowerTransformHistogramChart.java

public void init() {

    sliderPanel = new JPanel();
    powerSlider = new FloatSlider("Power", 1.0, -10.0, 10.0);
    powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80));
    powerSlider.addObserver(this);
    powerSlider.setToolTipText("Slider for adjusting the value of power.");
    sliderPanel.add(this.powerSlider);

    binSlider2 = new FloatSlider("Bin Size", 5, 1, 10);
    super.reset_BinSlider();
    binSlider2.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80));
    binSlider2.addObserver(this);
    binSlider2.setToolTipText("Slider for adjusting the bin size.");
    sliderPanel.add(this.binSlider2);

    mapDep = false;/*from  w  w w.jav  a  2 s.com*/

    super.init();
    indLabel.setText("Data"); // Y

    toolBar = new JToolBar();
    createActionComponents(toolBar);
    JPanel toolBarContainer = new JPanel();
    toolBarContainer.add(toolBar);
    JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer,
            new JScrollPane(sliderPanel));
    toolContainer.setContinuousLayout(true);
    toolContainer.setDividerLocation(0.6);
    this.getContentPane().add(toolContainer, BorderLayout.NORTH);
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformationFamilyChart.java

public void init() {

    sliderPanel = new JPanel();

    // ValueSetter(String title, int type int min, int max, int initial,boolean minimumRange10) 
    powerSlider = new edu.ucla.stat.SOCR.util.FloatSlider("Power", 1.0, -10.0, 10.0);
    powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80));
    powerSlider.addObserver(this);
    powerSlider.setToolTipText("Slider for adjusting the value of power.");
    sliderPanel.add(this.powerSlider);

    mapDep = false;/*from   ww  w .  j av a2  s  .  co  m*/
    LEGEND_SWITCH = false;

    super.init();

    indLabel = new JLabel("X");
    depLabel = new JLabel("Y");

    toolBar = new JToolBar();
    createActionComponents(toolBar);
    JPanel toolBarContainer = new JPanel();
    toolBarContainer.add(toolBar);
    JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer,
            new JScrollPane(sliderPanel));
    toolContainer.setContinuousLayout(true);
    toolContainer.setDividerLocation(0.6);
    this.getContentPane().add(toolContainer, BorderLayout.NORTH);

    depMax = 10; // max number of dependent var
    indMax = 10; // max number of independent var

}

From source file:de.huberlin.cuneiform.compiler.debug.DebugDispatcher.java

public DebugDispatcher(File buildDir, File logFile, String dagid) {

    super(buildDir, logFile, dagid);

    JSplitPane splitPane;

    frame = new JFrame("Cuneiform Debug Interface");
    frame.setSize(700, 500);/*from ww  w  . j  av  a2  s .  c om*/
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    addMenu();

    invocOverview = new InvocOverview(this);
    contentOverview = new ContentOverview(frame);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, invocOverview, contentOverview);
    // splitPane.setResizeWeight( .5 );
    splitPane.setDividerLocation(350);

    frame.add(splitPane, BorderLayout.CENTER);

}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformXYScatterChart.java

public void init() {

    sliderPanel = new JPanel();

    powerXSlider = new FloatSlider("PowerX", 1.0, -10.0, 10.0);
    powerXSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80));
    powerXSlider.addObserver(this);
    powerXSlider.setToolTipText("Slider for adjusting the value of power for the axis.");
    sliderPanel.add(this.powerXSlider);

    powerYSlider = new FloatSlider("PowerY", 1.0, -10.0, 10.0);
    powerYSlider.setPreferredSize(new Dimension(CHART_SIZE_X / 2 + 150, 80));
    powerYSlider.addObserver(this);
    powerYSlider.setToolTipText("Slider for adjusting the value of power for the Y axis.");
    sliderPanel.add(this.powerYSlider);

    super.init();

    toolBar = new JToolBar();
    createActionComponents(toolBar);// w  w  w.  ja  va 2 s . c o m
    JPanel toolBarContainer = new JPanel();
    toolBarContainer.add(toolBar);
    JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer,
            new JScrollPane(sliderPanel));
    toolContainer.setContinuousLayout(true);
    toolContainer.setDividerLocation(0.6);
    this.getContentPane().add(toolContainer, BorderLayout.NORTH);
}

From source file:uk.co.petertribble.jangle.SnmpTreePanel.java

/**
 * Create a new SnmpTreePanel, starting exploration at the specified OID.
 *
 * @param startOID the OID to start from
 *///w  ww  . j  a va2  s.c  o m
public SnmpTreePanel(String startOID) {
    this.startOID = startOID;
    setLayout(new BorderLayout());

    jtpl = new JTabbedPane();
    model = new DefaultListModel();
    oidList = new ArrayList<SnmpObject>();
    slist = new JList(model);
    slist.addListSelectionListener(this);
    slist.setCellRenderer(new SnmpListCellRenderer());
    jtpl.add(SnmpResources.getString("SNMP.LIST.TEXT"), new JScrollPane(slist));

    // we use explicit placement so the tabs can be manipulated later
    jtpr = new JTabbedPane();

    // details tab
    jp1 = new JPanel(new BorderLayout());
    jp2 = new JPanel(new BorderLayout());
    tp = new JingleTextPane("text/plain");
    jp1.add(new JScrollPane(tp));
    // jp2 holds the chart
    jp2 = new JPanel(new BorderLayout());
    JSplitPane jpt = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp1, jp2);
    jpt.setOneTouchExpandable(true);
    jpt.setDividerLocation(120);

    jtpr.insertTab(SnmpResources.getString("SNMP.DETAILS.TEXT"), (Icon) null, jpt, (String) null, TAB_D);

    tpdesc = new JingleTextPane("text/plain");
    jtpr.insertTab(SnmpResources.getString("SNMP.ABOUT.TEXT"), (Icon) null, new JScrollPane(tpdesc),
            (String) null, TAB_A);

    // siblings tab
    tpsiblings = new JingleTextPane("text/plain");
    jp3 = new JPanel(new BorderLayout());
    jp3t = new JPanel(new BorderLayout());
    JSplitPane jps = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp3t, jp3);
    jps.setOneTouchExpandable(true);
    jps.setDividerLocation(200);
    jtpr.insertTab(SnmpResources.getString("SNMP.SIBLINGS.TEXT"), (Icon) null, jps, (String) null, TAB_S);

    // cousins tab
    tpcousins = new JingleTextPane("text/plain");
    jp4 = new JPanel(new BorderLayout());
    jp4t = new JPanel(new BorderLayout());
    JSplitPane jpc = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp4t, jp4);
    jpc.setOneTouchExpandable(true);
    jpc.setDividerLocation(200);
    jtpr.insertTab(SnmpResources.getString("SNMP.COUSINS.TEXT"), (Icon) null, jpc, (String) null, TAB_C);

    // split pane to hold the lot
    JSplitPane psplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtpl, jtpr);
    psplit.setOneTouchExpandable(true);
    psplit.setDividerLocation(200);
    add(psplit);
}

From source file:view.ResultsPanel.java

public void displayFrame(final List<ElementaryMode> modes, final List<Integer> indices) {

    this.removeAll();

    DefaultTableModel model = (DefaultTableModel) modeTable.getModel();

    while (model.getRowCount() > 0) {
        model.removeRow(0);//from  ww w .j a va2s . c o  m
    }

    if (modes.size() > 0) {
        setTable(0, modes);
    }
    JLabel nbMod = new JLabel(modes.size() + " mode(s) found");

    toolbar = new JToolBar();
    // set elements in the toolbar
    toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.LINE_AXIS));
    toolbar.add(nbMod);
    toolbar.setFloatable(false);

    Object[] comboElements = new Object[modes.size()];

    for (int i = 0; i < modes.size(); i++) {

        comboElements[i] = "mode " + indices.get(i);
    }

    modesCombo = new JComboBox(comboElements);

    if (modesCombo.getActionListeners().length > 0) {
        modesCombo.removeActionListener(modesCombo.getActionListeners()[0]);
    }
    modesCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setTable(modesCombo.getSelectedIndex(), modes);
        }
    });

    if (modes.size() > 0) {
        toolbar.add(modesCombo);
    }
    modesCombo.setMaximumSize(new Dimension(100, 30));

    //we put the right size for le comboBox
    int sizeMax = String.valueOf(modes.size()).length();

    String stringMax = "mode ";
    for (int i = 0; i < sizeMax; i++) {
        stringMax += "X";
    }

    modesCombo.setPrototypeDisplayValue(stringMax);

    if (download.getActionListeners().length > 0) {
        download.removeActionListener(download.getActionListeners()[0]);
    }
    download.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            Thread thread = new DownloadContentThread(modes, controler, command, log.getText());
            thread.start();

        }
    });

    if (histoButton.getActionListeners().length > 0) {
        histoButton.removeActionListener(histoButton.getActionListeners()[0]);
    }
    histoButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            showHistogram(modes);

        }

    });

    toolbar.add(histoButton);
    toolbar.add(filterButton);
    toolbar.add(download);
    toolbar.add(scriptButton);
    if (!isAttached) {
        toolbar.add(addToProject);
    } else {
        toolbar.add(removeFromProject);
    }

    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(searchField);
    toolbar.add(new JLabel(Var.iconsearch));

    JPanel logPanel = new JPanel(new BorderLayout());

    logPanel.add(new JLabel("Generetad log", JLabel.CENTER), BorderLayout.PAGE_START);
    logPanel.add(new JScrollPane(log), BorderLayout.CENTER);

    this.setLayout(new BorderLayout());

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(modeTable), logPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(500);

    add(toolbar, BorderLayout.PAGE_START);
    this.add(splitPane, BorderLayout.CENTER);

    this.revalidate();
    this.repaint();
}

From source file:edu.ucla.stat.SOCR.chart.SuperPowerChart.java

public void init() {

    indLabel = new JLabel("X");
    depLabel = new JLabel("Y");

    super.init();

    sliderPanel = new JPanel();
    powerSlider = new edu.ucla.stat.SOCR.util.FloatSlider("Power", 1.0, -10.0, 10.0);
    powerSlider.setPreferredSize(new Dimension(CHART_SIZE_X + 150, 80));
    powerSlider.addObserver(this);
    powerSlider.setToolTipText("Slider for adjusting the value of power.");
    sliderPanel.add(this.powerSlider);
    /* toolBarPanel.add(sliderPanel);
            //w  w w  . j a  va  2s.  c o m
    toolBarPanel = new JPanel();
    JScrollPane toolBarContainer = new JScrollPane(toolBarPanel);      
    toolBarPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));*/
    // Create the toolBar

    toolBar = new JToolBar();
    createActionComponents(toolBar);
    JPanel toolBarContainer = new JPanel();
    toolBarContainer.add(toolBar);
    //toolBarPanel.add(toolBar);
    JSplitPane toolContainer = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolBarContainer,
            new JScrollPane(sliderPanel));
    toolContainer.setContinuousLayout(true);
    toolContainer.setDividerLocation(0.6);
    this.getContentPane().add(toolContainer, BorderLayout.NORTH);

    depMax = 50; // max number of dependent var
    indMax = 50; // max number of independent var

    updateStatus(url);

    resetExample();
    validate();

}