Example usage for java.awt Dimension Dimension

List of usage examples for java.awt Dimension Dimension

Introduction

In this page you can find the example usage for java.awt Dimension Dimension.

Prototype

public Dimension(int width, int height) 

Source Link

Document

Constructs a Dimension and initializes it to the specified width and specified height.

Usage

From source file:CheckBoxMnemonic.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from w ww .  jav a2s  . co  m
        }
    });
    f.getContentPane().add(new CheckBoxMnemonic());
    f.pack();
    f.setSize(new Dimension(300, 200));
    f.show();

}

From source file:GeneralPathOpenDemo2D.java

public static void main(String s[]) {
    JFrame f = new JFrame("");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//ww  w .  j  a v  a 2  s  . c om
        }
    });
    JApplet applet = new GeneralPathOpenDemo2D();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.show();
}

From source file:GeneralPathDemo2D.java

public static void main(String s[]) {
    JFrame f = new JFrame("");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*ww  w. j a va  2 s  . co m*/
        }
    });
    JApplet applet = new GeneralPathDemo2D();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.show();
}

From source file:Main.java

public static void main(String arg[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add("Center", new Main());
    frame.pack();//from w w  w.j  av a  2 s.  co  m
    frame.setSize(new Dimension(350, 400));
    frame.setVisible(true);
}

From source file:FilledGeneralPath.java

public static void main(String s[]) {
    JFrame f = new JFrame("");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from   ww  w  .  j a v a2 s  .  c o m
        }
    });
    JApplet applet = new FilledGeneralPath();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.show();
}

From source file:de.codesourcery.gittimelapse.Main.java

public static void main(String[] args) throws IOException, RevisionSyntaxException, GitAPIException {
    final Stack<String> argStack = new Stack<>();

    final String testFile = "/home/tgierke/workspace/voipmanager/voipmngr/voipmngr/build.xml";
    if (ArrayUtils.isEmpty(args) && new File(testFile).exists()) {
        argStack.push(testFile);/*from w  w w.  ja va  2 s  .  c  o m*/
    }

    File file = null;
    while (!argStack.isEmpty()) {
        if ("-d".equals(argStack.peek())) {
            DEBUG_MODE = true;
            argStack.pop();
        } else {
            file = new File(argStack.pop());
        }
    }

    if (file == null) {
        System.err.println("ERROR: Invalid command line.");
        System.err.println("Usage: [-d] <versioned file>\n");
        return;
    }

    final GitHelper helper = new GitHelper(file.getParentFile());

    MyFrame frame = new MyFrame(file, helper);
    frame.setPreferredSize(new Dimension(640, 480));
    frame.pack();
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String s[]) {

    MainClass example = new MainClass();
    example.pane = new JTextPane();
    example.pane.setPreferredSize(new Dimension(250, 250));
    example.pane.setBorder(new BevelBorder(BevelBorder.LOWERED));

    JFrame frame = new JFrame("Menu Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setJMenuBar(example.menuBar);/*from   ww  w. j a  v  a2 s.c om*/
    frame.getContentPane().add(example.pane, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
}

From source file:com.ohalo.cn.awt.JFreeChartTest.java

public static void main(String[] args) throws Exception {
    JFreeChartTest test = new JFreeChartTest();
    List<JFreeChart> charts = test.printHardDiskCharts();

    JPanel mainPanel = new JPanel();
    JFreeChart chart = charts.get(0);/* w ww  . j ava 2 s  . co  m*/
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(400, 300));
    panel.add(chartPanel, BorderLayout.CENTER);
    mainPanel.add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(20, 20, 10, 10), 0, 0));

    chart = charts.get(1);
    panel = new JPanel();
    ChartPanel chartPanel2 = new ChartPanel(chart);
    chartPanel2.setPreferredSize(new Dimension(400, 300));
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel2, BorderLayout.CENTER);
    mainPanel.add(panel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));

    chart = charts.get(2);
    panel = new JPanel();
    ChartPanel chartPanel3 = new ChartPanel(chart);
    chartPanel3.setPreferredSize(new Dimension(400, 300));
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel3, BorderLayout.CENTER);
    mainPanel.add(panel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));

    chart = charts.get(3);
    panel = new JPanel();
    ChartPanel chartPanel4 = new ChartPanel(chart);
    chartPanel4.setPreferredSize(new Dimension(400, 300));
    panel.setLayout(new BorderLayout());
    panel.add(chartPanel4, BorderLayout.CENTER);

    mainPanel.add(panel, new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(10, 10, 20, 20), 0, 0));

    JDialog dialog = new JDialog(new JFrame(), true);
    dialog.setTitle("?");
    dialog.setSize(850, 650);
    dialog.getContentPane().add(mainPanel);
    dialog.setVisible(true);
}

From source file:edu.jhuapl.graphs.jfreechart.BarEffectsTest.java

/**
 * @param args/*from   www. j a  v  a  2  s  . co  m*/
 */
public static void main(String[] args) throws GraphException {
    JFreeChart chart = getSource().getChart();
    JFrame frame = new JFrame("Graph");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    ChartPanel content = new ChartPanel(chart);
    content.setPreferredSize(new Dimension(800, 500));

    frame.getContentPane().add(content);

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

From source file:GeneralPathDemo.java

public static void main(String s[]) {

    JFrame f = new JFrame("Odd Shape");
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from w  w  w .j av a  2s.  c  om
        }
    });

    f.getContentPane().add(new GeneralPathDemo());
    f.setSize(new Dimension(350, 200));
    f.setVisible(true);
}