List of usage examples for javax.swing JSeparator JSeparator
public JSeparator()
From source file:com.isencia.passerelle.hmi.HMIBase.java
/** * Constructs a default menu.//from w w w.ja v a 2s .c o m * <ul> * <li>If the menuItems set is null, all default items are created. * <li>If the set is not null, only the menu items whose names are in there * are shown * </ul> * For an overview of the names, check HMIMessages.MENU_... * * @param menuItemsToShow * @param menuItemsToHide * @return */ public JMenuBar createDefaultMenu(final Set<String> menuItemsToShow, final Set<String> menuItemsToHide) { final JMenuBar menuBar = new JMenuBar(); final JMenu fileMenu = new JMenu(HMIMessages.getString(HMIMessages.MENU_FILE)); fileMenu.setMnemonic(HMIMessages.getString(HMIMessages.MENU_FILE + HMIMessages.KEY).charAt(0)); if (showThing(HMIMessages.MENU_TEMPLATES, menuItemsToShow, menuItemsToHide)) { final JMenu templatesSubMenu = new JMenu(HMIMessages.getString(HMIMessages.MENU_TEMPLATES)); final Iterator itr = hmiModelsDef.getModels().keySet().iterator(); final List<String> orderedList = new ArrayList<String>(); while (itr.hasNext()) { final String modelKey = (String) itr.next(); final String labelKey = modelKey; // HMIMessages.getString(modelKey); orderedList.add(labelKey); } Collections.sort(orderedList); for (int i = 0; i < orderedList.size(); i++) { try { // JMenuItem templateMenuItem = new // JMenuItem(HMIMessages.getString(HMIMessages.MENU_TEMPLATES) // + " " + HMIMessages.getString(modelKey)); final JMenuItem templateMenuItem = new JMenuItem(HMIMessages.getString(orderedList.get(i))); templateMenuItem.addActionListener(new TemplateModelOpener(orderedList.get(i))); templatesSubMenu.add(templateMenuItem); } catch (final Exception e1) { e1.printStackTrace(); logger.error("", e1); } } fileMenu.add(templatesSubMenu); StateMachine.getInstance().registerActionForState(StateMachine.READY, HMIMessages.MENU_TEMPLATES, templatesSubMenu); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_TEMPLATES, templatesSubMenu); } if (showModelGraph) { if (showThing(HMIMessages.MENU_NEW, menuItemsToShow, menuItemsToHide)) { if (modelCreatorAction == null) { modelCreatorAction = new ModelCreator(this); } fileMenu.add(modelCreatorAction); // final JMenuItem fileNewMenuItem = new JMenuItem(HMIMessages // .getString(HMIMessages.MENU_NEW), HMIMessages.getString( // HMIMessages.MENU_NEW + HMIMessages.KEY).charAt(0)); // fileNewMenuItem.setAccelerator(KeyStroke.getKeyStroke( // KeyEvent.VK_N, InputEvent.CTRL_MASK)); // fileNewMenuItem.addActionListener(new ModelCreator()); // fileMenu.add(fileNewMenuItem); // StateMachine.getInstance().registerActionForState( // StateMachine.READY, HMIMessages.MENU_NEW, fileNewMenuItem); // StateMachine.getInstance().registerActionForState( // StateMachine.MODEL_OPEN, HMIMessages.MENU_NEW, // fileNewMenuItem); } } if (showThing(HMIMessages.MENU_OPEN, menuItemsToShow, menuItemsToHide)) { final JMenuItem fileOpenMenuItem = new JMenuItem(HMIMessages.getString(HMIMessages.MENU_OPEN), HMIMessages.getString(HMIMessages.MENU_OPEN + HMIMessages.KEY).charAt(0)); fileOpenMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); fileOpenMenuItem.addActionListener(new ModelOpener()); fileMenu.add(fileOpenMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.READY, HMIMessages.MENU_OPEN, fileOpenMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_OPEN, fileOpenMenuItem); } if (showThing(HMIMessages.MENU_CLOSE, menuItemsToShow, menuItemsToHide)) { final JMenuItem fileCloseMenuItem = new JMenuItem(HMIMessages.getString(HMIMessages.MENU_CLOSE), HMIMessages.getString(HMIMessages.MENU_CLOSE + HMIMessages.KEY).charAt(0)); fileCloseMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); fileCloseMenuItem.addActionListener(new ModelCloser()); fileMenu.add(fileCloseMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_CLOSE, fileCloseMenuItem); } if (showThing(HMIMessages.MENU_SAVE, menuItemsToShow, menuItemsToHide)) { fileMenu.add(new JSeparator()); if (saveAction == null) { saveAction = new SaveAction(this); } fileMenu.add(saveAction); // StateMachine.getInstance().registerActionForState( // StateMachine.MODEL_OPEN, HMIMessages.MENU_SAVE, save); } if (showThing(HMIMessages.MENU_SAVEAS, menuItemsToShow, menuItemsToHide)) { if (saveAsAction == null) { saveAsAction = new SaveAsAction(this); } fileMenu.add(saveAsAction); // StateMachine.getInstance().registerActionForState( // StateMachine.MODEL_OPEN, HMIMessages.MENU_SAVEAS, save); } if (showThing(HMIMessages.MENU_EXIT, menuItemsToShow, menuItemsToHide)) { final JMenuItem exitMenuItem = new JMenuItem(HMIMessages.getString(HMIMessages.MENU_EXIT), HMIMessages.getString(HMIMessages.MENU_EXIT + HMIMessages.KEY).charAt(0)); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK)); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (logger.isTraceEnabled()) { logger.trace("Exit action - entry"); //$NON-NLS-1$ } logger.info(HMIMessages.getString(HMIMessages.INFO_EXIT)); // DBA to be validating... // Application which use HMIBase needs to call exit // treatment before exiting exitApplication(); if (logger.isTraceEnabled()) { logger.trace("Exit action - exit"); //$NON-NLS-1$ } System.exit(0); } }); fileMenu.add(new JSeparator()); fileMenu.add(exitMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.READY, HMIMessages.MENU_EXIT, exitMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_EXIT, exitMenuItem); } final JMenu runMenu = new JMenu(HMIMessages.getString(HMIMessages.MENU_RUN)); runMenu.setMnemonic(HMIMessages.getString(HMIMessages.MENU_RUN + HMIMessages.KEY).charAt(0)); if (showThing(HMIMessages.MENU_EXECUTE, menuItemsToShow, menuItemsToHide)) { if (modelExecutor == null) { modelExecutor = new ModelExecutor(this); } final JMenuItem runExecuteMenuItem = new JMenuItem(modelExecutor); runMenu.add(runExecuteMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_EXECUTE, modelExecutor); } if (showThing(HMIMessages.MENU_STOP, menuItemsToShow, menuItemsToHide)) { if (modelStopper == null) { modelStopper = new ModelStopper(this); } final JMenuItem stopExecuteMenuItem = new JMenuItem(modelStopper); runMenu.add(stopExecuteMenuItem); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING, HMIMessages.MENU_STOP, modelStopper); } if (showThing(HMIMessages.MENU_INTERACTIVE_ERRORHANDLING, menuItemsToShow, menuItemsToHide)) { final JMenuItem interactiveErrorCtrlMenuItem = new JCheckBoxMenuItem( HMIMessages.getString(HMIMessages.MENU_INTERACTIVE_ERRORHANDLING)); interactiveErrorCtrlMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { interactiveErrorControl = ((JCheckBoxMenuItem) e.getSource()).getState(); } }); runMenu.add(new JSeparator()); runMenu.add(interactiveErrorCtrlMenuItem); } final JMenu graphMenu = new JMenu(HMIMessages.getString(HMIMessages.MENU_GRAPH)); graphMenu.setMnemonic(HMIMessages.getString(HMIMessages.MENU_GRAPH + HMIMessages.KEY).charAt(0)); // if (showThing(HMIMessages.MENU_SHOW, menuItemsToShow, // menuItemsToHide)) { // JMenuItem graphViewMenuItem = new // JCheckBoxMenuItem(HMIMessages.getString(HMIMessages.MENU_SHOW)); // graphMenu.add(graphViewMenuItem); // // graphViewMenuItem.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // if (logger.isTraceEnabled()) { // logger.trace("Graph Show action - entry"); //$NON-NLS-1$ // } // boolean showGraph = ((JCheckBoxMenuItem) e.getSource()).getState(); // if(showGraph) { // applyFieldValuesToParameters(); // clearModelForms(); // showModelGraph(HMIBase.this.currentModel.getName()); // } else { // clearModelGraphs(); // showModelForm(HMIBase.this.currentModel.getName()); // } // if (logger.isTraceEnabled()) { // logger.trace("Graph Show action - exit"); //$NON-NLS-1$ // } // } // // // }); // } if (showThing(HMIMessages.MENU_ANIMATE, menuItemsToShow, menuItemsToHide)) { final JMenuItem animateGraphViewMenuItem = new JCheckBoxMenuItem( HMIMessages.getString(HMIMessages.MENU_ANIMATE)); animateGraphViewMenuItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { animateModelExecution = ((JCheckBoxMenuItem) e.getSource()).getState(); } }); graphMenu.add(new JSeparator()); graphMenu.add(animateGraphViewMenuItem); } if (fileMenu.getMenuComponentCount() > 0) { menuBar.add(fileMenu); } if (runMenu.getMenuComponentCount() > 0) { menuBar.add(runMenu); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_RUN, runMenu); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING, HMIMessages.MENU_RUN, runMenu); } if (graphMenu.getMenuComponentCount() > 0) { menuBar.add(graphMenu); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, HMIMessages.MENU_GRAPH, graphMenu); StateMachine.getInstance().registerActionForState(StateMachine.MODEL_EXECUTING, HMIMessages.MENU_GRAPH, graphMenu); } final JMenu monitoringMenu = new JMenu(HMIMessages.getString(HMIMessages.MENU_MONITORING)); monitoringMenu.setMnemonic(HMIMessages.getString(HMIMessages.MENU_MONITORING + HMIMessages.KEY).charAt(0)); if (showThing(HMIMessages.MENU_TRACING, menuItemsToShow, menuItemsToHide)) { final JMenuItem traceMenuItem = new JMenuItem(HMIMessages.getString(HMIMessages.MENU_TRACING), HMIMessages.getString(HMIMessages.MENU_TRACING + HMIMessages.KEY).charAt(0)); traceMenuItem.addActionListener(new TraceDialogOpener()); monitoringMenu.add(traceMenuItem); } if (monitoringMenu.getMenuComponentCount() > 0) { menuBar.add(monitoringMenu); } StateMachine.getInstance().compile(); StateMachine.getInstance().transitionTo(StateMachine.READY); return menuBar; }
From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java
/** * Mostly created by Eclipse WindowBuilder *//*from ww w . j a va 2s. c o m*/ private void initComponents() { setTitle("perfLoad - Load Profile Configurator"); setSize(1032, 984); setLocationRelativeTo(null); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); SwingUtils.setUIFontStyle(Font.PLAIN); { JMenuBar menuBar = new JMenuBar(); menuBar.setName("menuBar"); setJMenuBar(menuBar); initMenuBar(menuBar); } contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new MigLayout("insets 0", "[grow][]", "[25px][400][grow]")); { JToolBar toolBar = new JToolBar() { @Override protected JButton createActionComponent(final Action a) { JButton button = super.createActionComponent(a); button.setFocusable(false); button.setHideActionText(false); return button; } }; toolBar.setName("toolBar"); contentPane.add(toolBar, "cell 0 0 2 1,growx,aligny top"); initToolBar(toolBar); } { JScrollPane spTree = new JScrollPane(); spTree.setBorder(new CompoundBorder( new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profile Elements", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)), new EmptyBorder(4, 4, 4, 4))); contentPane.add(spTree, "cell 0 1,grow"); spTree.setName("spTree"); { tree = new JTree(); tree.addKeyListener(new TreeKeyListener()); tree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); tree.addTreeSelectionListener(new TreeTreeSelectionListener()); tree.setShowsRootHandles(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setName("tree"); spTree.setViewportView(tree); } } { JPanel pnlMain = new JPanel(); contentPane.add(pnlMain, "cell 1 1"); pnlMain.setName("pnlMain"); pnlMain.setLayout(new MigLayout("insets 0", "[664!]", "[grow][]")); { JPanel pnlLoadProfileProperties = new JPanel(); pnlLoadProfileProperties.setBorder(new TitledBorder(null, "Load Profile Properties", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlLoadProfileProperties.setName("pnlLoadProfileProperties"); pnlMain.add(pnlLoadProfileProperties, "flowx,cell 0 0,grow"); pnlLoadProfileProperties .setLayout(new MigLayout("insets 4", "[270,grow]8[]8[200]8[]8[200]", "[][][][grow]")); { lblName = new JLabel("Name"); lblName.setDisplayedMnemonic('N'); lblName.setHorizontalAlignment(SwingConstants.CENTER); lblName.setName("lblName"); pnlLoadProfileProperties.add(lblName, "cell 0 0"); } { JSeparator separator = new JSeparator(); separator.setPreferredSize(new Dimension(0, 200)); separator.setOrientation(SwingConstants.VERTICAL); separator.setName("separator"); pnlLoadProfileProperties.add(separator, "cell 1 0 1 4, growy"); } { JLabel lblClient = new JLabel("Clients"); lblClient.setName("lblClient"); pnlLoadProfileProperties.add(lblClient, "cell 2 0"); } { JSeparator separator = new JSeparator(); separator.setPreferredSize(new Dimension(0, 200)); separator.setOrientation(SwingConstants.VERTICAL); separator.setName("separator"); pnlLoadProfileProperties.add(separator, "cell 3 0 1 4, growy"); } { lblTargets = new JLabel("Targets"); lblTargets.setName("lblTargets"); pnlLoadProfileProperties.add(lblTargets, "cell 4 0"); } { txtName = new JTextField(); lblName.setLabelFor(txtName); txtName.setColumns(10); txtName.setName("txtName"); txtName.getDocument().addDocumentListener(dirtyListener); pnlLoadProfileProperties.add(txtName, "cell 0 1,growx"); } { JScrollPane spClients = new JScrollPane(); spClients.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); spClients.setName("spClients"); pnlLoadProfileProperties.add(spClients, "cell 2 1 1 3,grow"); { tblClients = new JCheckListTable(); tblClients.setName("tblClients"); spClients.setViewportView(tblClients); spClients.setColumnHeaderView(null); } } { JScrollPane spTargets = new JScrollPane(); spTargets.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); spTargets.setName("spTargets"); pnlLoadProfileProperties.add(spTargets, "cell 4 1 1 3,grow"); { tblTargets = new JCheckListTable(); tblTargets.setName("tblTargets"); spTargets.setViewportView(tblTargets); spTargets.setColumnHeaderView(null); } } { lblDescription = new JLabel("Description"); lblDescription.setDisplayedMnemonic('D'); lblDescription.setName("lblDescription"); pnlLoadProfileProperties.add(lblDescription, "cell 0 2"); } { JScrollPane spDescription = new JScrollPane(); spDescription.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); spDescription.setName("spDescription"); pnlLoadProfileProperties.add(spDescription, "cell 0 3,height 50:50:,grow"); { taDescription = new JTextArea(); taDescription.setFont(txtName.getFont()); lblDescription.setLabelFor(taDescription); taDescription.setRows(3); taDescription.setName("taDescription"); taDescription.getDocument().addDocumentListener(dirtyListener); spDescription.setViewportView(taDescription); } } } { JPanel pnlCurveAssignment = new JPanel(); pnlCurveAssignment.setBorder(new TitledBorder(null, "Active Load Curve Assignment", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlMain.add(pnlCurveAssignment, "cell 0 1,grow"); pnlCurveAssignment.setLayout(new MigLayout("insets 4", "[grow]", "[grow][]")); { pnlCard = new JPanel(); pnlCard.setName("pnlCard"); pnlCurveAssignment.add(pnlCard, "cell 0 0,grow"); cardLayout = new CardLayout(0, 0); pnlCard.setLayout(cardLayout); { stairsPanel = new StairsPanel(); stairsPanel.setName("stairsPanel"); pnlCard.add(stairsPanel, "stairs"); } { oneTimePanel = new OneTimePanel(); oneTimePanel.setName("oneTimePanel"); pnlCard.add(oneTimePanel, "oneTime"); } { markerPanel = new MarkerPanel(); markerPanel.setName("markerPanel"); pnlCard.add(markerPanel, "marker"); } { JLabel lblNoActiveCurve = new JLabel("no active curve assignment"); lblNoActiveCurve.setHorizontalAlignment(SwingConstants.CENTER); pnlCard.add(lblNoActiveCurve, "none"); lblNoActiveCurve.setName("lblNoActiveCurve"); } } { btnOk = new JButtonExt("OK"); getRootPane().setDefaultButton(btnOk); btnOk.setEnabled(false); btnOk.addActionListener(new BtnOkActionListener()); btnOk.setMnemonic(KeyEvent.VK_O); btnOk.setName("btnOk"); pnlCurveAssignment.add(btnOk, "cell 0 1,alignx right"); } { btnCancel = new JButtonExt("Cancel"); btnCancel.setEnabled(false); btnCancel.addActionListener(new BtnCancelActionListener()); btnCancel.setMnemonic(KeyEvent.VK_C); btnCancel.setName("btnCancel"); pnlCurveAssignment.add(btnCancel, "cell 0 1,alignx right"); } } } }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
/** * Recria o menu editar do Frame Principal * // w ww . j av a 2 s .com * @param menu * @return */ private JMenu criaMenuEditar(JMenu menu) { menu.removeAll(); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); menu.add(new JMenuItemTeclaAtalho(textAreaSourceCode)); menu.add(new JSeparator()); JMenuItem btnContraste = new JMenuItem(XHTML_Panel.ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(XHTML_Panel.DICA_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(XHTML_Panel.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(XHTML_Panel.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(XHTML_Panel.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(XHTML_Panel.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_DIMINUI_FONTE); menu.add(btnDiminui); menu.add(new JSeparator()); JMenuItem btnProcurar = new JMenuItem(XHTML_Panel.PROCURAR); btnProcurar.addActionListener(this); btnProcurar.setActionCommand("Procurar"); btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); btnProcurar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, ActionEvent.CTRL_MASK)); btnProcurar.setToolTipText(XHTML_Panel.DICA_PROCURAR); btnProcurar.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_PROCURAR); menu.add(btnProcurar); JMenuItem btnSelecionarTudo = new JMenuItem(XHTML_Panel.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(XHTML_Panel.DICA_SELECIONAR_TUDO); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_SELECIONAR_TUDO); menu.add(btnSelecionarTudo); JMenuItem btnDesfazer = new JMenuItem(XHTML_Panel.DESFAZER); btnDesfazer.addActionListener(this); btnDesfazer.setActionCommand("Desfazer"); btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); btnDesfazer.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, ActionEvent.CTRL_MASK)); btnDesfazer.setToolTipText(XHTML_Panel.DICA_DESFAZER); btnDesfazer.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_DESFAZER); menu.add(btnDesfazer); return menu; }
From source file:net.sf.dvstar.transmission.TransmissionView.java
private void initGlobals() { System.setProperty("java.net.useSystemProxies", "false"); //globalActionMap = org.jdesktop.application.Application.getInstance(net.sf.dvstar.transmission.TransmissionApp.class).getContext().getActionMap(TransmissionView.class, this); globalConfigStorage = new ConfigStorage(); globalConfigStorage.loadConfig();/*from w w w . j a va 2 s. c o m*/ lastOpenDir = new File(globalConfigStorage.getProperty("last-open-dir")); Locale configLocale = Tools.parseConfigLocale(globalConfigStorage.getProperty(CONF_CLI_LOCALE, "en", true)); setDefaultLocale(configLocale); tracePrint(true, "Locale is " + globalConfigStorage.getProperty(CONF_CLI_LOCALE, "en", true)); globalResourceMap = Application.getInstance(net.sf.dvstar.transmission.TransmissionApp.class).getContext() .getResourceMap(TransmissionView.class); this.getFrame().setIconImage(globalResourceMap.getImageIcon("MainFrame.icon").getImage()); String[] names = null; String namesList = globalResourceMap.getString("tblTorrentList.miTorrentPopup.items"); if (namesList != null) { names = Tools.getStringArray(namesList, ","); } PopupCommandDescriptor commandsPopup[] = { new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_START, globalResourceMap.getIcon("miTorrentStart.icon"), names[0], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_STOP, globalResourceMap.getIcon("miTorrentStop.icon"), names[1], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_REFRESH, globalResourceMap.getIcon("miTorrentRefresh.icon"), names[2], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_CHECK, globalResourceMap.getIcon("miTorrentCheck.icon"), names[3], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_PROP, globalResourceMap.getIcon("miTorrentProperties.icon"), names[4], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_DEL, globalResourceMap.getIcon("miTorrentDelete.icon"), names[5], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_DELALL, globalResourceMap.getIcon("miTorrentDeleteAll.icon"), names[6], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_ANNOUNCE, globalResourceMap.getIcon("miTorrentAnnounce.icon"), names[7], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_MOVE, globalResourceMap.getIcon("miTorrentMove.icon"), names[8], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_SET_LOCATION, globalResourceMap.getIcon("miTorrentLocation.icon"), names[9], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(TorrentsListPopupCmd.TLIST_POPUP_CMD_NONE, null, names[10], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(true, TorrentsListPopupCmd.TLIST_POPUP_CMD_LIMIT_DOWN, globalResourceMap.getIcon("miTorrentUp.icon"), names[11], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START), new PopupCommandDescriptor(true, TorrentsListPopupCmd.TLIST_POPUP_CMD_LIMIT_UP, globalResourceMap.getIcon("miTorrentDn.icon"), names[12], //"Start torrent(s)", BUNDLE_IDENT_MENU_TORRENT_START) }; for (int i = 0; i < names.length; i++) { String name = names[i]; if (names[i].equals("SEPARATOR")) { JSeparator item = new JSeparator(); tblTorrentListPopupMenu.add(item); } else { if (commandsPopup[i].isMenu) { JMenu item; item = new JMenu(name); tblTorrentListPopupMenu.add(item); } else { JMenuItem item; if (commandsPopup[i].icon != null) { item = new JMenuItem(name, commandsPopup[i].icon); } else { item = new JMenuItem(name); } TorrentsMenuItemListener menuItemListener = new TorrentsMenuItemListener(commandsPopup[i].cmd); item.setName(name); item.addActionListener(menuItemListener); tblTorrentListPopupMenu.add(item); } } } }
From source file:com.github.fritaly.dualcommander.DualCommander.java
public DualCommander() { // TODO Generate a fat jar at build time super(String.format("Dual Commander %s", Utils.getApplicationVersion())); if (logger.isInfoEnabled()) { logger.info(String.format("Dual Commander %s", Utils.getApplicationVersion())); }/* ww w .j a v a 2s .com*/ try { // Apply the JGoodies L&F UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (Exception e) { // Not supposed to happen } // Layout, columns & rows setLayout(new MigLayout("insets 0px", "[grow]0px[grow]", "[grow]0px[]")); // Create a menu bar final JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(preferencesAction)); fileMenu.add(new JSeparator()); fileMenu.add(new JMenuItem(quitAction)); final JMenu helpMenu = new JMenu("Help"); helpMenu.add(new JMenuItem(aboutAction)); final JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); this.leftPane = new TabbedPane(preferences); this.leftPane.setName("Left"); this.leftPane.addChangeListener(this); this.leftPane.addKeyListener(this); this.leftPane.addFocusListener(this); this.rightPane = new TabbedPane(preferences); this.rightPane.setName("Right"); this.rightPane.addChangeListener(this); this.rightPane.addKeyListener(this); this.rightPane.addFocusListener(this); // Adding the 2 components to the same sizegroup ensures they always // keep the same width getContentPane().add(leftPane, "grow, sizegroup g1"); getContentPane().add(rightPane, "grow, sizegroup g1, wrap"); // The 7 buttons must all have the same width (they must belong to the // same size group) final JPanel buttonPanel = new JPanel( new MigLayout("insets 0px", StringUtils.repeat("[grow, sizegroup g1]", 7), "[grow]")); buttonPanel.add(viewButton, "grow"); buttonPanel.add(editButton, "grow"); buttonPanel.add(copyButton, "grow"); buttonPanel.add(moveButton, "grow"); buttonPanel.add(mkdirButton, "grow"); buttonPanel.add(deleteButton, "grow"); buttonPanel.add(quitButton, "grow"); getContentPane().add(buttonPanel, "grow, span 2"); // Register shortcuts at a global level (not on every component) final InputMap inputMap = this.leftPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0, true), "view"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0, true), "edit"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, true), "copy"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0, true), "move"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0, true), "mkdir"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0, true), "delete"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_DOWN_MASK), "quit"); final ActionMap actionMap = this.leftPane.getActionMap(); actionMap.put("view", viewAction); actionMap.put("edit", editAction); actionMap.put("copy", copyAction); actionMap.put("move", moveAction); actionMap.put("mkdir", mkdirAction); actionMap.put("delete", deleteAction); actionMap.put("quit", quitAction); addWindowListener(this); addKeyListener(this); // Listen to preference change events this.preferences.addPropertyChangeListener(this); // Reload the last configuration and init the left & right panels // accordingly final Preferences prefs = Preferences.userNodeForPackage(this.getClass()); // The user preferences must be loaded first because they're needed to // init the UI this.preferences.init(prefs.node("user.preferences")); this.leftPane.init(prefs.node("left.panel")); this.rightPane.init(prefs.node("right.panel")); if (logger.isInfoEnabled()) { logger.info("Loaded preferences"); } // Init the buttons refreshButtons(this.leftPane.getActiveBrowser().getSelection()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setExtendedState(JFrame.MAXIMIZED_BOTH); if (logger.isInfoEnabled()) { logger.info("UI initialized"); } }
From source file:net.sourceforge.entrainer.gui.EntrainerFX.java
private void addMenu() { JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu(FILE_MENU_NAME); addMnemonic(menu, KeyEvent.VK_F); menu.add(getStartItem());//from ww w . j ava 2 s. com menu.add(getStopItem()); menu.add(new JSeparator()); menu.add(getLoadXmlItem()); menu.add(getClearXmlItem()); menu.add(getEditXmlItem()); menu.add(getNewXmlItem()); menu.add(new JSeparator()); menu.add(getExitItem()); bar.add(menu); bar.add(getLookAndFeels()); bar.add(intervalMenu); bar.add(getEspMenu()); bar.add(getSocketMenu()); JMenu help = new JMenu(HELP_MENU_NAME); addMnemonic(help, KeyEvent.VK_H); help.add(getAboutItem()); help.add(getLicenseItem()); help.add(getLocalDocItem()); help.add(getRemoteDocItem()); help.add(getSplashItem()); help.add(getSplashOnStartupItem()); bar.add(help); setJMenuBar(bar); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java
/** * Cria o menu editar do Frame Principal * //from w w w .ja v a 2 s . co m * @param menu */ private JMenu criaMenuEditar() { JMenu menu = new JMenu(GERAL.EDITAR); menu.setBackground(parentFrame.corDefault); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); JMenuItem btnContraste = new JMenuItem(GERAL.BTN_ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(GERAL.ALTERAR_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.ALTERAR_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE); menu.add(btnDiminui); JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); menu.add(btnSelecionarTudo); menu.add(new JSeparator()); /* * JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR); * btnProcurar.addActionListener(this); * btnProcurar.setActionCommand("Procurar"); * btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); * btnProcurar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, * ActionEvent.CTRL_MASK)); * btnProcurar.setToolTipText(GERAL.DICA_PROCURAR); * btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR); * menu.add(btnProcurar); * * JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); * btnSelecionarTudo.addActionListener(this); * btnSelecionarTudo.setActionCommand("SelecionarTudo"); * btnSelecionarTudo.setMnemonic('T'); * btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); * btnSelecionarTudo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, * ActionEvent.CTRL_MASK)); * btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); * btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); * menu.add(btnSelecionarTudo); * * JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER); * btnDesfazer.addActionListener(this); * btnDesfazer.setActionCommand("Desfazer"); * btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); * btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER); * btnDesfazer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, * ActionEvent.CTRL_MASK)); menu.add(btnDesfazer); * menu.setEnabled(true); */ return menu; }
From source file:com.mirth.connect.client.ui.codetemplate.CodeTemplateImportDialog.java
private void initComponents() { setBackground(UIConstants.BACKGROUND_COLOR); getContentPane().setBackground(getBackground()); topPanel = new JPanel(); topPanel.setBackground(getBackground()); linkPanel = new JPanel(); linkPanel.setBackground(topPanel.getBackground()); linkLeftPanel = new JPanel(); linkLeftPanel.setBackground(linkPanel.getBackground()); linkLeftSelectAllLabel = new JLabel("<html><u>All</u></html>"); linkLeftSelectAllLabel.setForeground(Color.BLUE); linkLeftSelectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); linkLeftSelectAllLabel.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent evt) { for (int row = 0; row < importTreeTable.getRowCount(); row++) { importTreeTable.getModel().setValueAt(true, row, IMPORT_SELECTED_COLUMN); }// w w w . j a va2 s . c om } }); linkLeftDeselectAllLabel = new JLabel("<html><u>None</u></html>"); linkLeftDeselectAllLabel.setForeground(Color.BLUE); linkLeftDeselectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); linkLeftDeselectAllLabel.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent evt) { for (int row = 0; row < importTreeTable.getRowCount(); row++) { importTreeTable.getModel().setValueAt(false, row, IMPORT_SELECTED_COLUMN); } } }); linkRightPanel = new JPanel(); linkRightPanel.setBackground(linkPanel.getBackground()); linkRightOverwriteAllLabel = new JLabel("<html><u>All</u></html>"); linkRightOverwriteAllLabel.setForeground(Color.BLUE); linkRightOverwriteAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); linkRightOverwriteAllLabel.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent evt) { for (int row = 0; row < importTreeTable.getRowCount(); row++) { TreePath path = importTreeTable.getPathForRow(row); if (path != null) { ImportTreeTableNode node = (ImportTreeTableNode) path.getLastPathComponent(); if (node instanceof ImportLibraryTreeTableNode) { ImportLibraryTreeTableNode libraryNode = (ImportLibraryTreeTableNode) node; if (libraryNode.getConflicts().getMatchingLibrary() != null) { importTreeTable.getModel().setValueAt(true, row, IMPORT_OVERWRITE_COLUMN); } } else if (node instanceof ImportCodeTemplateTreeTableNode) { ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) node; if (codeTemplateNode.getConflicts().getMatchingCodeTemplate() != null) { importTreeTable.getModel().setValueAt(true, row, IMPORT_OVERWRITE_COLUMN); } } } } } }); linkRightOverwriteNoneLabel = new JLabel("<html><u>None</u></html>"); linkRightOverwriteNoneLabel.setForeground(Color.BLUE); linkRightOverwriteNoneLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); linkRightOverwriteNoneLabel.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent evt) { for (int row = 0; row < importTreeTable.getRowCount(); row++) { TreePath path = importTreeTable.getPathForRow(row); if (path != null) { ImportTreeTableNode node = (ImportTreeTableNode) path.getLastPathComponent(); if (node instanceof ImportLibraryTreeTableNode) { ImportLibraryTreeTableNode libraryNode = (ImportLibraryTreeTableNode) node; if (libraryNode.getConflicts().getMatchingLibrary() != null) { importTreeTable.getModel().setValueAt(false, row, IMPORT_OVERWRITE_COLUMN); } } else if (node instanceof ImportCodeTemplateTreeTableNode) { ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) node; if (codeTemplateNode.getConflicts().getMatchingCodeTemplate() != null) { importTreeTable.getModel().setValueAt(false, row, IMPORT_OVERWRITE_COLUMN); } } } } } }); final TableCellEditor templateCellEditor = new NameCellEditor(); importTreeTable = new JXTreeTable() { @Override public boolean isCellEditable(int row, int column) { return (column == IMPORT_OVERWRITE_COLUMN || column == IMPORT_SELECTED_COLUMN || column == IMPORT_NAME_COLUMN); } @Override public TableCellEditor getCellEditor(int row, int column) { if (isHierarchical(column)) { return templateCellEditor; } else { return super.getCellEditor(row, column); } } }; importTreeTable.setLargeModel(true); DefaultTreeTableModel model = new ImportTreeTableModel(); model.setColumnIdentifiers(Arrays.asList(new String[] { "", "Name", "Overwrite", "Conflicts", "Id" })); DefaultMutableTreeTableNode rootNode = new DefaultMutableTreeTableNode(); model.setRoot(rootNode); importTreeTable.setTreeTableModel(model); Set<String> addedCodeTemplateIds = new HashSet<String>(); if (unassignedCodeTemplates) { ImportTreeTableNode libraryNode = new ImportUnassignedLibraryTreeTableNode("Select a library", ""); CodeTemplateLibrary library = importLibraries.get(0); for (CodeTemplate codeTemplate : library.getCodeTemplates()) { if (!addedCodeTemplateIds.contains(codeTemplate.getId())) { libraryNode .add(new ImportCodeTemplateTreeTableNode(codeTemplate.getName(), codeTemplate.getId())); addedCodeTemplateIds.add(codeTemplate.getId()); importCodeTemplateMap.put(codeTemplate.getId(), codeTemplate); } } rootNode.add(libraryNode); } else { Set<String> addedLibraryIds = new HashSet<String>(); for (CodeTemplateLibrary library : importLibraries) { if (!addedLibraryIds.contains(library.getId())) { ImportTreeTableNode libraryNode = new ImportLibraryTreeTableNode(library.getName(), library.getId()); importLibraryMap.put(library.getId(), library); for (CodeTemplate codeTemplate : library.getCodeTemplates()) { if (!addedCodeTemplateIds.contains(codeTemplate.getId())) { libraryNode.add(new ImportCodeTemplateTreeTableNode(codeTemplate.getName(), codeTemplate.getId())); addedCodeTemplateIds.add(codeTemplate.getId()); importCodeTemplateMap.put(codeTemplate.getId(), codeTemplate); } } rootNode.add(libraryNode); addedLibraryIds.add(library.getId()); } } } importTreeTable.setOpenIcon(null); importTreeTable.setClosedIcon(null); importTreeTable.setLeafIcon(null); importTreeTable.setRootVisible(false); importTreeTable.setDoubleBuffered(true); importTreeTable.setDragEnabled(false); importTreeTable.setRowSelectionAllowed(true); importTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); importTreeTable.setRowHeight(UIConstants.ROW_HEIGHT); importTreeTable.setFocusable(true); importTreeTable.setOpaque(true); importTreeTable.getTableHeader().setReorderingAllowed(false); importTreeTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); importTreeTable.setEditable(true); importTreeTable.setSortable(false); importTreeTable.setAutoCreateColumnsFromModel(false); importTreeTable.setShowGrid(true, true); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { importTreeTable.setHighlighters(HighlighterFactory .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } importTreeTable.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent evt) { checkSelection(evt); } @Override public void mouseReleased(MouseEvent evt) { checkSelection(evt); } private void checkSelection(MouseEvent evt) { int row = importTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())); if (row < 0) { importTreeTable.clearSelection(); } } }); importTreeTable.addTreeWillExpandListener(new TreeWillExpandListener() { @Override public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { } @Override public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException { throw new ExpandVetoException(event); } }); importTreeTable.setTreeCellRenderer(new NameCellRenderer()); importTreeTable.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent evt) { if (evt.getColumn() != IMPORT_CONFLICTS_COLUMN) { for (int row = evt.getFirstRow(); row <= evt.getLastRow() && row < importTreeTable.getRowCount(); row++) { TreePath path = importTreeTable.getPathForRow(row); if (path != null) { ImportTreeTableNode node = (ImportTreeTableNode) path.getLastPathComponent(); if (path.getPathCount() == 2) { if (node instanceof ImportUnassignedLibraryTreeTableNode) { String libraryName = (String) node.getValueAt(IMPORT_NAME_COLUMN); String libraryId = null; for (CodeTemplateLibrary library : PlatformUI.MIRTH_FRAME.codeTemplatePanel .getCachedCodeTemplateLibraries().values()) { if (library.getName().equals(libraryName)) { libraryId = library.getId(); break; } } node.setValueAt(libraryId, IMPORT_ID_COLUMN); } else if (node instanceof ImportLibraryTreeTableNode) { ImportLibraryTreeTableNode libraryNode = (ImportLibraryTreeTableNode) node; libraryNode.setConflicts(getLibraryConflicts(node)); } for (Enumeration<? extends TreeTableNode> codeTemplateNodes = node .children(); codeTemplateNodes.hasMoreElements();) { ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) codeTemplateNodes .nextElement(); codeTemplateNode.setConflicts(getCodeTemplateConflicts(codeTemplateNode)); } importTreeTable.updateUI(); } else if (path.getPathCount() == 3) { ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) node; codeTemplateNode.setConflicts(getCodeTemplateConflicts(node)); } } } } updateImportButton(); updateErrorsAndWarnings(); } }); importTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { updateImportButton(); updateErrorsAndWarnings(); } } }); importTreeTable.expandAll(); importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN).setMinWidth(20); importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN).setMaxWidth(20); importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN) .setCellRenderer(new ImportSelectedCellRenderer()); importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN) .setCellEditor(new ImportSelectedCellEditor()); importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN).setMinWidth(60); importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN).setMaxWidth(60); importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN) .setCellRenderer(new OverwriteCellRenderer()); importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN) .setCellEditor(new OverwriteCellEditor()); importTreeTable.getColumnModel().getColumn(IMPORT_CONFLICTS_COLUMN).setMinWidth(60); importTreeTable.getColumnModel().getColumn(IMPORT_CONFLICTS_COLUMN).setMaxWidth(60); importTreeTable.getColumnModel().getColumn(IMPORT_CONFLICTS_COLUMN).setCellRenderer(new IconCellRenderer()); importTreeTable.getColumnModel().removeColumn(importTreeTable.getColumnModel().getColumn(IMPORT_ID_COLUMN)); importTreeTableScrollPane = new JScrollPane(importTreeTable); importTreeTableScrollPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(0x6E6E6E))); warningsPanel = new JPanel(); warningsPanel.setBackground(getBackground()); warningsPanel.setVisible(false); warningsLabel = new JLabel(UIConstants.ICON_WARNING); warningsTextArea = new JTextArea(); warningsTextArea.setLineWrap(true); warningsTextArea.setWrapStyleWord(true); errorsPanel = new JPanel(); errorsPanel.setBackground(getBackground()); errorsPanel.setVisible(false); errorsLabel = new JLabel(UIConstants.ICON_ERROR); errorsTextArea = new JTextArea(); errorsTextArea.setLineWrap(true); errorsTextArea.setWrapStyleWord(true); separator = new JSeparator(); buttonPanel = new JPanel(); buttonPanel.setBackground(getBackground()); importButton = new JButton("Import"); importButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { boolean warnings = false; for (Enumeration<? extends TreeTableNode> libraryNodes = ((TreeTableNode) importTreeTable .getTreeTableModel().getRoot()).children(); libraryNodes.hasMoreElements();) { for (Enumeration<? extends TreeTableNode> codeTemplateNodes = libraryNodes.nextElement() .children(); codeTemplateNodes.hasMoreElements();) { ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) codeTemplateNodes .nextElement(); if ((boolean) codeTemplateNode.getValueAt(IMPORT_SELECTED_COLUMN)) { CodeTemplateConflicts conflicts = codeTemplateNode.getConflicts(); if (conflicts.getMatchingCodeTemplate() != null) { warnings = true; break; } } } if (warnings) { break; } } if (!warnings || PlatformUI.MIRTH_FRAME.alertOption(CodeTemplateImportDialog.this, "Some selected rows have warnings. Are you sure you wish to continue?")) { save(); dispose(); } } catch (Exception e) { PlatformUI.MIRTH_FRAME.alertThrowable(CodeTemplateImportDialog.this, e, "Unable to import: " + e.getMessage()); } } }); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if (confirmClose()) { dispose(); } } }); updateImportButton(); }
From source file:hpssim.grafica.HPSsim.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Lgc M DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); HPSsimWindow = new JFrame(); hpssimWindow = new JPanel(); hpssimTab = new JTabbedPane(); panelConfiguration = new JPanel(); label10 = new JLabel(); label3 = new JLabel(); ncpu = new JTextField(); label4 = new JLabel(); ngpu = new JTextField(); vSpacer1 = new JPanel(null); label11 = new JLabel(); label2 = new JLabel(); sliderSimulationTime = new JSlider(); textFieldSimTime = new JLabel(); label1 = new JLabel(); sliderJob = new JSlider(); textFieldNjob = new JLabel(); label9 = new JLabel(); textFieldQVGA = new JTextField(); label43 = new JLabel(); tex_mediaexe = new JTextField(); checkBoxEndJob = new JCheckBox(); label6 = new JLabel(); comboBoxScheduler = new JComboBox<>(); label8 = new JLabel(); textFieldTimeSlice = new JTextField(); label7 = new JLabel(); comboBoxQueue = new JComboBox<>(); vSpacer2 = new JPanel(null); label21 = new JLabel(); sliderclassRate = new JSlider(); labelclassRate = new JLabel(); label12 = new JLabel(); sliderRTJob = new JSlider(); labelRT = new JLabel(); label14 = new JLabel(); sliderOpenCl = new JSlider(); labelOPENCL = new JLabel(); checkBox_enableLog = new JCheckBox(); panelPerformance = new JPanel(); separator1 = new JSeparator(); tabbedPane1 = new JTabbedPane(); panelCPU = new JPanel(); labelCPUUsage = new JLabel(); panelCPUQueue = new JPanel(); tabbedPane2 = new JTabbedPane(); panelGPU = new JPanel(); labelGPUUsage = new JLabel(); panelGPUQueue = new JPanel(); panel2 = new JPanel(); label18 = new JLabel(); virtualTime = new JTextField(); label5 = new JLabel(); processiNelSistema = new JTextField(); label17 = new JLabel(); processiElaborazione = new JTextField(); label16 = new JLabel(); processiInCoda = new JTextField(); label15 = new JLabel(); ldavg_1 = new JTextField(); label19 = new JLabel(); ldavg_5 = new JTextField(); label20 = new JLabel(); ldavg_15 = new JTextField(); panel3 = new JPanel(); progressBar = new JProgressBar(); panelGraph = new JPanel(); graphPanel = new JPanel(); label23 = new JLabel(); label38 = new JLabel(); text_ClassRate = new JTextField(); label24 = new JLabel(); button_CostanteCodaSuMedia = new JButton(); label39 = new JLabel(); button_ClassRateCodaSuMedia = new JButton(); label25 = new JLabel(); button_CostanteTempoMedioArrivo = new JButton(); hSpacer1 = new JPanel(null); label40 = new JLabel(); button_ClassRateTempoMedioArrivo = new JButton(); label26 = new JLabel(); label41 = new JLabel(); label27 = new JLabel(); label42 = new JLabel(); label28 = new JLabel(); label33 = new JLabel(); label29 = new JLabel(); label30 = new JLabel(); label31 = new JLabel(); label32 = new JLabel(); button_CrescenteCodaSuMedia = new JButton(); label34 = new JLabel(); button_BurstCodaSuMedia = new JButton(); button_CrescenteCarico = new JButton(); label35 = new JLabel(); button_BurstTempoMedioArrivo = new JButton(); label36 = new JLabel(); label37 = new JLabel(); label22 = new JLabel(); title1 = compFactory.createTitle("HPSsim 2.0 "); button1 = new JButton(); okButton = new JButton(); button3 = new JButton(); dialog1 = new JDialog(); button2 = new JButton(); label13 = new JLabel(); erroreLabel = new JLabel(); Grafici = new JFrame(); panelGraficoFinestra = new JPanel(); //======== HPSsimWindow ======== {/* ww w .jav a 2 s. c o m*/ HPSsimWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); HPSsimWindow.setResizable(false); Container HPSsimWindowContentPane = HPSsimWindow.getContentPane(); //======== hpssimWindow ======== { hpssimWindow.setForeground(Color.blue); // JFormDesigner evaluation mark hpssimWindow.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), hpssimWindow.getBorder())); hpssimWindow.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); hpssimWindow.setLayout(null); //======== hpssimTab ======== { //======== panelConfiguration ======== { panelConfiguration.setLayout(new TableLayout( new double[][] { { 1, 70, 70, 70, 68, 70, 70, 74 }, { 0.01, 27, 21, 26, 27, 25, 25, 25, 21, 21, TableLayout.PREFERRED, 12, TableLayout.PREFERRED, 22, 23 } })); ((TableLayout) panelConfiguration.getLayout()).setHGap(5); ((TableLayout) panelConfiguration.getLayout()).setVGap(5); //---- label10 ---- label10.setText("Hardware"); label10.setFont(new Font("Segoe UI", Font.ITALIC, 16)); panelConfiguration.add(label10, new TableLayoutConstraints(1, 1, 7, 1, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label3 ---- label3.setText("CPU"); label3.setFont(new Font("Segoe UI", Font.PLAIN, 12)); label3.setLabelFor(ncpu); panelConfiguration.add(label3, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- ncpu ---- ncpu.setText("4"); panelConfiguration.add(ncpu, new TableLayoutConstraints(2, 2, 3, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label4 ---- label4.setText("GPU"); label4.setFont(new Font("Segoe UI", Font.PLAIN, 12)); label4.setLabelFor(ngpu); panelConfiguration.add(label4, new TableLayoutConstraints(4, 2, 4, 2, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- ngpu ---- ngpu.setText("0"); panelConfiguration.add(ngpu, new TableLayoutConstraints(5, 2, 6, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); panelConfiguration.add(vSpacer1, new TableLayoutConstraints(1, 3, 7, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label11 ---- label11.setText("Simulation"); label11.setFont(new Font("Segoe UI", Font.ITALIC, 16)); panelConfiguration.add(label11, new TableLayoutConstraints(1, 4, 7, 4, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label2 ---- label2.setText("Sim Time"); panelConfiguration.add(label2, new TableLayoutConstraints(1, 5, 1, 5, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderSimulationTime ---- sliderSimulationTime.setValue(100000); sliderSimulationTime.setMaximum(1200000); sliderSimulationTime.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderSimulationTimeStateChanged(e); } }); panelConfiguration.add(sliderSimulationTime, new TableLayoutConstraints(2, 5, 6, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- textFieldSimTime ---- textFieldSimTime.setText("100000 ms"); panelConfiguration.add(textFieldSimTime, new TableLayoutConstraints(7, 5, 7, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label1 ---- label1.setText("Numero di job"); panelConfiguration.add(label1, new TableLayoutConstraints(1, 6, 1, 6, TableLayoutConstraints.RIGHT, TableLayoutConstraints.CENTER)); //---- sliderJob ---- sliderJob.setMaximum(20000); sliderJob.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderJobStateChanged(e); } }); panelConfiguration.add(sliderJob, new TableLayoutConstraints(2, 6, 6, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- textFieldNjob ---- textFieldNjob.setText("50"); panelConfiguration.add(textFieldNjob, new TableLayoutConstraints(7, 6, 7, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label9 ---- label9.setText("Media arrivo"); panelConfiguration.add(label9, new TableLayoutConstraints(1, 7, 1, 7, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- textFieldQVGA ---- textFieldQVGA.setText("230"); panelConfiguration.add(textFieldQVGA, new TableLayoutConstraints(2, 7, 2, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label43 ---- label43.setText("Media exe"); panelConfiguration.add(label43, new TableLayoutConstraints(3, 7, 3, 7, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- tex_mediaexe ---- tex_mediaexe.setText("1000"); panelConfiguration.add(tex_mediaexe, new TableLayoutConstraints(4, 7, 4, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- checkBoxEndJob ---- checkBoxEndJob.setText("End Job"); panelConfiguration.add(checkBoxEndJob, new TableLayoutConstraints(6, 7, 6, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label6 ---- label6.setText("Scheduler"); panelConfiguration.add(label6, new TableLayoutConstraints(1, 9, 1, 9, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- comboBoxScheduler ---- comboBoxScheduler.setModel(new DefaultComboBoxModel<>( new String[] { "Priority Round Robin", "Completely Fair Scheduler" })); comboBoxScheduler.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { comboBoxSchedulerActionPerformed(e); } }); panelConfiguration.add(comboBoxScheduler, new TableLayoutConstraints(2, 9, 5, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label8 ---- label8.setText("Time Slice"); panelConfiguration.add(label8, new TableLayoutConstraints(6, 9, 6, 9, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- textFieldTimeSlice ---- textFieldTimeSlice.setText("210"); panelConfiguration.add(textFieldTimeSlice, new TableLayoutConstraints(7, 9, 7, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label7 ---- label7.setText("Queue"); panelConfiguration.add(label7, new TableLayoutConstraints(1, 10, 1, 10, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- comboBoxQueue ---- comboBoxQueue.setModel(new DefaultComboBoxModel<>(new String[] { "FIFO", "Highest Priority First", "Shortest Job First", "Round Robin", "Random Queue" })); panelConfiguration.add(comboBoxQueue, new TableLayoutConstraints(2, 10, 5, 10, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); panelConfiguration.add(vSpacer2, new TableLayoutConstraints(1, 11, 7, 11, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label21 ---- label21.setText("Class Rate"); panelConfiguration.add(label21, new TableLayoutConstraints(1, 12, 1, 12, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderclassRate ---- sliderclassRate.setValue(99); sliderclassRate.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderclassRateStateChanged(e); } }); panelConfiguration.add(sliderclassRate, new TableLayoutConstraints(2, 12, 4, 12, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- labelclassRate ---- labelclassRate.setText("99%"); panelConfiguration.add(labelclassRate, new TableLayoutConstraints(5, 12, 5, 12, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label12 ---- label12.setText("RT Job Prob"); panelConfiguration.add(label12, new TableLayoutConstraints(1, 13, 1, 13, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderRTJob ---- sliderRTJob.setValue(45); sliderRTJob.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderRTJobStateChanged(e); } }); panelConfiguration.add(sliderRTJob, new TableLayoutConstraints(2, 13, 4, 13, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- labelRT ---- labelRT.setText("45%"); panelConfiguration.add(labelRT, new TableLayoutConstraints(5, 13, 5, 13, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label14 ---- label14.setText("OpenCL Job "); panelConfiguration.add(label14, new TableLayoutConstraints(1, 14, 1, 14, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- sliderOpenCl ---- sliderOpenCl.setValue(20); sliderOpenCl.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sliderOpenClStateChanged(e); } }); panelConfiguration.add(sliderOpenCl, new TableLayoutConstraints(2, 14, 4, 14, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- labelOPENCL ---- labelOPENCL.setText("20%"); panelConfiguration.add(labelOPENCL, new TableLayoutConstraints(5, 14, 5, 14, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- checkBox_enableLog ---- checkBox_enableLog.setText("log"); panelConfiguration.add(checkBox_enableLog, new TableLayoutConstraints(7, 14, 7, 14, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } hpssimTab.addTab("Configuration", panelConfiguration); //======== panelPerformance ======== { //======== tabbedPane1 ======== { //======== panelCPU ======== { panelCPU.setLayout(new BorderLayout()); //---- labelCPUUsage ---- labelCPUUsage.setText("0\\0"); labelCPUUsage.setHorizontalAlignment(SwingConstants.CENTER); panelCPU.add(labelCPUUsage, BorderLayout.SOUTH); } tabbedPane1.addTab("Usage", panelCPU); //======== panelCPUQueue ======== { panelCPUQueue.setLayout(new BorderLayout()); } tabbedPane1.addTab("Queue", panelCPUQueue); } //======== tabbedPane2 ======== { //======== panelGPU ======== { panelGPU.setLayout(new BorderLayout()); //---- labelGPUUsage ---- labelGPUUsage.setText("0\\0"); labelGPUUsage.setHorizontalAlignment(SwingConstants.CENTER); panelGPU.add(labelGPUUsage, BorderLayout.SOUTH); } tabbedPane2.addTab("Usage", panelGPU); //======== panelGPUQueue ======== { panelGPUQueue.setLayout(new BorderLayout()); } tabbedPane2.addTab("Queue", panelGPUQueue); } //======== panel2 ======== { panel2.setLayout(new TableLayout(new double[][] { { TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); //---- label18 ---- label18.setText("Virtual Time"); panel2.add(label18, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(virtualTime, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label5 ---- label5.setText("Processi nel sistema"); panel2.add(label5, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- processiNelSistema ---- processiNelSistema.setText("0"); panel2.add(processiNelSistema, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label17 ---- label17.setText("Processi in elaborazione"); panel2.add(label17, new TableLayoutConstraints(0, 3, 0, 3, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- processiElaborazione ---- processiElaborazione.setText("0"); panel2.add(processiElaborazione, new TableLayoutConstraints(1, 3, 1, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label16 ---- label16.setText("Processi in coda"); panel2.add(label16, new TableLayoutConstraints(0, 4, 0, 4, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); //---- processiInCoda ---- processiInCoda.setText("0"); panel2.add(processiInCoda, new TableLayoutConstraints(1, 4, 1, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label15 ---- label15.setText("ldavg_1"); panel2.add(label15, new TableLayoutConstraints(0, 5, 0, 5, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(ldavg_1, new TableLayoutConstraints(1, 5, 1, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label19 ---- label19.setText("ldavg_5"); panel2.add(label19, new TableLayoutConstraints(0, 6, 0, 6, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(ldavg_5, new TableLayoutConstraints(1, 6, 1, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label20 ---- label20.setText("ldavg_15"); panel2.add(label20, new TableLayoutConstraints(0, 7, 0, 7, TableLayoutConstraints.RIGHT, TableLayoutConstraints.FULL)); panel2.add(ldavg_15, new TableLayoutConstraints(1, 7, 1, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } //======== panel3 ======== { panel3.setLayout(new TableLayout(new double[][] { { TableLayout.PREFERRED, TableLayout.PREFERRED }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); } GroupLayout panelPerformanceLayout = new GroupLayout(panelPerformance); panelPerformance.setLayout(panelPerformanceLayout); panelPerformanceLayout.setHorizontalGroup(panelPerformanceLayout.createParallelGroup() .addGroup(panelPerformanceLayout.createSequentialGroup().addContainerGap() .addGroup(panelPerformanceLayout.createParallelGroup() .addComponent(separator1) .addGroup(panelPerformanceLayout.createSequentialGroup() .addGroup(panelPerformanceLayout.createParallelGroup() .addGroup(panelPerformanceLayout .createSequentialGroup() .addComponent(panel2, GroupLayout.PREFERRED_SIZE, 256, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(panelPerformanceLayout .createParallelGroup() .addComponent(progressBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelPerformanceLayout .createSequentialGroup() .addComponent(panel3, GroupLayout.PREFERRED_SIZE, 256, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(panelPerformanceLayout .createSequentialGroup() .addComponent(tabbedPane1, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE))) .addContainerGap(8, Short.MAX_VALUE))))); panelPerformanceLayout.setVerticalGroup(panelPerformanceLayout.createParallelGroup() .addGroup(panelPerformanceLayout.createSequentialGroup() .addContainerGap(15, Short.MAX_VALUE) .addGroup(panelPerformanceLayout.createParallelGroup() .addComponent(tabbedPane2, GroupLayout.DEFAULT_SIZE, 218, GroupLayout.PREFERRED_SIZE) .addComponent(tabbedPane1, GroupLayout.PREFERRED_SIZE, 218, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(separator1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE) .addGroup(panelPerformanceLayout .createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(panel2, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE) .addGroup(panelPerformanceLayout.createSequentialGroup() .addComponent(progressBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18).addComponent(panel3, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); } hpssimTab.addTab("Performance", panelPerformance); //======== panelGraph ======== { //======== graphPanel ======== { graphPanel.setLayout(new TableLayout(new double[][] { { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, { 27, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 25, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); //---- label23 ---- label23.setText("Carico costante"); label23.setFont(label23.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label23, new TableLayoutConstraints(0, 0, 1, 0, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label38 ---- label38.setText("Classification Rate"); label38.setFont(label38.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label38, new TableLayoutConstraints(5, 0, 6, 0, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); graphPanel.add(text_ClassRate, new TableLayoutConstraints(7, 0, 7, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label24 ---- label24.setText("Coda\\Media"); graphPanel.add(label24, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CostanteCodaSuMedia ---- button_CostanteCodaSuMedia.setText("Esegui"); button_CostanteCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CostanteCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_CostanteCodaSuMedia, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label39 ---- label39.setText("Coda\\Media"); graphPanel.add(label39, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_ClassRateCodaSuMedia ---- button_ClassRateCodaSuMedia.setText("Esegui"); button_ClassRateCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_ClassRateCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_ClassRateCodaSuMedia, new TableLayoutConstraints(7, 1, 7, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label25 ---- label25.setText("Tempo Medio Arrivo"); graphPanel.add(label25, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CostanteTempoMedioArrivo ---- button_CostanteTempoMedioArrivo.setText("Esegui"); button_CostanteTempoMedioArrivo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CostanteTempoMedioArrivoActionPerformed(e); } }); graphPanel.add(button_CostanteTempoMedioArrivo, new TableLayoutConstraints(2, 2, 2, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); graphPanel.add(hSpacer1, new TableLayoutConstraints(3, 0, 3, 15, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label40 ---- label40.setText("Tempo Medio Arrivo"); graphPanel.add(label40, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_ClassRateTempoMedioArrivo ---- button_ClassRateTempoMedioArrivo.setText("Esegui"); button_ClassRateTempoMedioArrivo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_ClassRateTempoMedioArrivoActionPerformed(e); } }); graphPanel.add(button_ClassRateTempoMedioArrivo, new TableLayoutConstraints(7, 2, 7, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label26 ---- label26.setText("Troughput"); graphPanel.add(label26, new TableLayoutConstraints(0, 3, 0, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label41 ---- label41.setText("Troughput"); graphPanel.add(label41, new TableLayoutConstraints(5, 3, 5, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label27 ---- label27.setText("Carico"); graphPanel.add(label27, new TableLayoutConstraints(0, 4, 0, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label42 ---- label42.setText("Carico"); graphPanel.add(label42, new TableLayoutConstraints(5, 4, 5, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label28 ---- label28.setText("Carico Crescente"); label28.setFont(label28.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label28, new TableLayoutConstraints(0, 5, 1, 5, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label33 ---- label33.setText("Carico Burst"); label33.setFont(label33.getFont().deriveFont(Font.BOLD | Font.ITALIC)); graphPanel.add(label33, new TableLayoutConstraints(5, 5, 6, 5, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL)); //---- label29 ---- label29.setText("Coda\\Media"); graphPanel.add(label29, new TableLayoutConstraints(0, 6, 0, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label30 ---- label30.setText("Tempo Medio Arrivo"); graphPanel.add(label30, new TableLayoutConstraints(0, 7, 0, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label31 ---- label31.setText("Troughput"); graphPanel.add(label31, new TableLayoutConstraints(0, 8, 0, 8, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label32 ---- label32.setText("Carico"); graphPanel.add(label32, new TableLayoutConstraints(0, 9, 0, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CrescenteCodaSuMedia ---- button_CrescenteCodaSuMedia.setText("Esegui"); button_CrescenteCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CrescenteCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_CrescenteCodaSuMedia, new TableLayoutConstraints(2, 6, 2, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label34 ---- label34.setText("Coda\\Media"); graphPanel.add(label34, new TableLayoutConstraints(5, 6, 5, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_BurstCodaSuMedia ---- button_BurstCodaSuMedia.setText("Esegui"); button_BurstCodaSuMedia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_BurstCodaSuMediaActionPerformed(e); } }); graphPanel.add(button_BurstCodaSuMedia, new TableLayoutConstraints(7, 6, 7, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_CrescenteCarico ---- button_CrescenteCarico.setText("Esegui"); button_CrescenteCarico.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_CrescenteCaricoActionPerformed(e); } }); graphPanel.add(button_CrescenteCarico, new TableLayoutConstraints(2, 7, 2, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label35 ---- label35.setText("Tempo Medio Arrivo"); graphPanel.add(label35, new TableLayoutConstraints(5, 7, 5, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- button_BurstTempoMedioArrivo ---- button_BurstTempoMedioArrivo.setText("Esegui"); button_BurstTempoMedioArrivo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button_BurstTempoMedioArrivoActionPerformed(e); } }); graphPanel.add(button_BurstTempoMedioArrivo, new TableLayoutConstraints(7, 7, 7, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label36 ---- label36.setText("Troughput"); graphPanel.add(label36, new TableLayoutConstraints(5, 8, 5, 8, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label37 ---- label37.setText("Carico"); graphPanel.add(label37, new TableLayoutConstraints(5, 9, 5, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } //---- label22 ---- label22.setText("Grafici"); label22.setFont(label22.getFont().deriveFont(label22.getFont().getStyle() | Font.BOLD, label22.getFont().getSize() + 4f)); GroupLayout panelGraphLayout = new GroupLayout(panelGraph); panelGraph.setLayout(panelGraphLayout); panelGraphLayout.setHorizontalGroup(panelGraphLayout.createParallelGroup() .addGroup(panelGraphLayout.createSequentialGroup().addGroup(panelGraphLayout .createParallelGroup() .addGroup(panelGraphLayout.createSequentialGroup().addGap(243, 243, 243) .addComponent(label22).addGap(0, 246, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.TRAILING, panelGraphLayout.createSequentialGroup().addContainerGap() .addComponent(graphPanel, GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE))) .addContainerGap())); panelGraphLayout.setVerticalGroup(panelGraphLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, panelGraphLayout.createSequentialGroup().addContainerGap().addComponent(label22) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(graphPanel, GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE) .addContainerGap())); } hpssimTab.addTab("Graph", panelGraph); } hpssimWindow.add(hpssimTab); hpssimTab.setBounds(10, 40, 555, 450); //---- title1 ---- title1.setFont(title1.getFont().deriveFont(title1.getFont().getSize() + 8f)); hpssimWindow.add(title1); title1.setBounds(10, 11, 132, title1.getPreferredSize().height); //---- button1 ---- button1.setText("Stop"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); hpssimWindow.add(button1); button1.setBounds(385, 495, 74, button1.getPreferredSize().height); //---- okButton ---- okButton.setText("Start"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okButtonActionPerformed(e); } }); hpssimWindow.add(okButton); okButton.setBounds(470, 495, 74, okButton.getPreferredSize().height); //---- button3 ---- button3.setText("Resume"); button3.setVisible(false); button3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pauseActionPerformed(e); } }); hpssimWindow.add(button3); button3.setBounds(300, 495, 74, button3.getPreferredSize().height); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < hpssimWindow.getComponentCount(); i++) { Rectangle bounds = hpssimWindow.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = hpssimWindow.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; hpssimWindow.setMinimumSize(preferredSize); hpssimWindow.setPreferredSize(preferredSize); } } GroupLayout HPSsimWindowContentPaneLayout = new GroupLayout(HPSsimWindowContentPane); HPSsimWindowContentPane.setLayout(HPSsimWindowContentPaneLayout); HPSsimWindowContentPaneLayout.setHorizontalGroup(HPSsimWindowContentPaneLayout.createParallelGroup() .addGroup(HPSsimWindowContentPaneLayout.createSequentialGroup() .addComponent(hpssimWindow, GroupLayout.PREFERRED_SIZE, 565, GroupLayout.PREFERRED_SIZE) .addGap(0, 4, Short.MAX_VALUE))); HPSsimWindowContentPaneLayout.setVerticalGroup(HPSsimWindowContentPaneLayout.createParallelGroup() .addGroup(HPSsimWindowContentPaneLayout.createSequentialGroup() .addComponent(hpssimWindow, GroupLayout.PREFERRED_SIZE, 528, GroupLayout.PREFERRED_SIZE) .addGap(0, 1, Short.MAX_VALUE))); HPSsimWindow.pack(); HPSsimWindow.setLocationRelativeTo(HPSsimWindow.getOwner()); } //======== dialog1 ======== { dialog1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container dialog1ContentPane = dialog1.getContentPane(); //---- button2 ---- button2.setText("ok"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); //---- label13 ---- label13.setText("Attenzione!"); GroupLayout dialog1ContentPaneLayout = new GroupLayout(dialog1ContentPane); dialog1ContentPane.setLayout(dialog1ContentPaneLayout); dialog1ContentPaneLayout.setHorizontalGroup(dialog1ContentPaneLayout.createParallelGroup() .addGroup(dialog1ContentPaneLayout.createSequentialGroup().addContainerGap() .addGroup(dialog1ContentPaneLayout.createParallelGroup() .addComponent(label13, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.TRAILING, dialog1ContentPaneLayout.createSequentialGroup() .addGap(0, 281, Short.MAX_VALUE).addComponent(button2)) .addComponent(erroreLabel, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)) .addContainerGap())); dialog1ContentPaneLayout.setVerticalGroup(dialog1ContentPaneLayout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, dialog1ContentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(label13, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) .addComponent(erroreLabel, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button2) .addContainerGap())); dialog1.pack(); dialog1.setLocationRelativeTo(dialog1.getOwner()); } //======== Grafici ======== { Container GraficiContentPane = Grafici.getContentPane(); //======== panelGraficoFinestra ======== { // JFormDesigner evaluation mark panelGraficoFinestra.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), panelGraficoFinestra.getBorder())); panelGraficoFinestra.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); panelGraficoFinestra.setLayout(new BorderLayout()); } GroupLayout GraficiContentPaneLayout = new GroupLayout(GraficiContentPane); GraficiContentPane.setLayout(GraficiContentPaneLayout); GraficiContentPaneLayout.setHorizontalGroup(GraficiContentPaneLayout.createParallelGroup() .addGroup(GraficiContentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(panelGraficoFinestra, GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE) .addContainerGap())); GraficiContentPaneLayout.setVerticalGroup(GraficiContentPaneLayout.createParallelGroup() .addGroup(GraficiContentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(panelGraficoFinestra, GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE) .addContainerGap())); Grafici.pack(); Grafici.setLocationRelativeTo(Grafici.getOwner()); } // //GEN-END:initComponents }
From source file:org.esa.snap.rcp.statistics.ScatterPlotPanel.java
private JPanel createInputParameterPanel() { final PropertyDescriptor boxSizeDescriptor = bindingContext.getPropertySet() .getDescriptor(PROPERTY_NAME_BOX_SIZE); boxSizeDescriptor.setValueRange(new ValueRange(1, 101)); boxSizeDescriptor.setAttribute("stepSize", 2); boxSizeDescriptor.setValidator((property, value) -> { if (((Number) value).intValue() % 2 == 0) { throw new ValidationException("Only odd values allowed as box size."); }//from ww w. ja v a 2 s.c o m }); final JSpinner boxSizeSpinner = new JSpinner(); bindingContext.bind(PROPERTY_NAME_BOX_SIZE, boxSizeSpinner); final JPanel boxSizePanel = new JPanel(new BorderLayout(5, 3)); boxSizePanel.add(new JLabel("Box size:"), BorderLayout.WEST); boxSizePanel.add(boxSizeSpinner); correlativeFieldSelector = new CorrelativeFieldSelector(bindingContext); final JPanel pointDataSourcePanel = new JPanel(new BorderLayout(5, 3)); pointDataSourcePanel.add(correlativeFieldSelector.pointDataSourceLabel, BorderLayout.NORTH); pointDataSourcePanel.add(correlativeFieldSelector.pointDataSourceList); final JPanel pointDataFieldPanel = new JPanel(new BorderLayout(5, 3)); pointDataFieldPanel.add(correlativeFieldSelector.dataFieldLabel, BorderLayout.NORTH); pointDataFieldPanel.add(correlativeFieldSelector.dataFieldList); final JCheckBox xLogCheck = new JCheckBox("Log10 scaled"); bindingContext.bind(PROPERTY_NAME_X_AXIS_LOG_SCALED, xLogCheck); final JPanel xAxisOptionPanel = new JPanel(new BorderLayout()); xAxisOptionPanel.add(xAxisRangeControl.getPanel()); xAxisOptionPanel.add(xLogCheck, BorderLayout.SOUTH); final JCheckBox yLogCheck = new JCheckBox("Log10 scaled"); bindingContext.bind(PROPERTY_NAME_Y_AXIS_LOG_SCALED, yLogCheck); final JPanel yAxisOptionPanel = new JPanel(new BorderLayout()); yAxisOptionPanel.add(yAxisRangeControl.getPanel()); yAxisOptionPanel.add(yLogCheck, BorderLayout.SOUTH); final JCheckBox acceptableCheck = new JCheckBox("Show tolerance range"); JLabel fieldPrefix = new JLabel("+/-"); final JTextField acceptableField = new JTextField(); acceptableField.setPreferredSize(new Dimension(40, acceptableField.getPreferredSize().height)); acceptableField.setHorizontalAlignment(JTextField.RIGHT); final JLabel percentLabel = new JLabel(" %"); bindingContext.bind(PROPERTY_NAME_SHOW_ACCEPTABLE_DEVIATION, acceptableCheck); bindingContext.bind(PROPERTY_NAME_ACCEPTABLE_DEVIATION, acceptableField); bindingContext.getBinding(PROPERTY_NAME_ACCEPTABLE_DEVIATION).addComponent(percentLabel); bindingContext.getBinding(PROPERTY_NAME_ACCEPTABLE_DEVIATION).addComponent(fieldPrefix); bindingContext.bindEnabledState(PROPERTY_NAME_ACCEPTABLE_DEVIATION, true, PROPERTY_NAME_SHOW_ACCEPTABLE_DEVIATION, true); final JPanel confidencePanel = GridBagUtils.createPanel(); GridBagConstraints confidencePanelConstraints = GridBagUtils .createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=5,weighty=0,weightx=1"); GridBagUtils.addToPanel(confidencePanel, acceptableCheck, confidencePanelConstraints, "gridy=0,gridwidth=3"); GridBagUtils.addToPanel(confidencePanel, fieldPrefix, confidencePanelConstraints, "weightx=0,insets.left=22,gridy=1,gridx=0,insets.top=4,gridwidth=1"); GridBagUtils.addToPanel(confidencePanel, acceptableField, confidencePanelConstraints, "weightx=1,gridx=1,insets.left=2,insets.top=2"); GridBagUtils.addToPanel(confidencePanel, percentLabel, confidencePanelConstraints, "weightx=0,gridx=2,insets.left=0,insets.top=4"); final JCheckBox regressionCheck = new JCheckBox("Show regression line"); bindingContext.bind(PROPERTY_NAME_SHOW_REGRESSION_LINE, regressionCheck); // UI arrangement JPanel middlePanel = GridBagUtils.createPanel(); GridBagConstraints middlePanelConstraints = GridBagUtils .createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=6,weighty=0,weightx=1"); GridBagUtils.addToPanel(middlePanel, boxSizePanel, middlePanelConstraints, "gridy=0,insets.left=6"); GridBagUtils.addToPanel(middlePanel, pointDataSourcePanel, middlePanelConstraints, "gridy=1"); GridBagUtils.addToPanel(middlePanel, pointDataFieldPanel, middlePanelConstraints, "gridy=2"); GridBagUtils.addToPanel(middlePanel, xAxisOptionPanel, middlePanelConstraints, "gridy=3,insets.left=0"); GridBagUtils.addToPanel(middlePanel, yAxisOptionPanel, middlePanelConstraints, "gridy=4"); GridBagUtils.addToPanel(middlePanel, new JSeparator(), middlePanelConstraints, "gridy=5,insets.left=4"); GridBagUtils.addToPanel(middlePanel, confidencePanel, middlePanelConstraints, "gridy=6,fill=HORIZONTAL,insets.left=-4"); GridBagUtils.addToPanel(middlePanel, regressionCheck, middlePanelConstraints, "gridy=7,insets.left=-4,insets.top=8"); return middlePanel; }