package jbPack;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.io.*;
class GuiAWT extends Frame {
GuiAWT() {
super("Guziczki");
setLayout(new GridLayout(3, 1));
/*
setLayout(new BorderLayout());
setLayout(new FlowLayout());
setLayout(new FlowLayout(FlowLayout.LEFT));
setLayout(new FlowLayout(FlowLayout.RIGHT));
setLayout(new GridLayout(1, 5));
setLayout(new GridLayout(5, 1));
setLayout(new GridLayout(3, 2));*/
TextField tf = new TextField();
add(tf);
Button b1 = new Button("C");
b1.setBackground(Color.red);
Button b2 = new Button("=");
Button b3 = new Button("/");
Button b4 = new Button("*");
Button b5 = new Button("7");
Button b6 = new Button("8");
Button b7 = new Button("9");
Button b8 = new Button("-");
Button b9 = new Button("5");
Button b10 = new Button("6");
Button b11 = new Button("7");
Button b12 = new Button("+");
Panel p1 = new Panel(new GridLayout(3, 4));
p1.add(b1);
p1.add(b2);
p1.add(b3);
p1.add(b4);
p1.add(b5);
p1.add(b6);
p1.add(b7);
p1.add(b8);
p1.add(b9);
p1.add(b10);
p1.add(b11);
p1.add(b12);
Panel p2 = new Panel(new GridLayout(1, 3));
Panel p3 = new Panel(new GridLayout(2, 1));
Panel p4 = new Panel(new GridLayout(1, 2));
Button b13 = new Button("1");
Button b14 = new Button("2");
p4.add(b13);
p4.add(b14);
p3.add(p4);
Button b15 = new Button("0");
p3.add(b15);
p2.add(p3);
Panel p5 = new Panel(new GridLayout(2, 1));
Button b16 = new Button("3");
Button b17 = new Button(".");
p5.add(b16);
p5.add(b17);
p2.add(p5);
Button b18 = new Button("=");
p2.add(p3);
p2.add(p5);
p2.add(b18);
add(p1);
add(p2);
pack();
show();
}
public static void main(String[] args) {
// w metodzie main tworzymy
//obiekt naszej klasy
// i wywołujemy konstruktor
new GuiAWT();
}
}
Wyszukiwarka
Podobne podstrony:
wpr zadania $wpr zadania wpr zadania 4wpr zadania wpr zadaniawpr zadania 3wpr zadania wpr zadania #wpr zadania wpr zadaniawpr zadania wpr zadania 1Analiza Matematyczna 2 ZadaniaZARZĄDZANIE FINANSAMI cwiczenia zadania rozwiazaneEZADANIE (11)zadanie domowe zestawwięcej podobnych podstron