source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/gui/panels/OverviewWinSpike.java @ 86

Revision 86, 1.8 KB checked in by jdalbey, 9 years ago (diff)

Add new file OverviewWinSpike?.java to experiment with Overview Window layout.

Line 
1package scriptbuilder.gui.panels;
2
3import java.awt.BorderLayout;
4import java.io.File;
5import javax.swing.BoxLayout;
6import javax.swing.JFrame;
7import javax.swing.JPanel;
8import scriptbuilder.gui.drawers.RangeSlider;
9import scriptbuilder.structures.ScriptIncident;
10import scriptbuilder.structures.SimulationScript;
11
12/**
13 * Exploration (spike) for Overview Window.
14 * The background is a TimelineTickPanel.
15 * IncidentTimelinePanel objects sit over it.
16 * @author jdalbey
17 */
18public class OverviewWinSpike 
19{
20    /**
21     * Local main for viewing this panel only.
22     *
23     * @author jdalbey
24     * @param args not used
25     */
26    public static void main(String[] args)
27    {
28        JFrame frame = new JFrame("Overview Window Spike");
29
30        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
31
32        TimelineTickPanel pnl = new TimelineTickPanel();
33        pnl.setLayout(new BoxLayout(pnl, BoxLayout.PAGE_AXIS));
34        // Create a script
35        File inFile = new File("test/scriptbuilder/structures/test_input_file.xml");
36        SimulationScript script = new SimulationScript();
37        script.loadScriptFromFile(inFile);
38        ScriptIncident incident = script.incidents.get(2);
39        IncidentNumberPanel inciNum = new IncidentNumberPanel();
40        inciNum.update(incident);
41        JPanel row1 = new JPanel();
42        row1.setOpaque(false);  // so tick lines will show through
43        //row1.setSize(200, 500);
44        row1.add(inciNum);
45        RangeSlider slider = new RangeSlider(0,25);
46        slider.setValue(5);
47        slider.setUpperValue(10);
48        row1.add(slider);
49        pnl.add(row1);
50        // update this panel with the script
51        pnl.update(script);
52        frame.getContentPane().add(pnl, BorderLayout.CENTER);
53        frame.pack();
54
55        frame.setVisible(true);
56
57    }
58}
Note: See TracBrowser for help on using the repository browser.