private void process(final boolean parallel) { if (sim != null) { sim.stopAndWait(); } try { sim = null; final Future<Result<T>> fenv = EnvironmentBuilder.build(new FileInputStream(xml)); final IEnvironment<T> env = fenv.get().getEnvironment(); rand = fenv.get().getRandomEngine(); sim = new Simulation<>(env, new DoubleTime(Double.POSITIVE_INFINITY), parallel); bar.setSimulation(sim); scp.setSimulation(sim); final Thread simThread = new Thread(sim); createMonitor(); simThread.start(); final TimeStepMonitor<T> tm = bar.getTimeMonitor(); sim.addOutputMonitor(tm); bar.setRandom(rand.getSeed()); bar.setFileOK(true); bar.setProcessOK(true); effectsTab.setEnabled(true); status.setOK(); status.setText(r(Res.FILE_PROCESSED) + ": " + xml.getAbsolutePath()); } catch (Exception e) { processError(e); } }
public AppBrowser(TabBrowser parent, Workspace workspace_) { super(parent, workspace_, SWT.TRANSPARENCY_ALPHA); this.workspace = workspace_; setBackgroundMode(SWT.INHERIT_DEFAULT); ApplicationFactory factory = new ApplicationFactory(this, "VietSpider", getClass().getName()); // setBackground(new Color(getDisplay(), 255, 255, 255)); GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginHeight = 5; gridLayout.horizontalSpacing = 10; gridLayout.verticalSpacing = 15; gridLayout.marginWidth = 5; setLayout(gridLayout); toolbar = new Toolbar(this, parent); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); toolbar.setLayoutData(gridData); initIcons(factory); // configLink.addHyperlinkListener(listener); StatusBar statusBar = new StatusBar(workspace, this, SWT.TRANSPARENCY_ALPHA); gridData = new GridData(GridData.FILL_HORIZONTAL); statusBar.setLayoutData(gridData); statusBar.setBackground(getBackground()); statusBar.setComponent(this); // tab.setStatusBar(statusBar); }
private void processError(final Throwable e) { SwingUtilities.invokeLater( () -> { bar.setFileOK(false); bar.setProcessOK(false); status.setText(r(Res.FILE_NOT_VALID) + " " + xml.getAbsolutePath()); status.setNo(); L.error(e); }); }
/** * Resets the player to a checkpoint with the given CheckPointInfo * * @param info */ public void resetCheckpoint(CheckPointInfo info) { state = info.getState(); velocity = Vector2.Zero; health = info.getHealth(); mana = info.getMana(); heading = info.getHeading(); stats = info.getStats(); screenPosition = info.getPosition(); collisionRect = info.getRectangle(); statusbar.setHealth(health); statusbar.setMana(mana); }
public EditorController(String divID, int width, int height) { VerticalPanel vp = new VerticalPanel(); HorizontalPanel hp = new HorizontalPanel(); SimplePanel topToolBoxWrapper = new SimplePanel(); ToggleButtonListener toggleButtonListener = new ToggleButtonListener(); topToolBox = new TopToolBox(this, toggleButtonListener); topToolBox.setStyleName("jsmoleditor-topToolBox"); topToolBoxWrapper.setWidget(topToolBox); topToolBoxWrapper.setStyleName("jsmoleditor-topTooBoxWrapper"); topToolBoxWrapper.setWidth(width + "px"); SimplePanel sideToolBoxWrapper = new SimplePanel(); elementToolBox = new ElementToolBox(this, toggleButtonListener); sideToolBoxWrapper.setWidget(elementToolBox); sideToolBoxWrapper.setStyleName("jsmoleditor-elementToolBoxWrapper"); sideToolBoxWrapper.setHeight((height - 24) + "px"); VerticalPanel vp2 = new VerticalPanel(); ExtendedCanvas canvas = new ExtendedCanvas(width - 24, height - 48); StatusBar statusBar = new StatusBar(width - 24, 24); statusBar.setHTML("Copyright chemhack.com"); renderer = new CanvasRenderer(this, canvas); vp2.add(canvas); vp2.add(statusBar); hp.add(sideToolBoxWrapper); hp.add(vp2); vp.add(topToolBoxWrapper); vp.add(hp); RootPanel rootPanel = RootPanel.get(divID); rootPanel.setPixelSize(width, height); rootPanel.add(vp); KeyboardShortCutEventPreview preview = new KeyboardShortCutEventPreview(this); // TODO deal with multiple editor instance? DOM.addEventPreview(preview); EditorMouseListener listener = new EditorMouseListener(this); canvas.addMouseListener(listener); canvas.addMouseWheelListener(listener); }
public Container CreateContentPane() { // Create the content-pane-to-be. JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setOpaque(true); // the log panel log = new JTextPane(); log.setEditable(false); log.setBackground(Color.BLACK); logPane = new JScrollPane(log); kit = new HTMLEditorKit(); doc = new HTMLDocument(); log.setEditorKit(kit); log.setDocument(doc); DefaultCaret c = (DefaultCaret) log.getCaret(); c.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); ClearLog(); // the preview panel previewPane = new DrawPanel(); previewPane.setPaperSize(paper_top, paper_bottom, paper_left, paper_right); // status bar statusBar = new StatusBar(); Font f = statusBar.getFont(); statusBar.setFont(f.deriveFont(Font.BOLD, 15)); Dimension d = statusBar.getMinimumSize(); d.setSize(d.getWidth(), d.getHeight() + 30); statusBar.setMinimumSize(d); // layout Splitter split = new Splitter(JSplitPane.VERTICAL_SPLIT); split.add(previewPane); split.add(logPane); split.setDividerSize(8); contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(split, BorderLayout.CENTER); // open the file if (recentFiles[0].length() > 0) { OpenFileOnDemand(recentFiles[0]); } // connect to the last port ListSerialPorts(); if (Arrays.asList(portsDetected).contains(recentPort)) { OpenPort(recentPort); } return contentPane; }
public WWPanel(Dimension size) { this.wwd = new WorldWindowGLCanvas(); this.wwd.setSize(size); this.wwd.setModel((Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME)); this.setLayout(new BorderLayout(5, 5)); this.add(this.wwd, BorderLayout.CENTER); StatusBar statusBar = new StatusBar(); statusBar.setEventSource(wwd); this.add(statusBar, BorderLayout.SOUTH); }
public void close() { this.visible = false; int size = barCaches.size; for (int i = 0; i < size; i++) { StatusBar bar = barCaches.get(i); if (bar != null) { bar.close(); bar = null; } } barCaches.clear(); barCaches = null; }
public void update(long elapsedTime) { if (!visible) { return; } int size = barCaches.size; if (size > 0) { synchronized (barCaches) { for (int i = 0; i < size; i++) { StatusBar bar = barCaches.get(i); if (bar != null && bar.visible) { bar.update(elapsedTime); } } } } }
/** * Removes the status bar. * * @param s the status bar * @exception NullPointerException if the java frame is null * @exception NullPointerException if the status bar is null * @exception NullPointerException if the content pane is null */ public void removeStatusBar(StatusBar s) throws NullPointerException { javax.swing.JFrame f = (javax.swing.JFrame) getJavaObject(); if (f != null) { if (s != null) { java.awt.Container cp = f.getContentPane(); if (cp != null) { cp.remove((javax.swing.JLabel) s.getJavaObject()); } else { throw new NullPointerException("Could not set status bar. The content pane is null."); } } else { throw new NullPointerException("Could not set status bar. The status bar is null."); } } else { throw new NullPointerException("Could not set status bar. The java frame is null."); } }
public static StorageListener getSL() { if (singleton == null) { StatusBar.setStatus("Using basic storage engine (no DB)"); useDumbServer(); } return (singleton); }
private void updateStatusProcessBar(JWebBrowser webBrowser) { INativeWebBrowser nativeWebBrowser = (INativeWebBrowser) webBrowser.getNativeComponent(); int loadingProgress = nativeWebBrowser.isNativePeerInitialized() ? nativeWebBrowser.getLoadingProgress() : 100; statusBar.getProgressBar().setValue(loadingProgress); statusBar.getProgressBar().setVisible(loadingProgress < 100); }
public void createUI(GLEx g) { if (!visible) { return; } int size = barCaches.size; if (size > 0) { synchronized (barCaches) { for (int i = 0; i < size; i++) { StatusBar bar = barCaches.get(i); if (bar != null && bar.visible) { bar.createUI(g); } } } } }
private void createStatusBar() { statusBar = new StatusBar(); statusBar.setText("Alerts"); Button alertsButton = new Button(); alertsButton.textProperty().bind(numberOfAlerts); alertsButton.setBackground( new Background(new BackgroundFill(Color.ORANGE, new CornerRadii(2), new Insets(4)))); alertsButton.setOnAction( event -> { isDetailNodeVisible.setValue(true); detailPane.getSelectionModel().select(0); }); statusBar.getLeftItems().add(alertsButton); statusBar.progressProperty().bind(webEngine.getLoadWorker().progressProperty()); }
public MasterDisplayPane( ImageDisplayController display, LimitAdjuster limitAdjuster, StatusBar status) { this.panel = new JPanel(); this.panel.setBackground(DisplayStatics.background); this.panel.setLayout(new MigLayout("flowy,ins 0", "[fill,grow]", "[]0[fill,grow]0[]")); this.panel.add(status.panel(), "gap 5, growx, height 15:15:15"); this.panel.add(display.panel(), "grow"); this.panel.add(limitAdjuster.panel(), "growx"); this.panel.setMinimumSize(new Dimension(50, 50)); }
/** This method initializes resultTable */ private void initTableAndStatusBar( ResultTable resultTable, CommandsMenu resultsContextMenu, StatusBar statusBar) { resultTable.setLayoutData( LayoutHelper.formData( new FormAttachment(0), new FormAttachment(100), new FormAttachment(feederArea, 1), new FormAttachment(statusBar.getComposite(), -2))); resultTable.setMenu(resultsContextMenu); }
// User has asked that a file be opened. public void OpenFileOnDemand(String filename) { Log("<font color='green'>Opening file " + recentFiles[0] + "...</font>\n"); String ext = filename.substring(filename.lastIndexOf('.')); if (!ext.equalsIgnoreCase(".ngc")) { LoadImage(filename); } else { LoadGCode(filename); } statusBar.Clear(); }
void setCurrentFile(final File file) { currentFile = file; final String text; if (isCurrentFileValid()) { text = currentFile.getName(); } else { text = ""; } statusBar.setMessage("Current file: " + text); actions.get(ActionMap.SAVE_RFO_ACTION).setEnabled(isCurrentFileValid()); actions.get(ActionMap.SLICE_ACTION).setEnabled(isCurrentFileValid()); }
// TODO Add a sort here to restore the sort after a filter public void refreshTable() { // First: Remember currently selected waypoint String wayPoint; Vector oldVisibleCaches = null; int sel = getSelectedCache(); if ((sel >= 0) && (sel < cacheDB .size())) // sel > cacheDB.size() can happen if you load a new profile, which is // smaller than the old profile and you selected one cache that exceeds // the number of caches in the new profile wayPoint = cacheDB.get(sel).getWayPoint(); else wayPoint = null; // Then: remember all caches that are visible before the refresh if (wayPoint != null) { oldVisibleCaches = new Vector(sel); for (int i = 0; i < sel; i++) { oldVisibleCaches.add(cacheDB.get(i)); } } myMod.updateRows(); // Check whether the currently selected cache is still visible int rownum = 0; if (wayPoint != null) { rownum = profile.cacheDB.getIndex(wayPoint); // Global.getProfile().cacheDB.getIndex(wayPoint); // If it is not visible: Go backward in the list of the // previously visible caches and look if you find // any cache that is now still visible. if ((rownum < 0) || (rownum >= myMod.numRows)) { if (oldVisibleCaches != null) { int i; for (i = sel - 1; i >= 0; i--) { CacheHolder checkCache = (CacheHolder) oldVisibleCaches.get(i); rownum = profile.cacheDB.getIndex( checkCache .getWayPoint()); // Global.getProfile().cacheDB.getIndex(checkCache.getWayPoint()); if ((rownum >= 0) && (rownum < myMod.numRows)) break; rownum = 0; } } } } selectRow(rownum); tc.update(true); // Update and repaint if (statBar != null) statBar.updateDisplay(""); }
public static Container getApplicationContentPane() { JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setOpaque(true); contentPane.add(createSplitPane()); m_statusBar = StatusBar.getInstance(); contentPane.add(m_statusBar, BorderLayout.SOUTH); m_toolBar = ToolBar.getInstance(); contentPane.add(m_toolBar, BorderLayout.NORTH); return contentPane; }
public TablePanel(Preferences p, Profile prof, StatusBar statBar) { pref = p; // Global.getPref(); profile = prof; // Global.getProfile(); this.statBar = statBar; cacheDB = profile.cacheDB; addLast(new MyScrollBarPanel(tc = new myTableControl(this))); if (statBar != null) addLast(statBar, CellConstants.DONTSTRETCH, CellConstants.FILL); myMod = new myTableModel(tc, getFontMetrics()); myMod.hasRowHeaders = false; myMod.hasColumnHeaders = true; tc.setTableModel(myMod); if (statBar != null) statBar.setMyTableModel(myMod); pref.setMyTableModel(myMod); }
private void openXML() { final JFileChooser fc = new JFileChooser(); fc.setMultiSelectionEnabled(false); fc.setFileFilter(XML_FILTER); fc.setCurrentDirectory(currentDirectory); final int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { xml = fc.getSelectedFile(); currentDirectory = fc.getSelectedFile().getParentFile(); if (xml.exists() && xml.getName().endsWith("xml")) { status.setText(r(Res.READY_TO_PROCESS) + " " + xml.getAbsolutePath()); status.setOK(); if (sim != null) { sim.stop(); } bar.setFileOK(true); } else { status.setText(r(Res.FILE_NOT_VALID) + " " + xml.getAbsolutePath()); status.setNo(); bar.setFileOK(false); } } }
@SuppressWarnings("incomplete-switch") @Override public void draw(Graphics2D graphics) { ElementalShield cs = spellManager.getCurrentShield(); if (cs != null) { Color[] c = new Color[3]; c[0] = new Color(0, 0, 0, 0); c[1] = new Color(0, 0, 0, 0); ElementType type = cs.getElementType(); switch (type) { case Earth: c[2] = new Color(0.45f, 0.4f, 0.15f, 0.85f); break; case Fire: c[2] = new Color(1.0f, 0.0f, 0.0f, 0.7f); break; case Water: c[2] = new Color(0.3f, 0.3f, 0.8f, 0.7f); break; } float[] dist = {0.0f, 0.25f, 1f}; RadialGradientPaint rgp = new RadialGradientPaint( new Point2D.Float((int) screenPosition.x + 16, (int) screenPosition.y + 16), 20, dist, c); graphics.setPaint(rgp); graphics.fillOval((int) screenPosition.x - 4, (int) screenPosition.y - 4, 40, 40); } graphics.drawImage(getTexture(), (int) screenPosition.x, (int) screenPosition.y, null); if (controlled) { spellManager.draw(graphics); statusbar.draw(graphics); } if (isInNetwork && controllerActive) { if (controller.isPressed(KeyEvent.VK_T)) DeathMatchStatistics.getInstance().draw(graphics); } }
private void setRandom() { if (rand != null) { try { rand.setSeed(bar.getRandomText()); status.setOK(); status.setText(r(Res.RANDOM_REINIT_SUCCESS) + ": " + rand.getSeed()); } catch (final NumberFormatException e) { status.setNo(); status.setText(r(Res.RANDOM_REINIT_FAIL) + ": " + r(Res.IS_NOT_AN_INTEGER)); } } else { status.setNo(); status.setText(r(Res.RANDOM_REINIT_FAIL) + ": RandomEngine " + r(Res.IS_NOT_INITIALIZED_YET)); } }
/** Builds a new SAPERE perspective. */ public Perspective() { super(); setLayout(new BorderLayout()); bar = new UpperBar(scp); add(bar, BorderLayout.NORTH); bar.addActionListener(this); bar.addChangeListener(this); status = new StatusBar(); status.setText(r(Res.SAPERE_PERSPECTIVE)); add(status, BorderLayout.SOUTH); effectsTab = new JEffectsTab<>(); effectsTab.addLinksToggleActionListener(this); effectsTab.setEnabled(false); bar.registerTab(effectsTab); setMainDisplay(new Generic2DDisplay<T>()); }
// Take the next line from the file and send it to the robot, if permitted. public void SendFileCommand() { if (running == false || paused == true || fileOpened == false || portConfirmed == false || linesProcessed >= linesTotal) return; String line; do { // are there any more commands? line = gcode.get((int) linesProcessed++).trim(); previewPane.setLinesProcessed(linesProcessed); statusBar.SetProgress(linesProcessed, linesTotal); // loop until we find a line that gets sent to the robot, at which point we'll // pause for the robot to respond. Also stop at end of file. } while (ProcessLine(line) && linesProcessed < linesTotal); if (linesProcessed == linesTotal) { // end of file Halt(); } }
public static Color getColor(String name, Color def) { if (name == null) { // System.out.println("illegal color: " + name); // Thread.dumpStack(); return (def); } name = name.toLowerCase(); Color nc = (Color) colors.get(name); if (nc == null) { StringTokenizer st = new StringTokenizer(name, ", "); // System.out.println(st.countTokens(); if ((st.countTokens() < 3) || (st.countTokens() > 4)) { // System.out.println("illegal color"); nc = def; } else { try { int r = Integer.parseInt(st.nextToken()); int g = Integer.parseInt(st.nextToken()); int b = Integer.parseInt(st.nextToken()); if (st.countTokens() == 0) { nc = new GuessColor(r, g, b); } else { int a = Integer.parseInt(st.nextToken()); nc = new GuessColor(r, g, b, a); } colors.put(name, nc); } catch (Exception e) { ExceptionWindow.getExceptionWindow(e); StatusBar.setErrorStatus("Invalid color, using default"); nc = def; } } } return (nc); }
public void setStatus(String s) { StatusBar sb = getStatusBar(); sb.set(s); }
public static void startApplication() { // Initilize the status bar m_statusBar.setCoordLabelText(" Coordinates "); }
/** * Similar to refreshTable but not so "heavy". Is used when user changes settings in preferences. */ public void refreshControl() { tc.update(true); if (statBar != null) statBar.updateDisplay(""); }