Example usage for javax.swing JPanel setPreferredSize

List of usage examples for javax.swing JPanel setPreferredSize

Introduction

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

Prototype

@BeanProperty(preferred = true, description = "The preferred size of the component.")
public void setPreferredSize(Dimension preferredSize) 

Source Link

Document

Sets the preferred size of this component.

Usage

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

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

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

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

From source file:spminiproject.lab2.chart.Histogram2.java

public Histogram2(String title, double vector[], int intervals, String labelx, String labely) {
    super(title);
    JPanel chartPanel = createPanel(title, vector, intervals, labelx, labely);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 475));
    setContentPane(chartPanel);//from  w w w .  j  ava 2s .  c o  m
}

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

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

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

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

From source file:cv.mikusher.freechart.BubbleChart.java

public BubbleChart(String s) {
    super(s);/*  w  w  w . j  a v a 2  s.c om*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(560, 370));
    setContentPane(jpanel);
    setDefaultCloseOperation(ApplicationFrame.EXIT_ON_CLOSE);
}

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

public NormalDistributionDemo2(String s) {
    super(s);/* ww  w.ja v a2s .c  om*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

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

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

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

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

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout());

    JPanel upper = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    upper.setLayout(gridbag);/*from   www .j  a  v a  2s  .c  o  m*/
    GridBagConstraints gbc = new GridBagConstraints();

    JButton toolbar1 = new JButton("toolbar1");
    JButton toolbar2 = new JButton("toolbar2");
    JButton toolbar3 = new JButton("toolbar3");

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.anchor = GridBagConstraints.WEST;
    upper.add(toolbar1, gbc);

    gbc.gridx = 1;
    gbc.anchor = GridBagConstraints.CENTER;
    upper.add(toolbar2, gbc);

    gbc.gridx = 2;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    upper.add(toolbar3, gbc);

    add(upper, BorderLayout.NORTH);

    JPanel something = new JPanel();
    something.setBackground(Color.WHITE);
    something.setPreferredSize(new Dimension(600, 600));
    something.repaint();
    add(something, BorderLayout.CENTER);

    pack();
    setVisible(true);
}