package scriptbuilder.gui.panels; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.FlowLayout; import java.awt.GridLayout; import java.io.File; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JPanel; import scriptbuilder.gui.drawers.RangeSlider; import scriptbuilder.structures.ScriptIncident; import scriptbuilder.structures.SimulationScript; /** * Exploration (spike) for Overview Window. * The background is a TimelineTickPanel. * IncidentTimelinePanel objects sit over it. * @author jdalbey */ public class OverviewWinSpike { /** * Local main for viewing this panel only. * * @author jdalbey * @param args not used */ public static void main(String[] args) { JFrame frame = new JFrame("Overview Window Spike"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TimelineTickPanel pnl = new TimelineTickPanel(); //pnl.setLayout(new BoxLayout(pnl, BoxLayout.PAGE_AXIS)); //pnl.setLayout(new FlowLayout()); pnl.setLayout(new BorderLayout()); // Create a script File inFile = new File("test/scriptbuilder/structures/test_input_file.xml"); SimulationScript script = new SimulationScript(); script.loadScriptFromFile(inFile); ScriptIncident incident = script.incidents.get(2); IncidentNumberPanel inciNum = new IncidentNumberPanel(); inciNum.update(incident); // Create yellow border during development for easy visualization inciNum.setBorder(BorderFactory.createLineBorder(Color.yellow)); IncidentNumberPanel inciNum2 = new IncidentNumberPanel(); inciNum2.update(script.incidents.get(3)); //inciNum2.setSize(100,200); //Box col1 = new Box(BoxLayout.PAGE_AXIS); JPanel col1 = new JPanel(new GridLayout(9,1)); col1.setOpaque(false); // so tick lines will show throughut col1.setAlignmentX(Component.LEFT_ALIGNMENT); //row1.setSize(200, 500); col1.add(inciNum); col1.add(inciNum2); col1.add(Box.createVerticalGlue()); Box col2 = new Box(BoxLayout.PAGE_AXIS); col2.setOpaque(false); // so tick lines will show throughut col2.setAlignmentX(Component.LEFT_ALIGNMENT); RangeSlider slider = new RangeSlider(0,25); slider.setValue(5); slider.setUpperValue(10); slider.setAlignmentX(Component.LEFT_ALIGNMENT); RangeSlider slider2 = new RangeSlider(0,25); slider2.setValue(5); slider2.setUpperValue(10); slider2.setAlignmentX(Component.LEFT_ALIGNMENT); col2.add(Box.createVerticalStrut(50)); col2.add(slider); col2.add(Box.createVerticalStrut(50)); col2.add(slider2); pnl.add(col1, BorderLayout.LINE_START); pnl.add(col2, BorderLayout.CENTER); // update this panel with the script pnl.update(script); frame.getContentPane().add(pnl, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } }