Changeset 47 in tmcsimulator for trunk/src/tmcsim/paramicslog/gui


Ignore:
Timestamp:
06/28/2016 02:25:42 PM (10 years ago)
Author:
jdalbey
Message:

Merge 305 modifications into trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/paramicslog/gui/ParamicsLogGUI.java

    r2 r47  
    11package tmcsim.paramicslog.gui; 
    22 
    3 import javax.swing.*; 
    43import java.awt.event.WindowEvent; 
    54import java.util.*; 
     5import javax.swing.*; 
    66 
    77/** 
    8  * The UI for ParamicsLog.  
     8 * The UI for ParamicsLog. 
     9 * 
    910 * @author Nathaniel Lehrer 
    1011 * @version 
    1112 */ 
    12 public class ParamicsLogGUI extends JFrame implements Observer { 
     13public class ParamicsLogGUI extends JFrame implements Observer 
     14{ 
    1315 
    14     /** The static instance */ 
     16    /** 
     17     * The static instance 
     18     */ 
    1519    private static ParamicsLogGUI instance = new ParamicsLogGUI(); 
     20    /** 
     21     * The text area to display the log in 
     22     */ 
     23    private JTextArea textArea; 
    1624 
    17     /** The text area to display the log in */ 
    18     private JTextArea textArea; 
    19      
    20     /** Creates an instance of this class */ 
    21     public ParamicsLogGUI() { 
    22          
     25    /** 
     26     * Creates an instance of this class 
     27     */ 
     28    public ParamicsLogGUI() 
     29    { 
     30 
    2331        setupGUI(); 
    2432    } 
    25      
    26     /** Creates the UI */ 
     33 
     34    /** 
     35     * Creates the UI 
     36     */ 
    2737    private void setupGUI() 
    2838    { 
    29         try { 
     39        try 
     40        { 
    3041            UIManager.setLookAndFeel( 
    31                 UIManager.getSystemLookAndFeelClassName()); 
    32         } catch (Exception e) { 
     42                    UIManager.getSystemLookAndFeelClassName()); 
     43        } catch (Exception ex) 
     44        { 
     45            System.out.println(ex.getMessage()); 
    3346            System.err.println("Couldn't use system look and feel."); 
    3447        } 
    35          
    36         this.addWindowListener(new java.awt.event.WindowAdapter() { 
    37              
     48 
     49        this.addWindowListener(new java.awt.event.WindowAdapter() 
     50        { 
    3851            public void windowClosing(WindowEvent e) 
    3952            { 
     
    4154            } 
    4255        }); 
    43          
    44          
     56 
     57 
    4558        setTitle("Paramics Log"); 
    46          
     59 
    4760        textArea = new JTextArea(); 
    4861        textArea.setColumns(60); 
    4962        textArea.setRows(30); 
    5063        JScrollPane scrollPane = new JScrollPane(textArea); 
    51          
     64 
    5265        getContentPane().add(scrollPane); 
    53          
     66 
    5467    } 
    55      
    56     /** Shows the UI window */ 
     68 
     69    /** 
     70     * Shows the UI window 
     71     */ 
    5772    public void display() 
    5873    { 
     
    6277 
    6378    /** 
    64      * Updates the text area. If the observable class given is of type ParamicsLog then 
    65      * the log entries are displayed. 
     79     * Updates the text area. If the observable class given is of type 
     80     * ParamicsLog then the log entries are displayed. 
     81     * 
    6682     * @param o The model for this viewer. 
    6783     * @param arg An argument that is not used. 
     
    7288        { 
    7389            textArea.setText(((tmcsim.paramicslog.ParamicsLog) o).getLog()); 
    74         }  
     90        } 
    7591 
    7692        repaint(); 
    7793    } 
    78      
     94 
    7995    /** 
    8096     * Accessor for the instance of ParamicsLogGUI. 
     97     * 
    8198     * @return The instance of ParamicsLogGUI. 
    8299     */ 
    83     public static ParamicsLogGUI getInstance() { 
     100    public static ParamicsLogGUI getInstance() 
     101    { 
    84102        return instance; 
    85103    } 
    86      
    87104} 
Note: See TracChangeset for help on using the changeset viewer.