Advertisement
MixyPro

Untitled

May 5th, 2016
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1.  
  2. import java.awt.BorderLayout;
  3. import javafx.event.ActionEvent;
  4. import javax.swing.AbstractAction;
  5. import javax.swing.JButton;
  6. import javax.swing.JFrame;
  7. import javax.swing.JScrollPane;
  8. import javax.swing.JTextArea;
  9.  
  10. /*
  11.  * To change this license header, choose License Headers in Project Properties.
  12.  * To change this template file, choose Tools | Templates
  13.  * and open the template in the editor.
  14.  */
  15.  
  16. /**
  17.  *
  18.  * @author miljan
  19.  */
  20. public class GuiEx extends JFrame{
  21.     private static final int[] daniumesecu = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  22.     public GuiEx(){
  23.         super ("GUIEx primer");
  24.         final JTextArea text = new JTextArea(14, 30);
  25.         getContentPane().add(new JScrollPane(text));
  26.         getContentPane().add(new JButton(new AbstractAction("Izracunaj!"){
  27.             public void actionPerformed(ActionEvent e){
  28.                 text.setText("");
  29.                 for(int i=0; i<=daniumesecu.length; i++){
  30.                         text.append("Mesec "+ (i+1) + ": " + daniumesecu[i] + "\n");
  31.             }
  32.         }
  33.         }), BorderLayout.NORTH);
  34.     }
  35.     public static void main(String[] args) {
  36.         GuiEx guiEx = new GuiEx();
  37.         guiEx.pack();
  38.         guiEx.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  39.         guiEx.show();
  40.     }
  41.             }
  42.        
  43.    
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement