Advertisement
Guest User

da

a guest
Jan 20th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. package edno;
  2.  
  3. import java.awt.EventQueue;
  4. import java.awt.Label;
  5.  
  6. import javax.swing.JFrame;
  7. import javax.swing.JOptionPane;
  8. import javax.swing.JTextField;
  9. import javax.swing.text.StyledEditorKit.ForegroundAction;
  10.  
  11. import org.w3c.dom.ranges.DocumentRange;
  12.  
  13. import javax.swing.JButton;
  14. import java.awt.event.ActionListener;
  15. import java.awt.event.ActionEvent;
  16. import javax.swing.JLabel;
  17.  
  18. public class gpida {
  19.  
  20. private JFrame frame;
  21. private JTextField textField;
  22. private JTextField textField_1;
  23.  
  24. /**
  25. * Launch the application.
  26. */
  27. public static void main(String[] args) {
  28. EventQueue.invokeLater(new Runnable() {
  29. public void run() {
  30. try {
  31. gpida window = new gpida();
  32. window.frame.setVisible(true);
  33. } catch (Exception e) {
  34. e.printStackTrace();
  35. }
  36. }
  37. });
  38. }
  39.  
  40. /**
  41. * Create the application.
  42. */
  43. public gpida() {
  44. initialize();
  45. }
  46.  
  47. /**
  48. * Initialize the contents of the frame.
  49. */
  50. private void initialize() {
  51. frame = new JFrame();
  52. frame.setBounds(100, 100, 450, 300);
  53. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  54. frame.getContentPane().setLayout(null);
  55.  
  56. textField = new JTextField();
  57. textField.setBounds(10, 95, 86, 20);
  58. frame.getContentPane().add(textField);
  59. textField.setColumns(10);
  60. JLabel lblNewLabel = new JLabel("New label");
  61. lblNewLabel.setBounds(37, 190, 180, 14);
  62. frame.getContentPane().add(lblNewLabel);
  63. textField_1 = new JTextField();
  64. textField_1.setBounds(106, 95, 86, 20);
  65. frame.getContentPane().add(textField_1);
  66. textField_1.setColumns(10);
  67. JButton btnNasturjiiiiiiiiiiiiii = new JButton("");
  68. btnNasturjiiiiiiiiiiiiii.addActionListener(new ActionListener() {
  69. public void actionPerformed(ActionEvent arg0) {
  70. int a = Integer.parseInt(textField.getText());
  71. int b = Integer.parseInt(textField_1.getText());
  72. double arr[] = new double[a];
  73. // double arr[]=new double[b];
  74. int total = 1;
  75. for (int i = a; i <= b; i++) {
  76. if (i % 3 == 0) {
  77. total *= i;
  78. }
  79.  
  80. }
  81.  
  82. if (total == 1) {
  83. lblNewLabel.setText("Nqma Proizvedenie");
  84. } else {
  85. lblNewLabel.setText("Proizvedenieto e " + total);
  86.  
  87. }
  88.  
  89. }
  90. });
  91. btnNasturjiiiiiiiiiiiiii.setBounds(10, 126, 180, 23);
  92. frame.getContentPane().add(btnNasturjiiiiiiiiiiiiii);
  93.  
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement