ConceptSelectionDlg.java
Go to the documentation of this file.
00001 package instruction.gui.dialog;
00002 
00003 import java.awt.Dimension;
00004 import java.awt.Font;
00005 import java.awt.Frame;
00006 import java.awt.SystemColor;
00007 import java.awt.event.ActionEvent;
00008 import java.awt.event.ActionListener;
00009 
00010 import javax.swing.BorderFactory;
00011 import javax.swing.JButton;
00012 import javax.swing.JDialog;
00013 import javax.swing.JLabel;
00014 import javax.swing.JList;
00015 import javax.swing.JPanel;
00016 import javax.swing.ListSelectionModel;
00017 import javax.swing.SpringLayout;
00018 
00019 public class ConceptSelectionDlg extends JDialog {
00020 
00021         private static final long serialVersionUID = 1L;
00022         private JPanel jContentPane = null;
00023         private JLabel jLabel = null;
00024         private JLabel labelWord = null;
00025         private JButton jButton = null;
00026         private JLabel textInstruction = null;
00027         private JList conceptList = null;
00031         public ConceptSelectionDlg ( Frame owner ) {
00032 
00033                 super( owner );
00034                 initialize();
00035         }
00036 
00042         private void initialize() {
00043 
00044                 
00045                 this.setContentPane(getJContentPane());
00046                 this.setTitle("Disambiguator Training");
00047                 this.setSize(650,250);
00048         }
00049         
00055         private JPanel getJContentPane() {
00056 
00057                 if ( jContentPane == null ) {
00058                         
00059                         jContentPane = new JPanel();
00060                         SpringLayout layout = new SpringLayout();
00061                         jContentPane.setLayout(layout);
00062                         
00063                         getConceptList();
00064                         getTextInstruction();
00065                         JButton button = getJButton();
00066                         jLabel = new JLabel();
00067                         jLabel.setText("Please select the correct sense of the underlined word in the following instruction:");
00068                         jContentPane.add(jLabel);
00069                         
00070                         labelWord = new JLabel();
00071                         labelWord.setText("");
00072                         
00073                         
00074                         layout.putConstraint(SpringLayout.NORTH, jLabel, 10, SpringLayout.NORTH, jContentPane);
00075                         layout.putConstraint(SpringLayout.WEST, jLabel, 10, SpringLayout.WEST, jContentPane);
00076                         layout.putConstraint(SpringLayout.EAST, jLabel, -10, SpringLayout.EAST, jContentPane);
00077                         
00078                         layout.putConstraint(SpringLayout.NORTH, textInstruction, 0, SpringLayout.SOUTH, jLabel);
00079                         layout.putConstraint(SpringLayout.WEST, textInstruction, 10, SpringLayout.WEST, jContentPane);
00080                         layout.putConstraint(SpringLayout.EAST, textInstruction, -10, SpringLayout.EAST, jContentPane);
00081                         
00082                         layout.putConstraint(SpringLayout.NORTH, conceptList, 0, SpringLayout.SOUTH, textInstruction);
00083                         layout.putConstraint(SpringLayout.WEST, conceptList, 10, SpringLayout.WEST, jContentPane);
00084                         layout.putConstraint(SpringLayout.EAST, conceptList, -10, SpringLayout.EAST, jContentPane);
00085                         
00086                         layout.putConstraint(SpringLayout.NORTH, button, 20, SpringLayout.SOUTH, conceptList);
00087                         layout.putConstraint(SpringLayout.SOUTH, button, -10, SpringLayout.SOUTH, jContentPane);
00088                         layout.putConstraint(SpringLayout.WEST, button, 10, SpringLayout.WEST, jContentPane);
00089                         
00090                         
00091                         
00092                         jContentPane.add(labelWord);
00093                         jContentPane.add(button);
00094                         jContentPane.add(textInstruction);
00095                         jContentPane.add(conceptList);
00096                         
00097                 }
00098                 return jContentPane;
00099         }
00100 
00106         private JButton getJButton() {
00107         
00108                 if ( jButton == null ) {
00109                         jButton = new JButton();
00110                         jButton.setText("OK");
00111                         jButton.setPreferredSize(new Dimension(100, 30));
00112                         jButton.addActionListener(new ActionListener() {
00113 
00114                                 
00115                                 public void actionPerformed(ActionEvent arg0) {
00116                                         ConceptSelectionDlg.this.setVisible(false);
00117                                 }
00118                                 
00119                         });
00120                 }
00121                 return jButton;
00122         }
00123 
00129         public JLabel getTextInstruction() {
00130                 if (textInstruction == null) {
00131                         textInstruction = new JLabel();
00132                         textInstruction.setText("Instruction");
00133                         textInstruction.setBackground(SystemColor.control);
00134                         textInstruction.setFont(new Font("Dialog", Font.BOLD, 12));
00135                         textInstruction.setPreferredSize(new Dimension(61, 50));
00136                         textInstruction.setBorder(BorderFactory.createEmptyBorder());
00137                 }
00138                 return textInstruction;
00139         }
00140 
00146         public JList getConceptList() {
00147                 if (conceptList == null) {
00148                         conceptList = new JList();
00149                         conceptList.setBorder(BorderFactory.createEtchedBorder());
00150                         conceptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
00151                         conceptList.setLayoutOrientation(JList.VERTICAL);
00152                         conceptList.setPreferredSize(new Dimension(0,100));
00153                 }
00154                 return conceptList;
00155         }
00156         
00157         public JLabel getLabelWord() {
00158                 return labelWord;
00159         }
00160 
00161 }  //  @jve:decl-index=0:visual-constraint="124,82"
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


comp_ehow
Author(s): Moritz Tenorth, Daniel Nyga
autogenerated on Tue Apr 16 2013 00:18:02