File: Form.java

package info (click to toggle)
lg-issue29 1-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,992 kB
  • ctags: 387
  • sloc: java: 758; makefile: 31; sh: 3
file content (35 lines) | stat: -rw-r--r-- 1,781 bytes parent folder | download | duplicates (4)
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
package Jcd;   // -- Listing-2 -- Form.java  //  1
                                             //  2
import java.awt.*;                           //  3
                                             //  4
public class Form extends Frame {            //  5
                                             //  6
 // Subclass the AWT GridBagLayout Frame by adding
 // methods to set up placement constraints.     
                                             //  9
  public GridBagLayout layout;               // 10
                                             // 11
  protected Insets formInsets=new Insets(1,1,1,1);
                                             // 13
  public Form(String title)                  // 14
  {                                          // 15
    super(title);                            // 16
    layout = new GridBagLayout();            // 17
    setLayout(layout);                       // 18
  }                                          // 19
                                             // 20
  public Component addCenter(Component comp) // 21
  {                                          // 22
    int fill = GridBagConstraints.NONE;      // 23
    Insets insets = formInsets;              // 24
    GridBagConstraints c=new GridBagConstraints();
    c.gridx = 0;                             // 26
    c.gridy = GridBagConstraints.RELATIVE;   // 27
    c.anchor = GridBagConstraints.CENTER;    // 28
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = fill;                           // 30
    c.insets = insets;                       // 31
    layout.setConstraints(comp, c);          // 32
    return super.add(comp);                  // 33
  }                                          // 34
}                                            // 35