Page 135 - 4836
P. 135
SimpleWindow () {
super ( "Пробне вікно") ;
setDefaultCloseOperation ( EXIT_ON_CLOSE ) ;
package Swing;
import java.awt.*;
import java.awt.FlowLayout;
import javax.swing.*;
public class SimpleWindow extends JFrame {
SimpleWindow () {
super ( " Пробне вікно");
setDefaultCloseOperation ( EXIT_ON_CLOSE );
Box box = Box.createVerticalBox();
box.add ( new JButton ("Кнопка"));
box.add ( Box.createVerticalStrut (10));
box.add ( new JButton ("+"));
box.add ( Box.createVerticalGlue ( ));
box.add ( new JButton ( "-" ));
box.add ( Box.createVerticalStrut ( 10 ));
box.add ( new JButton ("Кнопка з довгою
написом"));
setContentPane (box);
setSize (250, 100);
} }
}
Як результат:
133