Example usage for org.jfree.ui RefineryUtilities centerFrameOnScreen

List of usage examples for org.jfree.ui RefineryUtilities centerFrameOnScreen

Introduction

In this page you can find the example usage for org.jfree.ui RefineryUtilities centerFrameOnScreen.

Prototype

public static void centerFrameOnScreen(final Window frame) 

Source Link

Document

Positions the specified frame in the middle of the screen.

Usage

From source file:barChart1.BarChartDemo.java

/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.//from w w w . java2s. c  o  m
 */
public static void main(String[] args) {

    // Demo to buy tickets to the EK 2016

    System.out.println("Hello UEFA 2016 !!!");

    statistics = "";

    JOptionPane.showMessageDialog(null, "Belgium versus Italy demo start");

    driver = new FirefoxDriver();
    wait = new WebDriverWait(driver, 500);

    //Open Home Page
    driver.manage().window().maximize();
    driver.get("http://www.uefa.com/");

    wait.until(ExpectedConditions.visibilityOfElementLocated(
            By.xpath("//div/header/nav/div/div/ul/li/a[text() = 'UEFA EURO 2016']")));

    driver.findElement(By.xpath("//div/header/nav/div/div/ul/li/a[text() = 'UEFA EURO 2016']")).click();

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div//nav/div/div/ul/li/a[ text() = 'Teams']")));

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div//nav/div/div/ul/li/a[ text() = 'Matches']")))
            .click();

    wait.until(ExpectedConditions.visibilityOfElementLocated(
            By.xpath("//div/div//div//div/a[text() = 'Select your team and follow their EURO journey']")));

    driver.findElement(
            By.xpath("//div/div//div//div/a[text() = 'Select your team and follow their EURO journey']"))
            .click();

    wait2Secs();

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div//ul/li/span[text()='Belgium']")));

    driver.findElement(By.xpath("//div/div/div//ul/li/span[text()='Belgium']")).click();

    // Belgium
    wait2Secs();

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("(//div/table[1]/tbody/tr/td/div/a[text()='21.00'])[1]")));

    driver.findElement(By.xpath("(//div/table[1]/tbody/tr/td/div/a[text()='21.00'])[1]")).click();

    wait2Secs();

    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a/span[text()='Pre-match']")));

    // Go to the statistics

    driver.get("http://www.uefa.com/uefaeuro/season=2016/statistics/index.html");

    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a/span[text()='Teams']")));

    driver.findElement(By.xpath("//a/span[text()='Teams']")).click();

    // Look up the statistics for Belgium and Italy

    getOverviewStats("BE", "ITA", "Belgium", "Italy");

    wait.until(
            ExpectedConditions.visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Goals']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Goals']")).click();

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Belgium");
    ;

    wait2Secs();

    // getGoalsStats("BE","ITA","Belgium","Italy");

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Attempts']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Attempts']")).click();

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Belgium");
    ;

    wait2Secs();

    wait.until(
            ExpectedConditions.visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Passes']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Passes']")).click();

    wait2Secs();

    // Italy

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Italy");
    ;

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Overview']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Overview']")).click();

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Italy");
    ;

    wait.until(
            ExpectedConditions.visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Goals']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Goals']")).click();

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Italy");
    ;

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Attempts']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Attempts']")).click();

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Italy");
    ;

    wait.until(
            ExpectedConditions.visibilityOfElementLocated(By.xpath("//div/div/div/ul/li/a[text()='Passes']")));

    driver.findElement(By.xpath("//div/div/div/ul/li/a[text()='Passes']")).click();

    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div/div/div/div/input[@value='Search for a team']")));

    driver.findElement(By.xpath("//div/div/div/div/input[@value='Search for a team']")).sendKeys("Italy");
    ;

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

    JOptionPane.showMessageDialog(null, "Belgium versus Italy : \n" + statistics);

    BarChartDemo demo = new BarChartDemo("Belgium vs Italy");
    demo.pack();
    RefineryUtilities.centerFrameOnScreen(demo);
    demo.setVisible(true);

}

From source file:ta4jexamples.indicators.CandlestickChart.java

/**
 * Displays a chart in a frame./*ww w.  j av a 2s . c  o  m*/
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new java.awt.Dimension(740, 300));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Candlestick chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}

From source file:edu.uara.tableeditor.TableFigure.java

/**
 * view chart in a new frame/*from ww  w .  j  ava  2 s  .  c o  m*/
 */
