John Eriksson avatar John Eriksson committed ec3194f

Host text field now disabled when default host name is selected

Comments (0)

Files changed (1)

src/se/kth/csc/sima/SimaGUICourseDialog.java

             gridLayout.setConstraints(this.queueDialog.add(new JLabel("Plats")), c);
             ButtonGroup place = new ButtonGroup();
             this.defaultHostButton = new JRadioButton("Använd datornamnet (" + Utils.getHost() + ")", true);
-            this.customHostButton = new JRadioButton();
+            this.customHostButton = new JRadioButton();            
             place.add(this.defaultHostButton);
             place.add(this.customHostButton);
             c.weighty = 0.0;
             gridLayout.setConstraints(this.queueDialog.add(this.customHostButton), c);
             c.gridwidth = GridBagConstraints.REMAINDER;
             gridLayout.setConstraints(this.queueDialog.add(this.customHostField = new JTextField()), c);
-
+            
             c.gridwidth = 1;
             c.insets = new Insets(5, 5, 5, 5);
             gridLayout.setConstraints(this.queueDialog.add(new JLabel("Meddelande")), c);
             c.gridwidth = GridBagConstraints.REMAINDER;
             gridLayout.setConstraints(this.queueDialog.add(this.messageField = new JTextField()), c);
+            
+            defaultHostButton.addActionListener(new ActionListener() {
+
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    customHostField.setEnabled(false);
+                }
+            });
+            customHostField.setEnabled(false);
+            customHostButton.addActionListener(new ActionListener() {
+
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    customHostField.setEnabled(true);
+                }
+            });
         }
         this.bottomPanel.add(this.queueDialog, BorderLayout.CENTER);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.