List of usage examples for java.awt EventQueue invokeLater
public static void invokeLater(Runnable runnable)
From source file:support.TradingVolumeGui.java
public TradingVolumeGui(IMap<String, Long> hzMap) { this.hzMap = hzMap; EventQueue.invokeLater(this::startGui); }
From source file:Chart.java
public void init() { EventQueue.invokeLater(new Runnable() {/*from w w w. j a va 2 s . c o m*/ public void run() { String v = getParameter("values"); if (v == null) return; int n = Integer.parseInt(v); double[] values = new double[n]; String[] names = new String[n]; for (int i = 0; i < n; i++) { values[i] = Double.parseDouble(getParameter("value." + (i + 1))); names[i] = getParameter("name." + (i + 1)); } add(new ChartComponent(values, names, getParameter("title"))); } }); }
From source file:support.SystemMonitorGui.java
public SystemMonitorGui(IMap<Long, Double> hzMap) { this.hzMap = hzMap; EventQueue.invokeLater(this::startGui); }
From source file:org.eclipse.om2m.ipe.sample.gui.GUI.java
/** * Initiate The GUI./*from w w w .j a v a 2 s . c om*/ */ public static void init() { EventQueue.invokeLater(new Runnable() { public void run() { try { frame = new GUI(); frame.setVisible(true); } catch (Exception e) { LOGGER.error("GUI init Error", e); } } }); }
From source file:org.apache.log4j.chainsaw.LogUI.java
/** * Starts Chainsaw by attaching a new instance to the Log4J main root Logger * via a ChainsawAppender, and activates itself * * @param args/*ww w.ja va2 s .c o m*/ */ public static void main(String[] args) { if (args.length > 0) { configurationURLAppArg = args[0]; } if (OSXIntegration.IS_OSX) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } LogManager.setRepositorySelector(new RepositorySelector() { public LoggerRepository getLoggerRepository() { return repositoryExImpl; } }, repositorySelectorGuard); final ApplicationPreferenceModel model = new ApplicationPreferenceModel(); SettingsManager.getInstance().configure(new ApplicationPreferenceModelSaver(model)); //if a configuration URL param was provided, set the configuration URL field to null if (configurationURLAppArg != null) { model.setBypassConfigurationURL(configurationURLAppArg); } EventQueue.invokeLater(new Runnable() { public void run() { String lookAndFeelClassName = model.getLookAndFeelClassName(); if (lookAndFeelClassName == null || lookAndFeelClassName.trim().equals("")) { String osName = System.getProperty("os.name"); if (osName.toLowerCase(Locale.ENGLISH).startsWith("mac")) { //no need to assign look and feel } else if (osName.toLowerCase(Locale.ENGLISH).startsWith("windows")) { lookAndFeelClassName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; model.setLookAndFeelClassName(lookAndFeelClassName); } else if (osName.toLowerCase(Locale.ENGLISH).startsWith("linux")) { lookAndFeelClassName = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; model.setLookAndFeelClassName(lookAndFeelClassName); } } if (lookAndFeelClassName != null && !(lookAndFeelClassName.trim().equals(""))) { loadLookAndFeelUsingPluginClassLoader(lookAndFeelClassName); } createChainsawGUI(model, null); } }); }
From source file:TradeMonitorGui.java
public TradeMonitorGui(IMap<String, KeyedWindowResult<String, Double>> avgPrices) { this.avgPrices = avgPrices; EventQueue.invokeLater(this::startGui); }
From source file:jgnash.ui.report.compiled.RunningAccountBalanceChart.java
public static void show() { EventQueue.invokeLater(() -> { RunningAccountBalanceChart chart = new RunningAccountBalanceChart(); JPanel p = chart.createPanel(); GenericCloseDialog d = new GenericCloseDialog(p, ResourceUtils.getString("Title.EndMonthBalance")); d.pack();// www . j a va2s .c om d.setModal(false); d.setVisible(true); }); }
From source file:com.github.hsmrs_gui.project.GuiNode.java
@Override public void onStart(final ConnectedNode connectedNode) { log = connectedNode.getLog();/*from ww w.j a va 2s .c om*/ EventQueue.invokeLater(new Runnable() { @Override public void run() { RobotListModel rlm = RobotListModel.getRobotListModel(); List<Robot> sampleRobots = new ArrayList<Robot>(); sampleRobots.add(new Robot("Hermes", new Task())); sampleRobots.add(new Robot("Oryx", new Task())); sampleRobots.add(new Robot("Husky", new Task())); sampleRobots.add(new Robot("Aero", new Task())); rlm.addRobot(sampleRobots.get(0)); rlm.addRobot(sampleRobots.get(1)); rlm.addRobot(sampleRobots.get(2)); rlm.addRobot(sampleRobots.get(3)); TaskListModel tlm = TaskListModel.getTaskListModel(); tlm.addTask(new Task()); tlm.addTask(new Task("Go to (x, y)")); tlm.addTask(new Task("Search for sample", sampleRobots, "In progress")); ConsoleController.getInstance().createConsole(rlm.getRobotNames()); robotRegistrationListener = new RobotRegistrationListener(connectedNode); systemLogListener = new SystemLogListener(connectedNode); imageListener = new ImageListener(connectedNode); MainFrame gui = new MainFrame(rlm, tlm); gui.setVisible(true); } }); Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("display", std_msgs.String._TYPE); subscriber.addMessageListener(new MessageListener<std_msgs.String>() { @Override public void onNewMessage(std_msgs.String message) { log.info("I heard: \"" + message.getData() + "\""); } }); }
From source file:support.TradingVolumeGui.java
private void startGui() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); CategoryPlot chartFrame = createChartFrame(dataset); ValueAxis yAxis = chartFrame.getRangeAxis(); long[] topY = { INITIAL_TOP_Y }; EntryUpdatedListener<String, Long> entryUpdatedListener = event -> { EventQueue.invokeLater(() -> { dataset.addValue(event.getValue(), event.getKey(), ""); topY[0] = max(topY[0], INITIAL_TOP_Y * (1 + event.getValue() / INITIAL_TOP_Y)); yAxis.setRange(0, topY[0]);// w w w .j a va 2 s. co m }); }; entryListenerId = hzMap.addEntryListener(entryUpdatedListener, true); }
From source file:jgnash.ui.report.compiled.MonthlyAccountBalanceChart.java
public static void show() { EventQueue.invokeLater(() -> { MonthlyAccountBalanceChart chart = new MonthlyAccountBalanceChart(); JPanel p = chart.createPanel(); GenericCloseDialog d = new GenericCloseDialog(p, ResourceUtils.getString("Title.AccountBalance")); d.pack();// ww w .j a v a 2 s. c o m d.setModal(false); d.setVisible(true); }); }