Example usage for javax.swing JPanel removeAll

List of usage examples for javax.swing JPanel removeAll

Introduction

In this page you can find the example usage for javax.swing JPanel removeAll.

Prototype

public void removeAll() 

Source Link

Document

Removes all the components from this container.

Usage

From source file:app.Histogram.java

public void histogramDesign(JFreeChart chart) {
    final CategoryPlot plot = chart.getCategoryPlot();
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();

    renderer.setDrawBarOutline(false);//from  w ww .j  a v a2s.  c  o  m
    renderer.setItemMargin(0.10);
    renderer.setShadowVisible(false);

    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

    final org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.02);
    domainAxis.setUpperMargin(0.02);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(1));

    renderer.setSeriesPaint(0, gp0);
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.black);
    plot.setRenderer(renderer);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 500));

    JPanel panelJPanel = new JPanel();
    panelJPanel.removeAll();
    //panelJComboBox.removeAll();
    PlotWindow hist = new PlotWindow();
    hist.setVisible(true);
    // HistogtamWindow f = new HistogtamWindow();
    // HistogtamWindow f2 = f.getInstance();
    // f2.setVisible(true);
    // f2.getHistogramPanel().add(chartPanel);
    panelJPanel.add(chartPanel);
    hist.setContentPane(panelJPanel);
}

From source file:com.sjsu.uidesign.ExecStatus.java