public void chartPreview() {

    java.awt.EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            JFrame chartFrame = new JFrame(title);
            JFreeChart ch = chart.getChart();
            ChartPanel chartPanel = new ChartPanel(ch);
            chartPanel.setPreferredSize(new Dimension(500, 300));
            chartFrame.setContentPane(chartPanel);
            chartFrame.pack();
            RefineryUtilities.centerFrameOnScreen(chartFrame);
            chartFrame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            chartFrame.setVisible(true);
            chartFrame.setAlwaysOnTop(true);
        }
    });

}

From source file:com.leonarduk.finance.analysis.CashFlowToChart.java

/**
 * Displays a chart in a frame./*  ww w  . jav a  2 s. c o  m*/
 *
 * @param chart
 *            the chart to be displayed
 */
private static void displayChart(final JFreeChart chart) {
    // Chart panel
    final ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(1024, 400));
    // Application frame
    final ApplicationFrame frame = new ApplicationFrame("Ta4j example - Cash flow to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}

From source file:unalcol.termites.boxplots.SucessfulRatesHybrid.java

/**
 *
 * @param args/*from ww w. j  a  v  a 2 s  . com*/
 */
public static void main(String args[]) {
    SucessfulRatesHybrid itemlabeldemo2 = new SucessfulRatesHybrid("Sucess Rates");
    itemlabeldemo2.pack();
    RefineryUtilities.centerFrameOnScreen(itemlabeldemo2);
    itemlabeldemo2.setVisible(true);
}

From source file:org.jfree.chart.demo.ContourPlotDemo2.java

/**
 * Starting point for the demonstration application.
 *
 * @param args  command line options, launch ContourDemoPlot -? for listing of options.
 *///from  w w  w.ja v a2 s  .co m
public static void main(final String[] args) {

    if (!processArgs(args)) {
        System.exit(1);
    }
    final ContourPlotDemo2 demo = new ContourPlotDemo2("ContourPlot Demo");
    demo.pack();
    RefineryUtilities.centerFrameOnScreen(demo);
    demo.setVisible(true);

}

From source file:net.sf.jclal.listener.GraphicalReporterListener.java

/**
 * Is executed after the algorithm begins, prepares the conditions of the
 * report: in case of requesting report in file, it creates and keeps the
 * basic configuration of the experiment, show visual report.
 *
 * @param event The event over the algorithm
 *///  w ww  .  j a v a2  s  . c  o m
@Override
public void algorithmStarted(AlgorithmEvent event) {

    super.algorithmStarted(event);

    ClassicalALAlgorithm algorithm = (ClassicalALAlgorithm) event.getAlgorithm();

    String algorithmName = algorithm.getClass().getSimpleName();

    if (showSeparateWindow) {

        externalChart = new ExternalBasicChart("Active learning process", getReportTitle(),
                "Number of instances");

        externalChart.setDisabledComponents();

        externalChart.pack();

        this.externalChart.addSerie(new ArrayList<AbstractEvaluation>(),
                algorithm.getScenario().getQueryStrategy().toString());

        RefineryUtilities.centerFrameOnScreen(externalChart);

        externalChart.setVisible(true);

        // The user wants to show the passive learning in the chart
        if (showPassiveLearning) {
            IEvaluation evaluation = algorithm.getPassiveLearningEvaluation();
            externalChart.setPassiveEvaluation(evaluation);
        }
    }

}

From source file:org.yooreeka.util.gui.ScatterGui.java

public void plot(final JFreeChart chart, int wX, int wY) {

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(wX, wY));
    setContentPane(chartPanel);/*w  w w . ja va  2  s . c  om*/

    this.pack();
    RefineryUtilities.centerFrameOnScreen(this);
    this.setVisible(true);
}

From source file:ta4jexamples.analysis.BuyAndSellSignalsToChart.java

/**
 * Displays a chart in a frame./*from  w w w  . j  a v a2s .c  o m*/
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(1024, 400));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Buy and sell signals to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}

From source file:flusim.XY_Plotter.java

/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.//from  ww w.j  a v a2 s  .c  om
 */
public static void PlotXYChart(String title, java.util.List[] data, String[] desc) {

    XY_Plotter plot = new XY_Plotter(title, data, desc);

    plot.pack();

    RefineryUtilities.centerFrameOnScreen(plot);

    plot.setVisible(true);

}