Changeset 75 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui


Ignore:
Timestamp:
08/25/2017 08:10:16 AM (9 years ago)
Author:
jdalbey
Message:

ScriptBuilderTimelinePanel?.java: Add local main to display this panel only.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/panels/ScriptBuilderTimelinePanel.java

    r71 r75  
    33import event.editor.Editor; 
    44import event.editor.Properties; 
     5import java.awt.BorderLayout; 
    56import java.awt.Dimension; 
    67import java.awt.Graphics; 
    78import java.awt.Graphics2D; 
    89import java.awt.event.MouseEvent; 
     10import java.io.File; 
    911import java.util.HashMap; 
    1012import java.util.Map; 
     13import javax.swing.JFrame; 
    1114import javax.swing.JPanel; 
    1215import javax.swing.event.MouseInputAdapter; 
     
    2023import scriptbuilder.structures.ScriptEvent.ScriptEventType; 
    2124import scriptbuilder.structures.ScriptIncident; 
     25import scriptbuilder.structures.SimulationScript; 
    2226import scriptbuilder.structures.TimeSlice; 
    2327import scriptbuilder.structures.events.I_ScriptEvent; 
     
    357361        } 
    358362    } 
     363 
     364    /** 
     365     * Local main for viewing this panel only. 
     366     * 
     367     * @author jdalbey 
     368     * @param args not used 
     369     */ 
     370    public static void main(String[] args) 
     371    { 
     372        JFrame frame = new JFrame("FrameDemo"); 
     373        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
     374 
     375        ScriptBuilderTimelinePanel pnl = new ScriptBuilderTimelinePanel(); 
     376 
     377        // Create a script 
     378        File inFile = new File("test/scriptbuilder/structures/test_input_file.xml"); 
     379        SimulationScript script = new SimulationScript(); 
     380        script.loadScriptFromFile(inFile); 
     381        // retrieve a single incident from the script 
     382        ScriptIncident inci = script.incidents.get(1); 
     383        // update this panel with an incident 
     384        pnl.timelinePanelUpdate(inci); 
     385 
     386        frame.getContentPane().add(pnl, BorderLayout.CENTER); 
     387        frame.pack(); 
     388 
     389        frame.setVisible(true); 
     390 
     391    } 
    359392} 
Note: See TracChangeset for help on using the changeset viewer.