Example usage for javax.swing JFrame setLocation

List of usage examples for javax.swing JFrame setLocation

Introduction

In this page you can find the example usage for javax.swing JFrame setLocation.

Prototype

@Override
public void setLocation(int x, int y) 

Source Link

Document

The method changes the geometry-related data.

Usage

From source file:turtlekit.murmuration.SpeedChecker.java

@Override
public void setupFrame(JFrame frame) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "Moyenne", null, null);
    chartPanel.setPreferredSize(new java.awt.Dimension(550, 250));
    speed = new XYSeries("Speed");
    dataset.addSeries(speed);/*from   w  ww. j  a  v a  2  s.  c  om*/
    frame.setContentPane(chartPanel);
    frame.setLocation(50, 0);
    //      XYSeries s = dataset.getSeries("Total");
}

From source file:turtlekit.murmuration.HeadingChecker.java

@Override
public void setupFrame(JFrame frame) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "Average heading", null, null);
    chartPanel.setPreferredSize(new java.awt.Dimension(550, 250));
    heading = new XYSeries("Average heading");
    dataset.addSeries(heading);/*from www  .j  a va 2  s.  c  om*/
    frame.setContentPane(chartPanel);
    frame.setLocation(50, 0);
    //      XYSeries s = dataset.getSeries("Total");
}

From source file:net.sourceforge.metware.binche.execs.BiNCheExec.java

private void runGui() {

    final JFrame window = new JFrame("binche Settings");
    final SettingsPanel settingsPanel = new SettingsPanel();
    window.getContentPane().add(settingsPanel);
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.setGlassPane(settingsPanel.getProgressPanel());
    window.pack();//w w w  . ja  va2s.  co  m

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    window.setLocation(screenSize.width / 2 - (window.getWidth() / 2),
            screenSize.height / 2 - (window.getHeight() / 2));
    window.setVisible(true);
    window.setResizable(true);
}

From source file:turtlekit.pvequalsnrt.PhysicsChecker.java

@Override
public void setupFrame(JFrame frame) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "PV = nRT", null, null);
    chartPanel.setPreferredSize(new java.awt.Dimension(550, 250));
    rightSide = new XYSeries("Gas on the right side");
    dataset.addSeries(rightSide);/*from  w  w  w  . j  av  a2 s.  c om*/
    total = new XYSeries("Total");
    dataset.addSeries(total);
    frame.setContentPane(chartPanel);
    frame.setLocation(50, 0);
    XYSeries s = dataset.getSeries("Total");
}

From source file:com.freedomotic.jfrontend.MainWindow.java

/**
 *
 * @param frame/*from  w  w w  .j a  v a2 s  .c om*/
 */
public static void centerFrame(JFrame frame) {
    frame.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - frame.getWidth()) / 2,
            (Toolkit.getDefaultToolkit().getScreenSize().height - frame.getHeight()) / 2);
}

From source file:UserInterface.FarmerRole.HumidityGraph.java

public HumidityGraph(double value, String type) {

    data = new DefaultValueDataset(value);
    final JFrame frame = new JFrame();
    meterPlot = new MeterPlot(data);
    frame.getContentPane().setLayout(new BorderLayout(5, 5));
    frame.setDefaultCloseOperation(3);//from   ww w. jav  a  2s. co  m
    frame.setTitle("Inventory Humidity");
    meterChart = new JFreeChart("Humidity Chart", JFreeChart.DEFAULT_TITLE_FONT, this.meterPlot, false);
    panelMeter = new ChartPanel(this.meterChart);
    frame.getContentPane().add(panelMeter, BorderLayout.CENTER);
    frame.setSize(700, 400);
    final Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);

}

From source file:Console.java

