Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5.  
  6. class Button {
  7. static JButton button1 = new JButton();
  8. }
  9.  
  10.  
  11.  
  12. class ButtonListener1 extends Button implements ActionListener {
  13.  
  14. @Override
  15. public void actionPerformed(ActionEvent e) {
  16. button1.setText("Привет");
  17. Font BigFontTR = new Font("TimesRoman", Font.BOLD, 100);
  18. button1.setFont(BigFontTR);
  19. }
  20.  
  21. }
  22.  
  23. public class Jitik extends ButtonListener1 {
  24. public static void main(String[] args) {
  25. JFrame frame = new JFrame("Jitik");
  26. frame.setSize(800, 1000);
  27. frame.setLocationRelativeTo(null);
  28. JPanel panel = new JPanel(new GridLayout(2, 1, 5, 5));
  29. frame.add(panel);
  30. panel.add(button1);
  31. button1.addActionListener(new ButtonListener1());
  32. frame.setVisible(true);
  33.  
  34. String s = button1.getText();
  35. System.out.println(s);
  36.  
  37.  
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement