public MainWindow() { mainFrame = new JFrame("RipMe v" + UpdateUtils.getThisJarVersion()); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setLayout(new GridBagLayout()); createUI(mainFrame.getContentPane()); pack(); loadHistory(); setupHandlers(); Thread shutdownThread = new Thread(this::shutdownCleanup); Runtime.getRuntime().addShutdownHook(shutdownThread); if (Utils.getConfigBoolean("auto.update", true)) { upgradeProgram(); } boolean autoripEnabled = Utils.getConfigBoolean("clipboard.autorip", false); ClipboardUtils.setClipboardAutoRip(autoripEnabled); trayMenuAutorip.setState(autoripEnabled); }
Utils.setConfigBoolean("clipboard.autorip", configClipboardAutorip.isSelected()); ClipboardUtils.setClipboardAutoRip(configClipboardAutorip.isSelected()); trayMenuAutorip.setState(configClipboardAutorip.isSelected()); Utils.configureLogger(); });
@Override public void run() { _native.setState(isChecked); } });
public void updateShowConsole (boolean b) { showConsole.setState(b); } }
public void processMouseEvent(MouseEvent e) { if (e.getID() == MouseEvent.MOUSE_RELEASED) { selectedIndex = e.getY() / lineHeight; repaint(); } if (e.isPopupTrigger()) { int index = e.getY() / lineHeight; if (index < getItemCount()) { selectedIndex = index; repaint(); lock.setState(locked[index]); popup.show(this, e.getX(), e.getY()); } } }
CheckboxMenuItem addCheckboxItem(Menu menu, String label, String className) { pluginsTable.put(label, className); nPlugins++; CheckboxMenuItem item = new CheckboxMenuItem(label); menu.add(item); item.addItemListener(ij); item.setState(false); return item; }
CheckboxMenuItem addCheckboxItem(Menu menu, String label, String className) { pluginsTable.put(label, className); nPlugins++; CheckboxMenuItem item = new CheckboxMenuItem(label); menu.add(item); item.addItemListener(ij); item.setState(false); return item; }
cbmi.setState(false); items.add(cbmi);
public void itemStateChanged(ItemEvent e) { // Update the state of the AWT menu item. ((CheckboxMenuItem) getAWTMenu()) .setState(e.getStateChange() == ItemEvent.SELECTED); // Notify all the AWT listeners. CheckboxMenuItem i = ((CheckboxMenuItem) getAWTMenu()); ItemListener[] l = i.getItemListeners(); if (l != null && l.length > 0) { for (int idx = 0; idx < l.length; idx++) { ItemEvent ev = new ItemEvent(i, e.getID(), i, e.getStateChange()); l[idx].itemStateChanged(ev); } } }
if (insertSpaces!=insertSpaces2) { Prefs.set(INSERT_SPACES, insertSpaces); insertSpacesItem.setState(insertSpaces);
if (insertSpaces!=insertSpaces2) { Prefs.set(INSERT_SPACES, insertSpaces); insertSpacesItem.setState(insertSpaces);
private void enableDisableMenuItems() { boolean frozen = plot.isFrozen(); //prepare menu according to 'frozen' state of plot ((CheckboxMenuItem)menuItems[FREEZE]).setState(frozen); for (int i : DISABLED_WHEN_FROZEN) menuItems[i].setEnabled(!frozen); if (!PlotContentsDialog.tableWindowExists()) menuItems[ADD_FROM_TABLE].setEnabled(false); if (plot.getDataObjectDesignations().length == 0) menuItems[ADD_FIT].setEnabled(false); }
private void enableDisableMenuItems() { boolean frozen = plot.isFrozen(); //prepare menu according to 'frozen' state of plot ((CheckboxMenuItem)menuItems[FREEZE]).setState(frozen); for (int i : DISABLED_WHEN_FROZEN) menuItems[i].setEnabled(!frozen); if (!PlotContentsDialog.tableWindowExists()) menuItems[ADD_FROM_TABLE].setEnabled(false); if (plot.getDataObjectDesignations().length == 0) menuItems[ADD_FIT].setEnabled(false); }
public boolean keyDown(Event e, int key) { if(e.id == Event.KEY_PRESS) { if(key == 's') showControls_.setState(!showControls_.getState()); else graphCanvas_.keyDown(e, key); if(showControls_.getState()) controls_.show(); else controls_.hide(); validate(); } return false; }
public PlayerTrayIcon(boolean windowVisible) { icon = new TrayIcon(NORMAL_ICON, "Radioblock"); startItem = new MenuItem("Start"); startItem.setActionCommand("start"); startItem.setEnabled(true); startItem.addActionListener(e -> listener.startPlayer()); stopItem = new MenuItem("Stop"); stopItem.setActionCommand("stop"); stopItem.setEnabled(false); stopItem.addActionListener(e -> listener.stopPlayer()); showWindowItem = new CheckboxMenuItem("Show window"); showWindowItem.setState(windowVisible); showWindowItem.addItemListener(e -> listener.setWindowVisibility(showWindowItem.getState())); MenuItem quitItem = new MenuItem("Quit"); quitItem.setActionCommand("quit"); quitItem.addActionListener(e -> System.exit(0)); final PopupMenu popup = new PopupMenu(); popup.add(startItem); popup.add(stopItem); popup.add(showWindowItem); popup.add(quitItem); icon.setPopupMenu(popup); try { SystemTray.getSystemTray().add(icon); } catch (AWTException e) { throw new RuntimeException(e); } }
cb.setState(true); cb.addItemListener(this); om.add(cb);