Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 105 additions and 3 deletions. Show diff stats Hide diff stats

  1. 108  src/gui/EventWindow.java
108  src/gui/EventWindow.java
... ...
@@ -1,13 +1,115 @@
1 1
 package gui;
2 2
 
  3
+import java.awt.Dimension;
  4
+
  5
+import javax.swing.ButtonGroup;
  6
+import javax.swing.DefaultListModel;
  7
+import javax.swing.JButton;
  8
+import javax.swing.JComboBox;
3 9
 import javax.swing.JFrame;
  10
+import javax.swing.JLabel;
  11
+import javax.swing.JList;
  12
+import javax.swing.JPanel;
  13
+import javax.swing.JRadioButton;
  14
+import javax.swing.JSpinner;
  15
+import javax.swing.JTextField;
  16
+
4 17
 
5  
-public class EventWindow {
  18
+import net.miginfocom.swing.MigLayout;
  19
+
  20
+public class EventWindow extends JPanel {
6 21
 	//fields
7  
-	JFrame panel;
  22
+	JLabel whatLabel = new JLabel("Hva");
  23
+	JLabel infoLabel = new JLabel("Info");
  24
+	JLabel timeLabel = new JLabel("Tid");
  25
+	JLabel dash = new JLabel("-");
  26
+	JLabel dateLabel = new JLabel("Dato");
  27
+	JLabel roomLabel = new JLabel("Rom");
  28
+	JLabel participantsLabel = new JLabel("Andre deltakere");
  29
+	JLabel emptyLabel = new JLabel();
  30
+	JLabel locationLabel = new JLabel("Sted");
  31
+	
  32
+	DefaultListModel listModel = new DefaultListModel();
  33
+	
  34
+	
  35
+	
  36
+	JTextField what = new JTextField();
  37
+	JTextField info = new JTextField();
  38
+	
  39
+	JSpinner start = new JSpinner();
  40
+	JSpinner end = new JSpinner();
  41
+	
  42
+	JComboBox date = new JComboBox();
  43
+	JComboBox rooms = new JComboBox();
  44
+	
  45
+	JRadioButton reserveRoom = new JRadioButton("M¿terom");
  46
+	JRadioButton noRoom = new JRadioButton("AnnetÉ");
  47
+	ButtonGroup radioButtonGroup = new ButtonGroup();
  48
+	
  49
+	JTextField location = new JTextField();
  50
+	
  51
+	JButton addParticipants = new JButton("Legg til deltakereÉ");
  52
+	JList participants = new JList();
8 53
 	
9 54
 	//constructor
10 55
 	public EventWindow(){
11  
-		panel = new JFrame();
  56
+		setLayout(new MigLayout(
  57
+				"wrap 3, fill",									//Layout constraints
  58
+				"",											//Column constraints
  59
+				""));										//row constraints
  60
+		
  61
+		
  62
+		add(whatLabel);
  63
+		add(what,"grow,wrap,span");
  64
+		
  65
+		add(infoLabel);
  66
+		add(info, "grow,wrap,span");
  67
+		
  68
+		add(timeLabel);
  69
+		add(start, "split 3, align left,grow, span");
  70
+		add(dash);
  71
+		add(end, "split 3, align left,grow, span");
  72
+		
  73
+		add(dateLabel);
  74
+		add(date, "span, grow");
  75
+		
  76
+		add(emptyLabel);
  77
+		radioButtonGroup.add(reserveRoom);
  78
+		radioButtonGroup.add(noRoom);
  79
+		add(reserveRoom);
  80
+		add(noRoom);
  81
+		
  82
+		add(locationLabel,"split 2, hidemode 2");
  83
+		add(roomLabel, "hidemode 2");
  84
+		locationLabel.setVisible(false);
  85
+		roomLabel.setVisible(true);
  86
+		
  87
+		add(rooms,"span, grow, wrap, split 2, hidemode 2");	
  88
+		add(location, "span, grow, wrap, hidemode 2");
  89
+		
  90
+		location.setVisible(false);
  91
+		rooms.setVisible(true);
  92
+		
  93
+		add(participantsLabel);
  94
+		add(addParticipants,"align right, span");
  95
+		
  96
+		
  97
+		
  98
+		participants.setModel(listModel);
  99
+		participants.setMinimumSize(new Dimension(1,130));
  100
+		add(participants, "span, grow");
  101
+	    setVisible(true);
  102
+	}
  103
+	
  104
+	public static void main(String[] args){
  105
+		JFrame f = new JFrame();
  106
+		f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  107
+		f.getContentPane().add(new EventWindow());
  108
+		
  109
+		
  110
+		
  111
+		
  112
+		f.pack();
  113
+	    f.setVisible(true);
12 114
 	}
13 115
 }

No commit comments for this range

Something went wrong with that request. Please try again.