Example usage for javax.swing JScrollPane validate

List of usage examples for javax.swing JScrollPane validate

Introduction

In this page you can find the example usage for javax.swing JScrollPane validate.

Prototype

public void validate() 

Source Link

Document

Validates this container and all of its subcomponents.

Usage

From source file:KjellDirdalNotepad.java

public void setNormalSize() {
    JScrollPane scrollPane = getScrollPane();
    int x = 0;// ww  w  .  ja v  a  2  s .c o  m
    int y = 0;
    Insets scrollInsets = getScrollPaneInsets();

    if (scrollPane != null) {
        Dimension d = scrollPane.getVisibleRect().getSize();
        if (scrollPane.getBorder() != null) {
            d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,
                    d.getHeight() - scrollInsets.top - scrollInsets.bottom);
        }

        d.setSize(d.getWidth() - 20, d.getHeight() - 20);
        desktop.setAllSize(x, y);
        scrollPane.invalidate();
        scrollPane.validate();
    }
}

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

/**
* make the show_all panel/*from  w w  w  .j  a v a  2s  .c  om*/
*/
protected void setMixPanel() {
    /*super.setMixPanel();
    return;*/

    dataPanel2.removeAll();
    graphPanel2.removeAll();

    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.add(chartPanel);
    sliderPanel.removeAll();
    /*   sliderPanel.add(new JLabel("Bin Size"));
         sliderPanel.add(this.binSlider);
         sliderPanel.add(new JLabel(":"+this.binSlider.getValue()));*/
    binSlider2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, 100));
    sliderPanel.add(this.binSlider2);
    sliderPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, 100));
    graphPanel2.add(sliderPanel); // the slider
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(mapPanel);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:KjellDirdalNotepad.java

protected void resizeDesktop() {
    int x = 0;/*from   ww  w .  j av  a2s  .c  o  m*/
    int y = 0;
    JScrollPane scrollPane = getScrollPane();
    Insets scrollInsets = getScrollPaneInsets();

    if (scrollPane != null) {
        JInternalFrame allFrames[] = desktop.getAllFrames();
        for (int i = 0; i < allFrames.length; i++) {
            if (allFrames[i].getX() + allFrames[i].getWidth() > x) {
                x = allFrames[i].getX() + allFrames[i].getWidth();
            }
            if (allFrames[i].getY() + allFrames[i].getHeight() > y) {
                y = allFrames[i].getY() + allFrames[i].getHeight();
            }
        }
        Dimension d = scrollPane.getVisibleRect().getSize();
        if (scrollPane.getBorder() != null) {
            d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,
                    d.getHeight() - scrollInsets.top - scrollInsets.bottom);
        }

        if (x <= d.getWidth())
            x = ((int) d.getWidth()) - 20;
        if (y <= d.getHeight())
            y = ((int) d.getHeight()) - 20;
        desktop.setAllSize(x, y);
        scrollPane.invalidate();
        scrollPane.validate();
    }
}

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

/**
 * make the show_all panel//from   w  w w .jav a  2s  . c om
 */
protected void setMixPanel() {
    dataPanel2.removeAll();
    graphPanel2.removeAll();

    graphPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS));
    if (chartPanel != null)
        graphPanel2.add(chartPanel);
    if (legendPanelOn) {
        if (legendPanel != null)
            legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5));
        JScrollPane legendPane = new JScrollPane(legendPanel);

        legendPane.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5));
        graphPanel2.add(legendPane);
    }
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    JScrollPane st2 = new JScrollPane(mapPanel);
    st2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(st2);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}