edu.ntnu.item.jt.GUI
Class GUI

java.lang.Object
  extended by edu.ntnu.item.jt.GUI.GUI
All Implemented Interfaces:
ActionListener, KeyListener, WindowListener, Runnable, EventListener

public class GUI
extends Object
implements ActionListener, KeyListener, WindowListener, Runnable

This class is responsible for creating and managing the GUI.

Author:
Thomas Langerud

Field Summary
(package private)  String ABOUT_STRING
           
(package private)  JButton analyze
           
(package private)  JPanel bottomPanel
           
(package private)  int carretPosition
           
(package private)  JButton clear
           
(package private)  JButton clear1
           
(package private)  JButton clear2
           
(package private)  JButton clear3
           
(package private)  String CLOSE_CONSOLE_WARNING
           
(package private)  String CLOSE_WARNING
           
(package private)  JTextField configField
           
(package private)  JLabel configLabel
           
(package private)  JTextArea consoleTextArea
           
(package private)  String EMPTY_SAMPLE_PATH_ERROR
           
(package private)  JButton execute
           
(package private)  String EXIT_WARNING_QUESTION
           
(package private)  JFileChooser fc
           
(package private)  int FIELD_CONFIG
           
(package private)  int FIELD_MALWARE
           
(package private)  int FIELD_PROPS
           
(package private)  String HELP_STRING
           
(package private)  JScrollPane jScrollPane1
           
(package private)  String LOOK_AND_FEEL_PATH
           
(package private)  String MAIN_WINDOW_TITLE
           
(package private)  JPanel mainPanel
           
(package private)  JFrame mainWindow
           
(package private)  JMenuBar menuBar
           
(package private)  JMenu menuEdit
           
(package private)  JMenu menuHelp
           
(package private)  JMenuItem menuItemAbout
           
(package private)  JMenuItem menuItemConfEditor
           
(package private)  JMenuItem menuItemExit
           
(package private)  JMenuItem menuItemHelp
           
(package private)  JMenuItem menuItemRestart
           
(package private)  JMenuItem menuItemSave
           
(package private)  JMenuItem menuItemStart
           
(package private)  JMenu menuOutput
           
(package private)  JMenu menuSystem
           
(package private)  JPanel middlePanel
           
(package private)  JButton open1
           
(package private)  JButton open2
           
(package private)  JButton open3
           
(package private)  int operation
           
(package private)  int OPERATION_ANALYZE
           
(package private)  int OPERATION_EXECUTE
           
(package private)  int OPERATION_INITIALIZE
           
(package private)  int OPERATION_SCAN
           
(package private)  int OPERATION_UPDATE
           
(package private)  Preferences prefs
           
(package private)  JTextField propsField
           
(package private)  JLabel propsLabel
           
(package private)  PowerScan ps
           
(package private)  String REGPATH_CONFIG
           
(package private)  String REGPATH_OUTPUTSAVE
           
(package private)  String REGPATH_PROPS
           
(package private)  JLabel samplePath
           
(package private)  JTextField samplePathField
           
(package private)  JFileChooser saveFC
           
(package private)  JButton scan
           
(package private)  JButton update
           
(package private)  JPanel upperCenter
           
(package private)  JPanel upperLeft
           
(package private)  JPanel upperPanel
           
(package private)  JPanel upperRight
           
 
Constructor Summary
GUI()
          Public constructor.
 
Method Summary
 void actionPerformed(ActionEvent e)
          This method is responsible for determining the calling object when an action event is raised.
 void appendError(String text)
          Method to append text to the console text area, scroll down and display a error dialog box with the text
 void appendInfo(String info)
          Method to append text to the console text area
 void appendWarning(String text)
          Method to append text to the console text area, scroll down and display a warning dialog box with the text.
 void diablePropertiesInputField()
           
 void keyPressed(KeyEvent arg0)
          (non-Javadoc)
 void keyReleased(KeyEvent arg0)
          (non-Javadoc)
 void keyTyped(KeyEvent arg0)
          Inherited method from the KeyListener, to take action as a key is typed
