Description: import java.awt.*
import java.util.*
import java.applet.Applet
public class GridBagEx1 extends Applet {
protected void makebutton(String name, GridBagLayout gridbag,
GridBagConstraints c) {
Button button = new Button(name)
gridbag.setConstraints(button, c)
add(button)
}
public void init() {
GridBagLayout gridbag = new GridBagLayout()
GridBagConstraints c = new GridBagConstraints()
setFont(new Font("SansSerif", Font.PLAIN, 14))
setLayout(gridbag)
c.fill = GridBagConstraints.BOTH
c.weightx = 1.0
// makebutton("Button1", gridbag, c)
// makebutton("Button2", gridbag, c)
// makebutton("Button3", gridbag, c)
c.gridwidth = GridBagConstraints.REMAINDER // end row
makebutton("Button4", gridbag, c)
c.weightx = 0.0 // reset to the default
makebutton("Button5", gridbag, c) // another row
c.gridwidth = GridBagConstraints.RELATIVE // next-to-last in row
makebutton("Button6", gridbag, c)
c
To Search:
File list (Check if you may need any files):
GridBagEx1.java