List of usage examples for java.awt Dimension Dimension
public Dimension(int width, int height)
From source file:org.jfree.chart.demo.PolarChartDemo1.java
public PolarChartDemo1(String s) { super(s);//from ww w.ja v a 2 s .c om JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }
From source file:org.jfree.chart.demo.LogAxisDemo1.java
public LogAxisDemo1(String s) { super(s); JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }
From source file:org.jfree.chart.demo.StackedXYBarChartDemo1.java
public StackedXYBarChartDemo1(String s) { super(s);// w w w. ja v a 2 s . com JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(jpanel); }
From source file:Main.java
public Main() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel jl = new JLabel("Try with formatted text field "); Locale local1 = new Locale("en", "US"); int minFra = 0; int maxFra = 3; jft = setFormat(jft, local1, minFra, maxFra); jft.setMaximumSize(new Dimension(100, 20)); jft.setMinimumSize(new Dimension(100, 20)); jft.setPreferredSize(new Dimension(100, 20)); frame.add(jl);//from www . jav a 2 s . co m frame.add(jft, BorderLayout.NORTH); jb.addActionListener(e -> JOptionPane.showMessageDialog(jb, "nel text Box : " + jft.getText())); frame.pack(); frame.setVisible(true); }
From source file:Main.java
Main(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel jp = new JPanel(); Vector v = new Vector(); v.add("A");/*from w w w .j a v a 2 s . c o m*/ v.add("B"); v.add("C"); jcb = new JComboBox(v); jcb.setEditable(true); jcb.getActionMap().put("selectNext", new DownAction()); jp.setPreferredSize(new Dimension(200, 35)); jp.add(jcb); getContentPane().add(jp); pack(); setVisible(true); }
From source file:Main.java
/** * Sets the JButtons inside a JPanelto be the same size. * This is done dynamically by setting each button's preferred and maximum * sizes after the buttons are created. This way, the layout automatically * adjusts to the locale-specific strings. * * @param jPanelButtons JPanel containing buttons *///from ww w . j a v a 2 s . c o m public static void equalizeButtonSizes(JPanel jPanelButtons) { ArrayList<JButton> lbuttons = new ArrayList<JButton>(); for (int i = 0; i < jPanelButtons.getComponentCount(); i++) { Component c = jPanelButtons.getComponent(i); if (c instanceof JButton) { lbuttons.add((JButton) c); } } // Get the largest width and height Dimension maxSize = new Dimension(0, 0); for (JButton lbutton : lbuttons) { Dimension d = lbutton.getPreferredSize(); maxSize.width = Math.max(maxSize.width, d.width); maxSize.height = Math.max(maxSize.height, d.height); } for (JButton btn : lbuttons) { btn.setPreferredSize(maxSize); btn.setMinimumSize(maxSize); btn.setMaximumSize(maxSize); } }
From source file:Main.java
public Main() { super(new BorderLayout()); textArea.setEditable(false);// w w w .j a v a 2 s. co m scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(400, 250)); add(scrollPane, BorderLayout.CENTER); textArea.append("This text area displays information " + "about its mouse wheel events." + newline); textArea.addMouseWheelListener(this); setPreferredSize(new Dimension(450, 350)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:Main.java
public Colors() { addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { change();//from w w w . j av a 2 s . c o m } }); rectangular = false; super.setPreferredSize(new Dimension(200, 100)); change(); }
From source file:MainClass.java
MainClass(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel jp = new JPanel(); Vector v = new Vector(); v.add("A");//from ww w. j av a 2 s . co m v.add("B"); v.add("C"); jcb = new JComboBox(v); jcb.setEditable(true); jcb.getActionMap().put("selectNext", new DownAction()); jp.setPreferredSize(new Dimension(200, 35)); jp.add(jcb); getContentPane().add(jp); pack(); setVisible(true); }
From source file:org.jfree.chart.demo.XYBarChartDemo6.java
public XYBarChartDemo6(String s) { super(s);// w w w.j a va2 s . co m JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(500, 300)); setContentPane(jpanel); }