Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- public class Slusac implements ActionListener{
- Frame f;
- public Slusac(Frame f){
- this.f=f;
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- if(e.getActionCommand().equals("a")){
- GUI.Dijalog a = new GUI.Dijalog(f);
- }
- }
- }
- /////////////////////////////
- import java.awt.*;
- public class GUI extends Frame{
- GUI(){
- super("stagod");
- Slusac s1 = new Slusac(this);
- setVisible(true);
- Button a = new Button("a");
- Button b = new Button("b");
- setSize(500,400);
- add(a);
- add(b);
- setLayout(new FlowLayout());
- a.addActionListener(s1);
- b.addActionListener(s1);
- }
- static class Dijalog extends Dialog{
- Dijalog(Frame roditelj){
- super(roditelj,"titl",true);
- setSize(150,200);
- setVisible(true);
- }
- }
- }
- //////////////////////////
- public class aplikacija {
- public static void main(String[] args) {
- GUI g = new GUI();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment