Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BorderLayout;
- import javafx.event.ActionEvent;
- import javax.swing.AbstractAction;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JScrollPane;
- import javax.swing.JTextArea;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author miljan
- */
- public class GuiEx extends JFrame{
- private static final int[] daniumesecu = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- public GuiEx(){
- super ("GUIEx primer");
- final JTextArea text = new JTextArea(14, 30);
- getContentPane().add(new JScrollPane(text));
- getContentPane().add(new JButton(new AbstractAction("Izracunaj!"){
- public void actionPerformed(ActionEvent e){
- text.setText("");
- for(int i=0; i<=daniumesecu.length; i++){
- text.append("Mesec "+ (i+1) + ": " + daniumesecu[i] + "\n");
- }
- }
- }), BorderLayout.NORTH);
- }
- public static void main(String[] args) {
- GuiEx guiEx = new GuiEx();
- guiEx.pack();
- guiEx.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- guiEx.show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement