ws.gui
Class GuiGeneration

java.lang.Object
  extended byws.gui.GuiGeneration
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class GuiGeneration
extends java.lang.Object
implements java.awt.event.ActionListener

This class contains the methods for creating basic parts of the main window(e.g. the input-panel and output-panel), and methods for trigerring different dialogs.

The main window(except dialogs, menus or popupmenu) is composed of input-panel and output-panel, the former has again two sub-panels, word-panel("Top" and "Web"-box, "Word"-inputfield, "START" and "STOP"-button) and data-panel("DATABASE"-list, "Show" and "Delete"-button). the latter has "WordSuggester"-pane and "WordNet"-pane, equipped with "Reset"-button and a progress bar.

This class has three nested classes, which extends the classes KeyAdapter and MouseAdapter, it implements also the method for its implemented interface ActionListener.

Author:
Sinian Zhang
See Also:
DeleteDialog, OkDialog, ShowStartDialog, StopDialog, StopwordsDialog, YesNoDialog, WsWnMenuBar, WsWnPopupMenu

Nested Class Summary
private  class GuiGeneration.DataMouseAdapter
          This class extends the class MouseAdapter.
private  class GuiGeneration.MyKeyAdapter
          This class extends the class KeyAdapter.
private  class GuiGeneration.OutputMouseAdapter
          This class extends the class MouseAdapter.
 
Field Summary
private  javax.swing.JList dataList
          The "DATABASE"-list.
private  javax.swing.JButton deleteButton
          The "Delete"-button.
private  javax.swing.JFrame frame
          The main window.
protected  javax.swing.JTextField inputField
          The "Word"-field, where to input one English word.
private  javax.swing.JTabbedPane outputPanel
          The output-panel composed of "WordSuggester"-pane and "WordNet"-pane.
static javax.swing.JProgressBar progressBar
          The progress bar of "WordSuggester"-pane.
private  javax.swing.JButton showButton
          The "Show"-button.
private  javax.swing.JButton startButton
          The "START"-button.
private  QeStart startThread
          The QeStart-object, QeStart extends the class Thread.
private  javax.swing.JButton stopButton
          The "STOP"-button.
private  javax.swing.JComboBox topBox
          The "Top"-box.
private  javax.swing.JComboBox webBox
          The "Web"-box.
private  javax.swing.JButton wnResetButton
          The "Reset"-button of "WordNet"-pane.
protected static javax.swing.JTextArea wnTextArea
          The output area of "WordNet"-pane.
private  javax.swing.JButton wsResetButton
          The "Reset"-button of "WordSuggester"-pane.
protected static javax.swing.JTextArea wsTextArea
          The output area of "WordSuggester"-pane.
 
Constructor Summary
GuiGeneration(javax.swing.JFrame frame)
          Initializes a GuiGeneration object.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Implements the inherited method actionPerformed from its implemented interface ActionListener.
protected  javax.swing.JPanel getDataPanel()
          Constructs the data-panel, which is composed of "DATABASE"-list, "Show"-button and "Delete"-button.
protected  javax.swing.JPanel getInputPanel(javax.swing.JPanel wordPanel, javax.swing.JPanel dataPanel)
          Constructs the input-panel, which is composed of word-panel and data-panel.
protected  javax.swing.JTabbedPane getOutputPanel()
          Constructs the output-panel, which is composed of two output-areas "WordSuggest" and "WordNet", also "Reset"-button and progress bar as well.
protected  javax.swing.JPanel getWordPanel()
          Constructs the word-panel, which is composed of "Top"-box, "Web"-box, "Word"-inputfield, "START"-button and "STOP"-button.
private static java.awt.GridBagConstraints makeGBC(int x, int y, int width, int height)
          Configurates the layout constraints for the elements in word-panel.
protected static void resetWNTextArea(javax.swing.JTextArea textArea)
          Resets the output-area of "WordNet"-pane.
protected static void resetWSTextArea(javax.swing.JTextArea textArea)
          Resets the output-area of "WordSuggester"-pane.
protected static void updateDataList(javax.swing.JList dataList)
          Updates the "DATABASE"-list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

frame

private javax.swing.JFrame frame
The main window.


startButton