static void main(String[] args)
           
 void run()
          Method implemented from the Runnable interface The GUI needs to run as its own thread to avoid freezing up when an operation is started.
 void windowActivated(WindowEvent arg0)
          Method implemented from the WindowListener.
 void windowClosed(WindowEvent arg0)
          Method implemented from the WindowListener.
 void windowClosing(WindowEvent arg0)
          Method implemented from the WindowListener.
 void windowDeactivated(WindowEvent arg0)
          (non-Javadoc)
 void windowDeiconified(WindowEvent arg0)
          (non-Javadoc)
 void windowIconified(WindowEvent arg0)
          (non-Javadoc)
 void windowOpened(WindowEvent arg0)
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainWindow

JFrame mainWindow

mainPanel

JPanel mainPanel

upperPanel

JPanel upperPanel

middlePanel

JPanel middlePanel

bottomPanel

JPanel bottomPanel

upperLeft

JPanel upperLeft

upperCenter

JPanel upperCenter

upperRight

JPanel upperRight

samplePath

JLabel samplePath

configLabel

JLabel configLabel

propsLabel

JLabel propsLabel

samplePathField

JTextField samplePathField

configField

JTextField configField

propsField

JTextField propsField

consoleTextArea

JTextArea consoleTextArea

scan

JButton scan

clear

JButton clear

execute

JButton execute

analyze

JButton analyze

update

JButton update

open1

JButton open1

open2

JButton open2

open3

JButton open3

clear1

JButton clear1

clear2

JButton clear2

clear3

JButton clear3

menuSystem

JMenu menuSystem

menuHelp

JMenu menuHelp

menuOutput

JMenu menuOutput

menuEdit

JMenu menuEdit

menuBar

JMenuBar menuBar

menuItemExit

JMenuItem menuItemExit

menuItemStart

JMenuItem menuItemStart

menuItemAbout

JMenuItem menuItemAbout

menuItemHelp

JMenuItem menuItemHelp

menuItemRestart

JMenuItem menuItemRestart

menuItemSave

JMenuItem menuItemSave

menuItemConfEditor

JMenuItem menuItemConfEditor

jScrollPane1

JScrollPane jScrollPane1

fc

JFileChooser fc

saveFC

JFileChooser saveFC

ps

PowerScan ps

FIELD_MALWARE

final int FIELD_MALWARE
See Also:
Constant Field Values

FIELD_CONFIG

final int FIELD_CONFIG
See Also:
Constant Field Values

FIELD_PROPS

final int FIELD_PROPS
See Also:
Constant Field Values

OPERATION_SCAN

final int OPERATION_SCAN
See Also:
Constant Field Values

OPERATION_EXECUTE

final int OPERATION_EXECUTE
See Also:
Constant Field Values

OPERATION_ANALYZE

final int OPERATION_ANALYZE
See Also:
Constant Field Values

OPERATION_INITIALIZE

final int OPERATION_INITIALIZE
See Also:
Constant Field Values

OPERATION_UPDATE

final int OPERATION_UPDATE
See Also:
Constant Field Values

operation

int operation

carretPosition

int carretPosition

prefs

Preferences prefs

REGPATH_CONFIG

final String REGPATH_CONFIG
See Also:
Constant Field Values

REGPATH_PROPS

final String REGPATH_PROPS
See Also:
Constant Field Values

REGPATH_OUTPUTSAVE

final String REGPATH_OUTPUTSAVE
See Also:
Constant Field Values

CLOSE_WARNING

final String CLOSE_WARNING
See Also:
Constant Field Values

CLOSE_CONSOLE_WARNING

final String CLOSE_CONSOLE_WARNING
See Also:
Constant Field Values

EXIT_WARNING_QUESTION

final String EXIT_WARNING_QUESTION
See Also:
Constant Field Values

EMPTY_SAMPLE_PATH_ERROR

final String EMPTY_SAMPLE_PATH_ERROR
See Also:
Constant Field Values

HELP_STRING

