Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. package teopi4a;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.EventQueue;
  5.  
  6. import javax.swing.JFrame;
  7. import javax.swing.JOptionPane;
  8. import javax.swing.JPanel;
  9. import javax.swing.border.EmptyBorder;
  10. import javax.swing.JTextField;
  11. import javax.swing.JButton;
  12. import java.awt.event.ActionListener;
  13. import java.util.Date;
  14. import java.awt.event.ActionEvent;
  15. import javax.swing.UIManager;
  16. import java.awt.Color;
  17.  
  18. public class Teooooooooooooooooooooooooooooooooooooooooooooooooo1 extends JFrame {
  19. private JPanel contentPane;
  20. private JTextField txtField;
  21.  
  22. public static void main(String[] args) {
  23. EventQueue.invokeLater(new Runnable() {
  24. public void run() {
  25. try {
  26. Teooooooooooooooooooooooooooooooooooooooooooooooooo1 frame = new Teooooooooooooooooooooooooooooooooooooooooooooooooo1();
  27. frame.setVisible(true);
  28. } catch (Exception e) {
  29. e.printStackTrace();
  30. }
  31. }
  32. });
  33. }
  34.  
  35. /**
  36. * Create the frame.
  37. */
  38. public Teooooooooooooooooooooooooooooooooooooooooooooooooo1() {
  39. setTitle("\u0417\u043E\u0434\u0438\u044F");
  40. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  41. setBounds(100, 100, 200, 158);
  42. contentPane = new JPanel();
  43. contentPane.setBackground(Color.GREEN);
  44. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  45. setContentPane(contentPane);
  46. contentPane.setLayout(null);
  47.  
  48. txtField = new JTextField();
  49. txtField.setBounds(20, 22, 158, 20);
  50. contentPane.add(txtField);
  51. txtField.setColumns(10);
  52.  
  53. JButton btnNewButton = new JButton("\u0412\u044A\u0432\u0435\u0434\u0438");
  54. btnNewButton.setForeground(Color.GREEN);
  55. btnNewButton.setBackground(Color.BLACK);
  56. btnNewButton.addActionListener(new ActionListener() {
  57. public void actionPerformed(ActionEvent arg0) {
  58. String egn = txtField.getText();
  59. int god = Integer.valueOf(egn.substring(0, 2));
  60. int month = Integer.valueOf(egn.substring(2, 4));
  61. if (month > 40) {
  62. month -= 40;
  63. year += 2000;
  64. } else if (month > 20) {
  65. month -= 20;
  66. year += 1800;
  67. } else {
  68. year += 1900;
  69. }
  70. int day = Integer.valueOf(egn.substring(4, 6));
  71.  
  72. String zodia = "null";
  73.  
  74. if ((month ==12 && day>=22 && day<=31)||(month==1 && day>=1 && day<=19))
  75. zodia = "Capricorn";
  76. else if ((month==1 && day>=20 && day<=31)||(month==2 && day>=1 && day<=17))
  77. zodia = "Aquarius";
  78. else if ((month==2 && day>=18 && day<=29)||(month==3 && day>=1 && day<=19))
  79. zodia = "Pisces";
  80. else if ((month==3 && day>=20 && day<=31)||(month ==4 && day>=1 && day<=19))
  81. zodia = "Aries";
  82. else if ((month==4 && day>=20 && day<= 30)||(month==5 && day>=1 && day<=20))
  83. zodia = "Taurus";
  84. else if ((month==5 && day>=21&& day<=31)||(month==6 && day>=1 && day<=20))
  85. zodia = "Gemini";
  86. else if ((month==6 && day>=21 && day<=30)||(month==7 && day>=1 && day<=22))
  87. zodia = "Cancer";
  88. else if ((month==7 && day>=23 && day<=31)||(month==8 && day>=1 && day<=22))
  89. zodia = "Leo";
  90. else if ((month==8 && day>=23 && day<=31)||(month==9 && day>=1 && day<=22))
  91. zodia = "Virgo";
  92. else if ((month==9 && day>=23 && day<=30)||(month==10 && day>=1 && day<=22))
  93. zodia = "Libra";
  94. else if ((month==10 && day>=23 && day<=31)||(month==11 && day>=1 && day<=21))
  95. zodia = "Scorpio";
  96. else if ((month==11 && day>=22 && day<=30)||(month==12 && day>=1 && day<=21))
  97. zodia = "Sagittarius";
  98.  
  99. JOptionPane.showMessageDialog(contentPane, zodia);
  100. }
  101. });
  102. btnNewButton.setBounds(54, 78, 91, 23);
  103. contentPane.add(btnNewButton);
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement