File: BoxVsPanel.java

package info (click to toggle)
king 2.24%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 78,588 kB
  • sloc: java: 111,577; xml: 1,868; cpp: 209; perl: 127; sh: 102; python: 99; makefile: 60; ansic: 7
file content (45 lines) | stat: -rw-r--r-- 1,235 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.awt.*;
import javax.swing.*;
/**
* <code>BoxVsPanel</code> demonstrates a Box-rendering
* bug on the Mac, Java 1.4.1.
*
* <p>Copyright (C) 2003 by Ian W. Davis. All rights reserved.
* <br>Begun on Tue Jun 10 08:51:17 EDT 2003
*/
public class BoxVsPanel //extends ... implements ...
{
    public void Main()
    {
        JPanel  panel   = new JPanel(new GridLayout(0,1));
        Box     box     = Box.createVerticalBox();
        
        fillContainer(panel);
        fillContainer(box);
        
        Box cp = Box.createHorizontalBox();
        cp.add(panel);
        cp.add(box);
        
        JFrame frame = new JFrame("BoxVsPanel2");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setContentPane(cp);
        frame.pack();
        frame.setSize(frame.getWidth()+100, frame.getHeight()+100);
        frame.setVisible(true);
    }
    
    void fillContainer(Container c)
    {
        c.add(new JCheckBox("[Dum dum dum] A loooong time ago in a"));
        c.add(new JCheckBox("galaxy"));
        c.add(new JCheckBox("far, far away..."));
    }

    public static void main(String[] args)
    {
        BoxVsPanel mainprog = new BoxVsPanel();
        mainprog.Main();
    }
}//class