public ExecStatus() {
    super();/*  w  ww. j a  va 2s.co m*/
    super.setTitle("Task Execution Status");
    super.setSize(500, 500);
    super.setResizable(true);
    super.setLocationRelativeTo(null);

    JLabel usageImage = new JLabel();
    //usageImage.setIcon(new ImageIcon("Pie_3.png"));

    //usageImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/sjsu/uidesign/Bar_4.png"))); // NOI18N
    //add(usageImage);

    DefaultCategoryDataset barChartData = new DefaultCategoryDataset();
    barChartData.setValue(6, "Cache Cleanup", "Cache Cleanup");
    barChartData.setValue(8, "Antivirus Scan", "Antivirus Scan");
    barChartData.setValue(7, "Empty Recycle Bin", "Empty Recycle Bin");

    JFreeChart barChart = ChartFactory.createBarChart("Task Execution Status", "Task Name", "Status",
            createDataset(), PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot barChar = barChart.getCategoryPlot();
    barChar.setRangeGridlinePaint(Color.ORANGE);

    ChartPanel barPanel = new ChartPanel(barChart);

    JPanel panelChart = new JPanel();
    panelChart.removeAll();
    panelChart.add(barPanel, BorderLayout.CENTER);
    panelChart.validate();
    add(panelChart);
}

From source file:PRC6.Graficos.java

public void PieGraphF(ArrayList<Float> d, int pos, String s, String y, javax.swing.JPanel Pan, String p) {
    Pan.removeAll();
    // Fuente de Datos
    DefaultPieDataset data = new DefaultPieDataset();
    int tmp = 0;/*from   w  w w  . java2 s  .  co  m*/
    for (int i = pos; i <= pos + 11; i++) {
        tmp += 1;
        data.setValue("Mes " + tmp + ": " + d.get(i) + " ", d.get(i));
    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createPieChart("Grfico de " + s + " para el ao " + y + " en " + p, data,
            true, true, false);

    // Mostrar Grafico
    //ChartFrame frame = new ChartFrame("JFreeChart", chart);
    ChartPanel panel = new ChartPanel(chart);
    panel.setBounds(5, 5, 450, 400);
    panel.repaint();
    Pan.add(panel);
    Pan.updateUI();

    //frame.pack();
    //frame.setVisible(true);

}

From source file:PRC6.Graficos.java

public void PieGraphI(ArrayList<Integer> d, int pos, String s, String y, javax.swing.JPanel Pan, String p) {
    Pan.removeAll();
    //System.out.println("Estoy EN PIEGRAPH");
    // Fuente de Datos
    DefaultPieDataset data = new DefaultPieDataset();
    int tmp = 0;//from w ww .j ava2s  .c  o m
    for (int i = pos; i <= pos + 11; i++) {
        tmp += 1;
        data.setValue("Mes " + tmp + ": " + d.get(i) + " ", d.get(i));

        //data.setValue(d.get(pos), 45);
        //data.setValue("Python", 15);
    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createPieChart("Grfico de " + s + " para el ao " + y + " en " + p, data,
            true, true, false);

    // Mostrar Grafico

    ChartPanel panel = new ChartPanel(chart);
    panel.setBounds(5, 5, 450, 400);
    panel.repaint();
    Pan.add(panel);
    Pan.updateUI();

}

From source file:LowPassFilterTest.java

@Test
public void test() throws InterruptedException {
    CategoryTableXYDataset serie = new CategoryTableXYDataset();
    serie.setNotify(false);//from w  w  w.  j a  v  a 2 s .c  om
    double step = 1.0 / discretization;
    double startPosition = step * framePosition;
    //100 ? - 100 , 50 ? - 50 , 25 ?- 25 
    double[] data = math.convolve(
            math.HammingWindow(testData.get1DPolyharmSignal(4, 200, frameWidth, discretization), frameWidth),
            math.lpf(60, step, 1024));
    //        double[] data = math.convolve(testData.get1DSignal(100, 200, frameWidth, discretization), math.lpf(70, step, 128));

    //        double[] data = math.convolve(testData.get1DSignal(100, 200, 32768, 10000), math.lpf(70, 1./10000, 32));
    //        double[] data = testData.get1DSignal(100, 200, frameWidth, discretization);
    //        double[] data = math.lpf(70, step,128);
    for (int i = 0; i < data.length; i++) {
        serie.add(startPosition, data[i], "");
        startPosition += step;
    }
    JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "g, /c^2", serie);
    chart.removeLegend();
    chart.setAntiAlias(false);

    XYPlot plot = chart.getXYPlot();
    //plot.setRangeGridlinePaint(Color.BLACK);
    org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis();
    org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis();
    double start = framePosition * 1.0 / discretization;
    double max = start + frameWidth * 1.0 / discretization;
    xAxis.setRange(start, max);
    ChartPanel chartPanel = new ChartPanel(chart);

    JPanel p = new JPanel(new BorderLayout());

    p.removeAll();
    p.add(chartPanel);
    p.validate();
    //1. Create the frame.
    JFrame frame = new JFrame("FrameDemo");

    //2. Optional: What happens when the frame closes?
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //3. Create components and put them in the frame.
    //...create emptyLabel...
    frame.getContentPane().add(new Label("olol"), BorderLayout.CENTER);
    frame.getContentPane().add(p, BorderLayout.CENTER);

    //4. Size the frame.
    frame.pack();

    //5. Show it.
    frame.setVisible(true);
}

From source file:de.main.sessioncreator.ReportingHelper.java

public void addReport(JPanel jp) {
    jp.removeAll();
    PieDataset dataset = createDataset();
    // based on the dataset we create the chart
    JFreeChart chart = createChart(dataset, "Sessions by Tester");
    // we put the chart into a panel
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.updateUI();/*from   www .  j  a  v a  2s. c  o m*/
    chartPanel.setSize(490, 350);

    jp.revalidate();
    jp.setOpaque(true);
    jp.add(chartPanel);
    jp.revalidate();
    jp.setVisible(true);
    jp.setSize(700, 500);
    jp.revalidate();
    jp.repaint();
}

From source file:UserInterface.AppUsersProfile.DetailAnalysis.DetailAnalysisJPanel.java

public void drawGraph(JPanel panel, String vsType) {
    panel.removeAll();
    panel.add(getChartPanel(vsType), BorderLayout.CENTER);
    panel.validate();/*from   www.j a v  a 2  s  . c  o m*/
}

From source file:D1WaveletTransform.java

@Test
public void test() throws InterruptedException, JWaveException {
    CategoryTableXYDataset serie = new CategoryTableXYDataset();
    serie.setNotify(false);// w w w .  ja  v a2 s.  c o m
    double step = 1.0 / discretization;
    double startPosition = step * framePosition;
    //100 ? - 100 , 50 ? - 50 , 25 ?- 25 
    WaveletTransform t = new FastWaveletTransform((new Haar1()));
    double[] data = t.forward(testData.get1DSimpleSignal(1, 3, frameWidth, discretization), 128);
    //        double[] data = math.convolve(testData.get1DSignal(100, 200, frameWidth, discretization), math.lpf(70, step, 128));

    //        double[] data = math.convolve(testData.get1DSignal(100, 200, 32768, 10000), math.lpf(70, 1./10000, 32));
    //        double[] data = testData.get1DSignal(100, 200, frameWidth, discretization);
    //        double[] data = math.lpf(70, step,128);
    for (int i = 0; i < data.length; i++) {
        serie.add(startPosition, data[i], "");
        startPosition += step;
    }
    JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "wave", serie);
    chart.removeLegend();
    chart.setAntiAlias(false);

    XYPlot plot = chart.getXYPlot();
    //plot.setRangeGridlinePaint(Color.BLACK);
    org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis();
    org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis();
    double start = framePosition * 1.0 / discretization;
    double max = start + frameWidth * 1.0 / discretization;
    xAxis.setRange(start, max);
    ChartPanel chartPanel = new ChartPanel(chart);

    JPanel p = new JPanel(new BorderLayout());

    p.removeAll();
    p.add(chartPanel);
    p.validate();
    //1. Create the frame.
    JFrame frame = new JFrame("FrameDemo");

    //2. Optional: What happens when the frame closes?
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //3. Create components and put them in the frame.
    //...create emptyLabel...
    frame.getContentPane().add(new Label("olol"), BorderLayout.CENTER);
    frame.getContentPane().add(p, BorderLayout.CENTER);

    //4. Size the frame.
    frame.pack();

    //5. Show it.
    frame.setVisible(true);
}

From source file:app.Plot.java

public void showElements(List<WordStatistic> was, JComboBox cb) {

    JFreeChart chart = createPlot(was, cb.getSelectedItem());
    plotDesign(chart);//from   w  ww.  j a  v a2  s  .c om
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setDomainZoomable(false);
    PlotWindow plot = new PlotWindow();
    plot.setVisible(true);
    JPanel panetJTitle = new JPanel();
    JPanel panelJPanel = new JPanel();
    JPanel panelJComboBox = new JPanel();
    panelJPanel.removeAll();
    panelJComboBox.removeAll();
    JLabel title = new JLabel();
    title.setText(
            " ?? ? ? ??  '"
                    + cb.getSelectedItem().toString() + "'   ?");
    chartPanel.setPreferredSize(new java.awt.Dimension(600, 400));
    JLabel label = new JLabel();
    label.setText(" ?? ");
    panetJTitle.add(title);
    panelJPanel.add(chartPanel);
    panelJComboBox.add(label);
    panelJComboBox.add(cb);
    JPanel panelWindow = new JPanel();
    panelWindow.add(panetJTitle);
    panelWindow.add(panelJPanel);
    panelWindow.add(panelJComboBox);
    plot.setContentPane(panelWindow);

}

From source file:moviedatas.View.SpiderWebChart.java

public void refreshChart(JPanel panel, int duration, double ratio, double score, double recency, int fbLikes) {
    panel.removeAll();
    panel.revalidate(); // This removes the old chart 
    spiderChart = createChart(createDataset(duration, ratio, score, recency, fbLikes));
    spiderChart.clearSubtitles();/*from   w ww.j  a v a  2s. c  om*/
    chartPanel = new ChartPanel(spiderChart);
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel);
    panel.setPreferredSize(new Dimension(300, 300));
    panel.repaint(); // This method makes the new chart appear
}