ChartGenerator createNewChart(final GUIState simulation) { generator = createNewGenerator(); globalAttributes = new GlobalAttributes(); generator.addGlobalAttribute(globalAttributes); // it'll be added last // set up the simulation -- need a new name other than guiObjects: and it should be // a HashMap rather than a Bag. if (simulation.guiObjects == null) simulation.guiObjects = new Bag(); simulation.guiObjects.add(generator); final JFrame f = generator.createFrame(simulation); WindowListener wl = new WindowListener() { public void windowActivated(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e) { generator.quit(); } public void windowDeactivated(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowOpened(WindowEvent e) {} }; f.addWindowListener(wl); f.setVisible(true); return generator; }
/** Builds a BarChartGenerator and attaches it as a display in a MASON simulation. */ public static BarChartGenerator buildBarChartGenerator(GUIState state, String title) { BarChartGenerator chart = buildBarChartGenerator(title); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }
/** Builds a TimeSeriesChartGenerator and attaches it as a display in a MASON simulation. */ public static TimeSeriesChartGenerator buildTimeSeriesChartGenerator( GUIState state, String title, String domainAxisLabel) { TimeSeriesChartGenerator chart = buildTimeSeriesChartGenerator(title, domainAxisLabel); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }
/** Builds a ScatterPlotGenerator and attaches it as a display in a MASON simulation. */ public static ScatterPlotGenerator buildScatterPlotGenerator( GUIState state, String title, String rangeAxisLabel, String domainAxisLabel) { ScatterPlotGenerator chart = buildScatterPlotGenerator(title, rangeAxisLabel, domainAxisLabel); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }