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:kata.pkg3.HistogramDisplay.java

private ChartPanel createpanel() {
    ChartPanel chartPanel = new ChartPanel(createChart(createDataset()));
    //Dimensionamos la ventana que vamos a crear
    chartPanel.setPreferredSize(new Dimension(500, 400));
    return chartPanel;
}

From source file:arlocros.Imshow.java

/**
 * @param opencvImage//ww  w .  j av a  2  s  .c  o  m
 */
public static void show(Mat opencvImage) {

    Dimension frameSize = new Dimension(opencvImage.rows(), opencvImage.cols());
    if (frame == null) {
        frame = new Imshow("", frameSize.height, frameSize.width);
        frame.Window.setVisible(true);

        frame.Window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        if (frame.SizeCustom) {
            Imgproc.resize(opencvImage, opencvImage, new Size(frame.Height, frame.Width));
        }
    }
    BufferedImage bufImage = null;
    try {

        int type = BufferedImage.TYPE_BYTE_GRAY;
        if (opencvImage.channels() > 1) {
            type = BufferedImage.TYPE_3BYTE_BGR;
        }
        int bufferSize = opencvImage.channels() * opencvImage.cols() * opencvImage.rows();
        byte[] b = new byte[bufferSize];
        opencvImage.get(0, 0, b);
        BufferedImage bufferedImage = new BufferedImage(opencvImage.cols(), opencvImage.rows(), type);
        final byte[] targetPixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();
        System.arraycopy(b, 0, targetPixels, 0, b.length);
        bufImage = bufferedImage;
        frame.image.setImage(bufImage);
        frame.Window.pack();
        frame.label.updateUI();
        //frame.Window.setVisible(true);
    } catch (RuntimeException e) {
        logger.info("Exception while visualizing.", e);
    }
}

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

public StackedAreaChartDemo1(String s) {
    super(s);/*  ww  w  .j  a  va  2 s.c om*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

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

public BoxAndWhiskerChartDemo2(String s) {
    super(s);/*  w  w w. j a v  a  2s.  c  o m*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

From source file:SimpleSplitPane.java

public SimpleSplitPane() {
    super("Simple SplitPane Frame");
    setSize(450, 200);/*www .  j  a va 2s . c om*/
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JTextArea jt1 = new JTextArea(sometext);
    JTextArea jt2 = new JTextArea(sometext);

    // Make sure our text boxes do line wrapping and have reasonable
    // minimum sizes.
    jt1.setLineWrap(true);
    jt2.setLineWrap(true);
    jt1.setMinimumSize(new Dimension(150, 150));
    jt2.setMinimumSize(new Dimension(150, 150));
    jt1.setPreferredSize(new Dimension(250, 200));
    JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jt1, jt2);
    getContentPane().add(sp, BorderLayout.CENTER);
}

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

public StatisticalBarChartDemo1(String s) {
    super(s);//from ww w. j a v  a 2s  .  c o m
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

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

public StatisticalLineChartDemo1(String s) {
    super(s);/*  w ww  .  j  av a2 s .c o m*/
    CategoryDataset categorydataset = createDataset();
    JFreeChart jfreechart = createChart(categorydataset);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartpanel);
}

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

public WaterfallChartDemo1(String s) {
    super(s);/*from w  ww.j  a v a 2 s. com*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

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

public StackedBarChartDemo5(String s) {
    super(s);//  w  w w.  ja  va  2  s  .c  o  m
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

From source file:Main.java

public Main() {
    JInternalFrame frame1 = new JInternalFrame("Frame 1", true, true, true, true);

    JInternalFrame frame2 = new JInternalFrame("Frame 2", true, true, true, true);

    frame1.getContentPane().add(new JLabel("Frame 1  contents..."));
    frame1.pack();//from   w  w  w  .  j  ava 2s . co  m
    frame1.setVisible(true);

    frame2.getContentPane().add(new JLabel("Frame 2  contents..."));
    frame2.pack();
    frame2.setVisible(true);

    int x2 = frame1.getX() + frame1.getWidth() + 10;
    int y2 = frame1.getY();
    frame2.setLocation(x2, y2);

    desktopPane.add(frame1);
    desktopPane.add(frame2);

    this.add(desktopPane, BorderLayout.CENTER);

    this.setMinimumSize(new Dimension(300, 300));
}