private javax.swing.JButton startButton
The "START"-button.


stopButton

private javax.swing.JButton stopButton
The "STOP"-button.


showButton

private javax.swing.JButton showButton
The "Show"-button.


deleteButton

private javax.swing.JButton deleteButton
The "Delete"-button.


wsResetButton

private javax.swing.JButton wsResetButton
The "Reset"-button of "WordSuggester"-pane.


wnResetButton

private javax.swing.JButton wnResetButton
The "Reset"-button of "WordNet"-pane.


topBox

private javax.swing.JComboBox topBox
The "Top"-box.


webBox

private javax.swing.JComboBox webBox
The "Web"-box.


inputField

protected javax.swing.JTextField inputField
The "Word"-field, where to input one English word.


dataList

private javax.swing.JList dataList
The "DATABASE"-list.


outputPanel

private javax.swing.JTabbedPane outputPanel
The output-panel composed of "WordSuggester"-pane and "WordNet"-pane.


wsTextArea

protected static javax.swing.JTextArea wsTextArea
The output area of "WordSuggester"-pane.


wnTextArea

protected static javax.swing.JTextArea wnTextArea
The output area of "WordNet"-pane.


progressBar

public static javax.swing.JProgressBar progressBar
The progress bar of "WordSuggester"-pane.


startThread

private QeStart startThread
The QeStart-object, QeStart extends the class Thread.

See Also:
QeStart
Constructor Detail

GuiGeneration

public GuiGeneration(javax.swing.JFrame frame)
Initializes a GuiGeneration object.

Parameters:
frame - The main woidow of the GUI.
Method Detail

getInputPanel

protected javax.swing.JPanel getInputPanel(javax.swing.JPanel wordPanel,
                                           javax.swing.JPanel dataPanel)
Constructs the input-panel, which is composed of word-panel and data-panel.

Parameters:
wordPanel - The word-panel, the first part of input-panel.
dataPanel - The data-panal, the second part of input-panel.
Returns:
The constructed input-panel.

getWordPanel

protected javax.swing.JPanel getWordPanel()
Constructs the word-panel, which is composed of "Top"-box, "Web"-box, "Word"-inputfield, "START"-button and "STOP"-button.

Returns:
The constructed word-panel.

getDataPanel

protected javax.swing.JPanel getDataPanel()
                                   throws java.io.IOException
Constructs the data-panel, which is composed of "DATABASE"-list, "Show"-button and "Delete"-button.

Returns:
The constructed data-panel.
Throws:
java.io.IOException

getOutputPanel

protected javax.swing.JTabbedPane getOutputPanel()
Constructs the output-panel, which is composed of two output-areas "WordSuggest" and "WordNet", also "Reset"-button and progress bar as well.

Returns:
The constructed output-panel.

makeGBC

private static java.awt.GridBagConstraints makeGBC(int x,
                                                   int y,
                                                   int width,
                                                   int height)
Configurates the layout constraints for the elements in word-panel.

Parameters:
x - Specifies the cell containing the leading edge of the component's display area.
y - Specifies the cell at the top of the component's display area.
width - Specifies the number of cells in a row for the component's display area.
height - Specifies the number of cells in a column for the component's display area.
Returns:
The configurated GridBagConstraints object.
See Also:
getOutputPanel(), java.awt.GridBagConstraints , java.awt.GridBagLayout

updateDataList

protected static void updateDataList(javax.swing.JList dataList)
                              throws java.io.IOException
Updates the "DATABASE"-list.

Parameters:
dataList - The "DATABASE"-list.
Throws:
java.io.IOException
See Also:
Tools.deleteStemInDBList(String, String), Tools.getDataList(String)

resetWSTextArea

protected static void resetWSTextArea(javax.swing.JTextArea textArea)
Resets the output-area of "WordSuggester"-pane.

Parameters:
textArea - The output-area.

resetWNTextArea

protected static void resetWNTextArea(javax.swing.JTextArea textArea)
Resets the output-area of "WordNet"-pane.

Parameters:
textArea - The output-area.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Implements the inherited method actionPerformed from its implemented interface ActionListener.

Specified by:
actionPerformed in interface java.awt.event.ActionListener