List of usage examples for javax.swing JPanel setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:org.jfree.chart.demo.YieldCurveDemo1.java
public YieldCurveDemo1(String s) { super(s);/*from w ww. j a v a2 s .c o m*/ JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }
From source file:org.jfree.chart.demo.YieldCurveDemo.java
public YieldCurveDemo(String s) { super(s);/*from w w w.jav a2 s. c om*/ JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }
From source file:org.jfree.chart.demo.XYBlockChartDemo1.java
public XYBlockChartDemo1(String s) { super(s);//from www . j ava2s . c om JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }
From source file:org.jfree.chart.demo.XYDrawableAnnotationDemo1.java
public XYDrawableAnnotationDemo1(String s) { super(s);/*from w ww. j ava 2s . c om*/ JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 300)); setContentPane(jpanel); }
From source file:org.jfree.chart.demo.AnnotationDemo1.java
public AnnotationDemo1(String s) { super(s);/* w ww .ja va 2s. com*/ JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(360, 500)); setContentPane(jpanel); }
From source file:Test.java
public Test() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel1 = new JPanel(new GridLayout(1, 5)); for (int i = 0; i < 5; i++) { panel1.add(new JLabel("Left " + i)); }//w w w . ja va 2s . co m panel1.setPreferredSize(new Dimension(250, 50)); JPanel panel2 = new JPanel(new GridLayout(1, 5)); for (int i = 0; i < 5; i++) { panel2.add(new JLabel("Right " + i)); } panel2.setPreferredSize(new Dimension(250, 50)); final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2); split.setContinuousLayout(true); getContentPane().add(split, BorderLayout.CENTER); pack(); setSize(500, 100); }
From source file:lu.lippmann.cdb.common.gui.MultiPanel.java
/** * Constructor./*from ww w . j a v a 2 s . com*/ */ public MultiPanel(final ListOrderedMap<JComponent, Integer> mapPanels, final int w, final int h, final boolean withWeight) { final int total = mapPanels.keySet().size(); if (!withWeight) setLayout(new GridLayout(0, 1)); final int w2 = w - 10 * total; final int h2 = h - 75; final Map<JComponent, Color> choosedColor = new HashMap<JComponent, Color>(); int i = 0; for (final JComponent p : mapPanels.keySet()) { final Dimension size = new Dimension((int) (w2 * (mapPanels.get(p) / 100.0)), h2); p.setPreferredSize(size); choosedColor.put(p, COLORS[i]); p.setBackground(COLORS[i]); p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); add(p); i++; } if (withWeight) { /** add percents **/ for (final JComponent p : mapPanels.keySet()) { final int perc = mapPanels.get(p); final int percent = (int) (w2 * (mapPanels.get(p) / 100.0)); final Dimension size = new Dimension(percent, 20); final JPanel arrow = new JPanel(); arrow.setPreferredSize(size); final JLabel label = new JLabel(perc + "%"); label.setForeground(choosedColor.get(p).darker()); arrow.add(label); add(arrow); } } }
From source file:gui.Histograma.java
/** * * @param amostra//from ww w.j a va 2 s. c o m */ public Histograma(ArrayList<Double> amostra, double min, double max) { super("Histograma"); this.amostra = amostra; this.min = min; this.max = max; //Atribuir grfico ao JPanel JPanel panelHist = preencherPanel(); panelHist.setPreferredSize(new java.awt.Dimension(500, 475)); setContentPane(panelHist); //Visibilidade da tela this.pack(); RefineryUtilities.centerFrameOnScreen(this); this.setVisible(true); //Adicionando cone setIconImage(iconeTitulo); }
From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerAndPredictionDifference.java
public TotalPowerAndPredictionDifference(DataSet ds) { super(NAME);// ww w . j a v a 2s. c o m data = dataSetToJFreeChartXYDataSet(ds); JPanel jpanel = createPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); //jpanel.setPreferredSize(jpanel.getMaximumSize()); getContentPane().add(jpanel); }
From source file:org.jfree.chart.demo.MouseOverDemo1.java
public MouseOverDemo1(String s) { super(s);// w w w . j a v a 2 s . c o m JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }