- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 
                        import java.awt.event.*;
import javax.swing.*;
public class Experiment implements ActionListener{
    JFrame frame;
    JButton button;
    public static void main(String[] args) {
        Experiment experiment = new Experiment();
        experiment.go();
    }
    public void go(){
        frame = new JFrame();
        button = new JButton("You is winner!");
        button.addActionListener(this);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(button);
        frame.setSize(400, 400);
        frame.setVisible(true);
    }
    public void actionPerformed(ActionEvent event){
        button.setText("You is loser!");
        frame.setSize(700, 700);
    }
}
                                 
        
            GUI, Создание кнопки и ее изменение, а также изменение фрейма!!! ОЦЕНИТЕ КОД!
        
        
Комментарии (0) RSS
Добавить комментарий