final String HELP_STRING
See Also:
Constant Field Values

ABOUT_STRING

final String ABOUT_STRING
See Also:
Constant Field Values

MAIN_WINDOW_TITLE

final String MAIN_WINDOW_TITLE
See Also:
Constant Field Values

LOOK_AND_FEEL_PATH

final String LOOK_AND_FEEL_PATH
See Also:
Constant Field Values
Constructor Detail

GUI

public GUI()
Public constructor. This method sets up all graphics elements, and places them on their respective panels. It also assigns action listeners and action commands to the various elements. Finally, it creates the menu line and the items associated with it.

Method Detail

diablePropertiesInputField

public void diablePropertiesInputField()

appendInfo

public void appendInfo(String info)
Method to append text to the console text area

Parameters:
info - The text to be appended to the console

appendWarning

public void appendWarning(String text)
Method to append text to the console text area, scroll down and display a warning dialog box with the text. Note: The text shown in the dialog box is not line wrapped, so the dialog box takes the size og the text horisontally

Parameters:
text - The text to be appended to the console and shown in the dialog box

appendError

public void appendError(String text)
Method to append text to the console text area, scroll down and display a error dialog box with the text

Parameters:
text -

actionPerformed

public void actionPerformed(ActionEvent e)
This method is responsible for determining the calling object when an action event is raised. This happens when buttons or menu items in the GUI are invoked

Specified by:
actionPerformed in interface ActionListener

keyTyped

public void keyTyped(KeyEvent arg0)
Inherited method from the KeyListener, to take action as a key is typed

Specified by:
keyTyped in interface KeyListener

keyPressed

public void keyPressed(KeyEvent arg0)
(non-Javadoc)

Specified by:
keyPressed in interface KeyListener
See Also:
KeyListener.keyPressed(java.awt.event.KeyEvent)

keyReleased

public void keyReleased(KeyEvent arg0)
(non-Javadoc)

Specified by:
keyReleased in interface KeyListener
See Also:
KeyListener.keyReleased(java.awt.event.KeyEvent)

main

public static void main(String[] args)

run

public void run()
Method implemented from the Runnable interface The GUI needs to run as its own thread to avoid freezing up when an operation is started. This blocks any new messages from being written to the console.

Specified by:
run in interface Runnable

windowActivated

public void windowActivated(WindowEvent arg0)
Method implemented from the WindowListener. Shows information to the user if he tries to close the main frame. This is to avoid the application from being closed as an operation is executing. This will cause unpredicatble state in the system

Specified by:
windowActivated in interface WindowListener

windowClosed

public void windowClosed(WindowEvent arg0)
Method implemented from the WindowListener. Shows information to the user if he tries to close the main frame. This is to avoid the application from being closed as an operation is executing. This will cause unpredicatble state in the system

Specified by:
windowClosed in interface WindowListener

windowClosing

public void windowClosing(WindowEvent arg0)
Method implemented from the WindowListener. Shows information to the user if he tries to close the main frame. This is to avoid the application from being closed as an operation is executing. This will cause unpredicatble state in the system

Specified by:
windowClosing in interface WindowListener

windowDeactivated

public void windowDeactivated(WindowEvent arg0)
(non-Javadoc)

Specified by:
windowDeactivated in interface WindowListener
See Also:
WindowListener.windowDeactivated(java.awt.event.WindowEvent)

windowDeiconified

public void windowDeiconified(WindowEvent arg0)
(non-Javadoc)

Specified by:
windowDeiconified in interface WindowListener
See Also:
WindowListener.windowDeiconified(java.awt.event.WindowEvent)

windowIconified

public void windowIconified(WindowEvent arg0)
(non-Javadoc)

Specified by:
windowIconified in interface WindowListener
See Also:
WindowListener.windowIconified(java.awt.event.WindowEvent)

windowOpened

public void windowOpened(WindowEvent arg0)
(non-Javadoc)

Specified by:
windowOpened in interface WindowListener
See Also:
WindowListener.windowOpened(java.awt.event.WindowEvent)