public Console(Process p) {
    JFrame frame = new JFrame();
    frame.setTitle("Console");
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(screenSize.width / 2 - INITIAL_WIDTH / 2, screenSize.height / 2 - INITIAL_HEIGHT / 2);
    ConsoleTextArea cta = new ConsoleTextArea();
    JScrollPane scroll = new JScrollPane(cta);
    scroll.setPreferredSize(new Dimension(INITIAL_WIDTH, INITIAL_HEIGHT));
    frame.getContentPane().add(scroll);//from  ww  w  .  ja  v a 2s.  co  m
    frame.pack();

    // From here down your shell should be pretty much
    // as it is written here!
    /*
     * Start up StdOut, StdIn and StdErr threads that write the output generated by the process
     * p to the screen, and feed the keyboard input into p.
     */
    so = new StdOut(p, cta);
    se = new StdOut(p, cta);
    StdIn si = new StdIn(p, cta);
    so.start();
    se.start();
    si.start();

    // Wait for the process p to complete.
    try {
        frame.setVisible(true);
        p.waitFor();
    } catch (InterruptedException e) {
        /*
         * Something bad happened while the command was executing.
         */
        System.out.println("Error during execution");
        System.out.println(e);
    }

    /*
     * Now signal the StdOut, StdErr and StdIn threads that the process is done, and wait for
     * them to complete.
     */
    try {
        so.done();
        se.done();
        si.done();
        so.join();
        se.join();
        si.join();
    } catch (InterruptedException e) {
        // Something bad happend to one of the Std threads.
        System.out.println("Error in StdOut, StdErr or StdIn.");
        System.out.println(e);
    }
    frame.setVisible(false);
}

From source file:scheduler.benchmarker.manager.CreateCombinedSplineChart.java

private void createSubChart(ChartPanel chart) {
    JFrame frameGraph = new JFrame();
    frameGraph.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frameGraph.setForeground(new Color(76, 76, 76));
    frameGraph.setBackground(new Color(246, 244, 242));

    Dimension window = Toolkit.getDefaultToolkit().getScreenSize();
    if (window.width < 1074 && window.height < 800)
        frameGraph.setPreferredSize(new Dimension(window.width, window.height));
    else/* ww  w.ja va2  s .  c om*/
        frameGraph.setPreferredSize(new Dimension(1074, 800));

    frameGraph.setLocation((window.width - frameGraph.getPreferredSize().width) / 2,
            (window.height - frameGraph.getPreferredSize().height) / 2);
    frameGraph.setResizable(true);
    frameGraph.add(chart);
    frameGraph.pack();
    frameGraph.setVisible(true);
}

From source file:turtlekit.viewer.StatesPerSecondCharter.java

@Override
public void setupFrame(JFrame frame) {
    final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "States Per Second", null, null);
    chartPanel.setPreferredSize(new java.awt.Dimension(550, 250));
    // frame.setContentPane(chartPanel);
    frame.add(chartPanel);/* ww w.j  a v  a2s. co  m*/
    frame.add(new JButton(new AbstractAction("clear") {
        @Override
        public void actionPerformed(ActionEvent e) {
            serie.clear();
        }
    }), BorderLayout.SOUTH);
    frame.setLocation(50, 0);
}

From source file:scheduler.benchmarker.manager.CreateSimpleSplineChart.java

private void createSubChart(ChartPanel chart) {
    JFrame frameGraph = new JFrame();//new JFrame("FINAL RULES ARRANGEMENT");
    frameGraph.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frameGraph.setForeground(new Color(76, 76, 76));
    frameGraph.setBackground(new Color(246, 244, 242));

    Dimension window = Toolkit.getDefaultToolkit().getScreenSize();
    if (window.width < 1074 && window.height < 800)
        frameGraph.setPreferredSize(new Dimension(window.width, window.height));
    else//from  w ww . ja v a2 s  . co  m
        frameGraph.setPreferredSize(new Dimension(1074, 800));

    frameGraph.setLocation((window.width - frameGraph.getPreferredSize().width) / 2,
            (window.height - frameGraph.getPreferredSize().height) / 2);
    frameGraph.setResizable(true);
    frameGraph.add(chart);
    frameGraph.pack();
    frameGraph.setVisible(true);
}