List of usage examples for java.awt CardLayout CardLayout
public CardLayout()
From source file:com.all.login.view.CenterLoginPanel.java
private void initialize() { layout = new CardLayout(); this.setLayout(layout); this.add(getNewAccountFormPanel(), NEW_ACCOUNT_PANEL_NAME); this.add(getServerDownPanel(), SERVER_DOWN_PANEL_NAME); this.add(getConnectionErrorPanel(), CONNECTION_ERROR_PANEL_NAME); this.add(getForgotPasswordPanel(), FORGOT_PASSWORD_PANEL_NAME); this.add(getInvalidLoginPanel(), INVALID_LOGIN_PANEL_NAME); this.add(getLoaderLoginPanel(), LOADER_PANEL_NAME); this.add(getWrongEmailPanel(), WRONG_EMAIL_PANEL_NAME); this.add(getSuccessPanel(), PASSWORD_SENT_PANEL_NAME); this.add(getDuplicateEmailPanel(), DUPLICATE_EMAIL_PANEL_NAME); setListeners();/* ww w .ja v a 2s .c o m*/ }
From source file:VASSAL.launch.ModuleManagerWindow.java
public ModuleManagerWindow() { setTitle("VASSAL"); setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); ApplicationIcons.setFor(this); final AbstractAction shutDownAction = new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { if (!AbstractLaunchAction.shutDown()) return; final Prefs gl = Prefs.getGlobalPrefs(); try { gl.write();//w w w . j av a2 s . c o m gl.close(); } catch (IOException ex) { WriteErrorDialog.error(ex, gl.getFile()); } finally { IOUtils.closeQuietly(gl); } logger.info("Exiting"); System.exit(0); } }; shutDownAction.putValue(Action.NAME, Resources.getString(Resources.QUIT)); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { shutDownAction.actionPerformed(null); } }); // setup menubar and actions final MenuManager mm = MenuManager.getInstance(); final MenuBarProxy mb = mm.getMenuBarProxyFor(this); // file menu final MenuProxy fileMenu = new MenuProxy(Resources.getString("General.file")); fileMenu.setMnemonic(Resources.getString("General.file.shortcut").charAt(0)); fileMenu.add(mm.addKey("Main.play_module")); fileMenu.add(mm.addKey("Main.edit_module")); fileMenu.add(mm.addKey("Main.new_module")); fileMenu.add(mm.addKey("Main.import_module")); fileMenu.addSeparator(); if (!SystemUtils.IS_OS_MAC_OSX) { fileMenu.add(mm.addKey("Prefs.edit_preferences")); fileMenu.addSeparator(); fileMenu.add(mm.addKey("General.quit")); } // tools menu final MenuProxy toolsMenu = new MenuProxy(Resources.getString("General.tools")); // Initialize Global Preferences Prefs.getGlobalPrefs().getEditor().initDialog(this); Prefs.initSharedGlobalPrefs(); final BooleanConfigurer serverStatusConfig = new BooleanConfigurer(SHOW_STATUS_KEY, null, Boolean.FALSE); Prefs.getGlobalPrefs().addOption(null, serverStatusConfig); dividerLocationConfig = new IntConfigurer(DIVIDER_LOCATION_KEY, null, -10); Prefs.getGlobalPrefs().addOption(null, dividerLocationConfig); toolsMenu.add(new CheckBoxMenuItemProxy(new AbstractAction(Resources.getString("Chat.server_status")) { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { serverStatusView.toggleVisibility(); serverStatusConfig.setValue(serverStatusConfig.booleanValue() ? Boolean.FALSE : Boolean.TRUE); if (serverStatusView.isVisible()) { setDividerLocation(getPreferredDividerLocation()); } } }, serverStatusConfig.booleanValue())); // help menu final MenuProxy helpMenu = new MenuProxy(Resources.getString("General.help")); helpMenu.setMnemonic(Resources.getString("General.help.shortcut").charAt(0)); helpMenu.add(mm.addKey("General.help")); helpMenu.add(mm.addKey("Main.tour")); helpMenu.addSeparator(); helpMenu.add(mm.addKey("UpdateCheckAction.update_check")); helpMenu.add(mm.addKey("Help.error_log")); if (!SystemUtils.IS_OS_MAC_OSX) { helpMenu.addSeparator(); helpMenu.add(mm.addKey("AboutScreen.about_vassal")); } mb.add(fileMenu); mb.add(toolsMenu); mb.add(helpMenu); // add actions mm.addAction("Main.play_module", new Player.PromptLaunchAction(this)); mm.addAction("Main.edit_module", new Editor.PromptLaunchAction(this)); mm.addAction("Main.new_module", new Editor.NewModuleLaunchAction(this)); mm.addAction("Main.import_module", new Editor.PromptImportLaunchAction(this)); mm.addAction("Prefs.edit_preferences", Prefs.getGlobalPrefs().getEditor().getEditAction()); mm.addAction("General.quit", shutDownAction); URL url = null; try { url = new File(Documentation.getDocumentationBaseDir(), "README.html").toURI().toURL(); } catch (MalformedURLException e) { ErrorDialog.bug(e); } mm.addAction("General.help", new ShowHelpAction(url, null)); mm.addAction("Main.tour", new LaunchTourAction(this)); mm.addAction("AboutScreen.about_vassal", new AboutVASSALAction(this)); mm.addAction("UpdateCheckAction.update_check", new UpdateCheckAction(this)); mm.addAction("Help.error_log", new ShowErrorLogAction(this)); setJMenuBar(mm.getMenuBarFor(this)); // Load Icons moduleIcon = new ImageIcon(getClass().getResource("/images/mm-module.png")); activeExtensionIcon = new ImageIcon(getClass().getResource("/images/mm-extension-active.png")); inactiveExtensionIcon = new ImageIcon(getClass().getResource("/images/mm-extension-inactive.png")); openGameFolderIcon = new ImageIcon(getClass().getResource("/images/mm-gamefolder-open.png")); closedGameFolderIcon = new ImageIcon(getClass().getResource("/images/mm-gamefolder-closed.png")); fileIcon = new ImageIcon(getClass().getResource("/images/mm-file.png")); // build module controls final JPanel moduleControls = new JPanel(new BorderLayout()); modulePanelLayout = new CardLayout(); moduleView = new JPanel(modulePanelLayout); buildTree(); final JScrollPane scroll = new JScrollPane(tree); moduleView.add(scroll, "modules"); final JEditorPane l = new JEditorPane("text/html", Resources.getString("ModuleManager.quickstart")); l.setEditable(false); // Try to get background color and font from LookAndFeel; // otherwise, use dummy JLabel to get color and font. Color bg = UIManager.getColor("control"); Font font = UIManager.getFont("Label.font"); if (bg == null || font == null) { final JLabel dummy = new JLabel(); if (bg == null) bg = dummy.getBackground(); if (font == null) font = dummy.getFont(); } l.setBackground(bg); ((HTMLEditorKit) l.getEditorKit()).getStyleSheet() .addRule("body { font: " + font.getFamily() + " " + font.getSize() + "pt }"); l.addHyperlinkListener(BrowserSupport.getListener()); // FIXME: use MigLayout for this! // this is necessary to get proper vertical alignment final JPanel p = new JPanel(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; p.add(l, c); moduleView.add(p, "quickStart"); modulePanelLayout.show(moduleView, getModuleCount() == 0 ? "quickStart" : "modules"); moduleControls.add(moduleView, BorderLayout.CENTER); moduleControls.setBorder(new TitledBorder(Resources.getString("ModuleManager.recent_modules"))); add(moduleControls); // build server status controls final ServerStatusView serverStatusControls = new ServerStatusView(new CgiServerStatus()); serverStatusControls.setBorder(new TitledBorder(Resources.getString("Chat.server_status"))); serverStatusView = new ComponentSplitter().splitRight(moduleControls, serverStatusControls, false); serverStatusView.revalidate(); // show the server status controls according to the prefs if (serverStatusConfig.booleanValue()) { serverStatusView.showComponent(); } setDividerLocation(getPreferredDividerLocation()); serverStatusView.addPropertyChangeListener("dividerLocation", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { setPreferredDividerLocation((Integer) e.getNewValue()); } }); final Rectangle r = Info.getScreenBounds(this); serverStatusControls.setPreferredSize(new Dimension((int) (r.width / 3.5), 0)); setSize(3 * r.width / 4, 3 * r.height / 4); // Save/load the window position and size in prefs final PositionOption option = new PositionOption(PositionOption.key + "ModuleManager", this); Prefs.getGlobalPrefs().addOption(option); }
From source file:com.mirth.connect.client.ui.editors.filter.FilterPane.java
/** * This method is called from within the constructor to initialize the form. */// www . jav a 2 s .c om public void initComponents() { // the available panels (cards) rulePanel = new BasePanel(); blankPanel = new BasePanel(); scriptTextArea = new MirthRTextScrollPane(null, true, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, false); scriptTextArea.setBackground(new Color(204, 204, 204)); scriptTextArea.setBorder(BorderFactory.createEtchedBorder()); scriptTextArea.getTextArea().setEditable(false); scriptTextArea.getTextArea().setDropTarget(null); generatedScriptPanel = new JPanel(); generatedScriptPanel.setBackground(Color.white); generatedScriptPanel.setLayout(new CardLayout()); generatedScriptPanel.add(scriptTextArea, ""); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Rule", rulePanel); tabbedPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { switchTab = (lastSelectedIndex == 0 && tabbedPane.getSelectedIndex() == 1) ? true : false; updateCodePanel(null); } }); for (FilterRulePlugin filterRulePlugin : LoadedExtensions.getInstance().getFilterRulePlugins().values()) { filterRulePlugin.initialize(this); } // establish the cards to use in the Transformer rulePanel.addCard(blankPanel, BLANK_TYPE); for (FilterRulePlugin plugin : LoadedExtensions.getInstance().getFilterRulePlugins().values()) { rulePanel.addCard(plugin.getPanel(), plugin.getPluginPointName()); } filterTablePane = new JScrollPane(); viewTasks = new JXTaskPane(); viewTasks.setTitle("Mirth Views"); viewTasks.setFocusable(false); filterPopupMenu = new JPopupMenu(); viewTasks.add(initActionCallback("accept", "Return back to channel.", ActionFactory.createBoundAction("accept", "Back to Channel", "B"), new ImageIcon(Frame.class.getResource("images/resultset_previous.png")))); parent.setNonFocusable(viewTasks); viewTasks.setVisible(false); parent.taskPaneContainer.add(viewTasks, parent.taskPaneContainer.getComponentCount() - 1); filterTasks = new JXTaskPane(); filterTasks.setTitle("Filter Tasks"); filterTasks.setFocusable(false); // add new rule task filterTasks.add(initActionCallback("addNewRule", "Add a new filter rule.", ActionFactory.createBoundAction("addNewRule", "Add New Rule", "N"), new ImageIcon(Frame.class.getResource("images/add.png")))); JMenuItem addNewRule = new JMenuItem("Add New Rule"); addNewRule.setIcon(new ImageIcon(Frame.class.getResource("images/add.png"))); addNewRule.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addNewRule(); } }); filterPopupMenu.add(addNewRule); // delete rule task filterTasks.add(initActionCallback("deleteRule", "Delete the currently selected filter rule.", ActionFactory.createBoundAction("deleteRule", "Delete Rule", "X"), new ImageIcon(Frame.class.getResource("images/delete.png")))); JMenuItem deleteRule = new JMenuItem("Delete Rule"); deleteRule.setIcon(new ImageIcon(Frame.class.getResource("images/delete.png"))); deleteRule.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteRule(); } }); filterPopupMenu.add(deleteRule); filterTasks.add(initActionCallback("doImport", "Import a filter from an XML file.", ActionFactory.createBoundAction("doImport", "Import Filter", "I"), new ImageIcon(Frame.class.getResource("images/report_go.png")))); JMenuItem importFilter = new JMenuItem("Import Filter"); importFilter.setIcon(new ImageIcon(Frame.class.getResource("images/report_go.png"))); importFilter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doImport(); } }); filterPopupMenu.add(importFilter); filterTasks.add(initActionCallback("doExport", "Export the filter to an XML file.", ActionFactory.createBoundAction("doExport", "Export Filter", "E"), new ImageIcon(Frame.class.getResource("images/report_disk.png")))); JMenuItem exportFilter = new JMenuItem("Export Filter"); exportFilter.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png"))); exportFilter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doExport(); } }); filterPopupMenu.add(exportFilter); filterTasks.add(initActionCallback("doValidate", "Validate the currently viewed script.", ActionFactory.createBoundAction("doValidate", "Validate Script", "V"), new ImageIcon(Frame.class.getResource("images/accept.png")))); JMenuItem validateStep = new JMenuItem("Validate Script"); validateStep.setIcon(new ImageIcon(Frame.class.getResource("images/accept.png"))); validateStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doValidate(); } }); filterPopupMenu.add(validateStep); // move rule up task filterTasks.add(initActionCallback("moveRuleUp", "Move the currently selected rule up.", ActionFactory.createBoundAction("moveRuleUp", "Move Rule Up", "P"), new ImageIcon(Frame.class.getResource("images/arrow_up.png")))); JMenuItem moveRuleUp = new JMenuItem("Move Rule Up"); moveRuleUp.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_up.png"))); moveRuleUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveRuleUp(); } }); filterPopupMenu.add(moveRuleUp); // move rule down task filterTasks.add(initActionCallback("moveRuleDown", "Move the currently selected rule down.", ActionFactory.createBoundAction("moveRuleDown", "Move Rule Down", "D"), new ImageIcon(Frame.class.getResource("images/arrow_down.png")))); JMenuItem moveRuleDown = new JMenuItem("Move Rule Down"); moveRuleDown.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_down.png"))); moveRuleDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveRuleDown(); } }); filterPopupMenu.add(moveRuleDown); // add the tasks to the taskpane, and the taskpane to the mirth client parent.setNonFocusable(filterTasks); filterTasks.setVisible(false); parent.taskPaneContainer.add(filterTasks, parent.taskPaneContainer.getComponentCount() - 1); makeFilterTable(); // BGN LAYOUT filterTablePane.setBorder(BorderFactory.createEmptyBorder()); rulePanel.setBorder(BorderFactory.createEmptyBorder()); hSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, filterTablePane, tabbedPane); hSplitPane.setContinuousLayout(true); hSplitPane.setOneTouchExpandable(true); vSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hSplitPane, refPanel); vSplitPane.setContinuousLayout(true); vSplitPane.setOneTouchExpandable(true); this.setLayout(new BorderLayout()); this.add(vSplitPane, BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder()); vSplitPane.setBorder(BorderFactory.createEmptyBorder()); hSplitPane.setBorder(BorderFactory.createEmptyBorder()); resizePanes(); // END LAYOUT }
From source file:com.mirth.connect.client.ui.editors.transformer.TransformerPane.java
/** * This method is called from within the constructor to initialize the form. *//* w w w . j a v a 2s . c o m*/ public void initComponents() { // the available panels (cards) stepPanel = new BasePanel(); blankPanel = new BasePanel(); scriptTextArea = new MirthRTextScrollPane(null, true, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, false); scriptTextArea.setBackground(new Color(204, 204, 204)); scriptTextArea.setBorder(BorderFactory.createEtchedBorder()); scriptTextArea.getTextArea().setEditable(false); scriptTextArea.getTextArea().setDropTarget(null); generatedScriptPanel = new JPanel(); generatedScriptPanel.setBackground(Color.white); generatedScriptPanel.setLayout(new CardLayout()); generatedScriptPanel.add(scriptTextArea, ""); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Step", stepPanel); tabbedPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { switchTab = (lastSelectedIndex == 0 && tabbedPane.getSelectedIndex() == 1) ? true : false; updateCodePanel(null); } }); for (TransformerStepPlugin transformerStepPlugin : LoadedExtensions.getInstance() .getTransformerStepPlugins().values()) { transformerStepPlugin.initialize(this); } // establish the cards to use in the Transformer stepPanel.addCard(blankPanel, BLANK_TYPE); for (TransformerStepPlugin plugin : LoadedExtensions.getInstance().getTransformerStepPlugins().values()) { stepPanel.addCard(plugin.getPanel(), plugin.getPluginPointName()); } transformerTablePane = new JScrollPane(); transformerTablePane.setBorder(BorderFactory.createEmptyBorder()); viewTasks = new JXTaskPane(); viewTasks.setTitle("Mirth Views"); viewTasks.setFocusable(false); viewTasks.add(initActionCallback("accept", "Return back to channel.", ActionFactory.createBoundAction("accept", "Back to Channel", "B"), new ImageIcon(Frame.class.getResource("images/resultset_previous.png")))); parent.setNonFocusable(viewTasks); viewTasks.setVisible(false); parent.taskPaneContainer.add(viewTasks, parent.taskPaneContainer.getComponentCount() - 1); transformerTasks = new JXTaskPane(); transformerTasks.setTitle("Transformer Tasks"); transformerTasks.setFocusable(false); transformerPopupMenu = new JPopupMenu(); // add new step task transformerTasks.add(initActionCallback("addNewStep", "Add a new transformer step.", ActionFactory.createBoundAction("addNewStep", "Add New Step", "N"), new ImageIcon(Frame.class.getResource("images/add.png")))); JMenuItem addNewStep = new JMenuItem("Add New Step"); addNewStep.setIcon(new ImageIcon(Frame.class.getResource("images/add.png"))); addNewStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addNewStep(); } }); transformerPopupMenu.add(addNewStep); // delete step task transformerTasks.add(initActionCallback("deleteStep", "Delete the currently selected transformer step.", ActionFactory.createBoundAction("deleteStep", "Delete Step", "X"), new ImageIcon(Frame.class.getResource("images/delete.png")))); JMenuItem deleteStep = new JMenuItem("Delete Step"); deleteStep.setIcon(new ImageIcon(Frame.class.getResource("images/delete.png"))); deleteStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteStep(); } }); transformerPopupMenu.add(deleteStep); transformerTasks.add(initActionCallback("doImport", "Import a transformer from an XML file.", ActionFactory.createBoundAction("doImport", "Import Transformer", "I"), new ImageIcon(Frame.class.getResource("images/report_go.png")))); JMenuItem importTransformer = new JMenuItem("Import Transformer"); importTransformer.setIcon(new ImageIcon(Frame.class.getResource("images/report_go.png"))); importTransformer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doImport(); } }); transformerPopupMenu.add(importTransformer); transformerTasks.add(initActionCallback("doExport", "Export the transformer to an XML file.", ActionFactory.createBoundAction("doExport", "Export Transformer", "E"), new ImageIcon(Frame.class.getResource("images/report_disk.png")))); JMenuItem exportTransformer = new JMenuItem("Export Transformer"); exportTransformer.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png"))); exportTransformer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doExport(); } }); transformerPopupMenu.add(exportTransformer); transformerTasks.add(initActionCallback("doValidate", "Validate the currently viewed script.", ActionFactory.createBoundAction("doValidate", "Validate Script", "V"), new ImageIcon(Frame.class.getResource("images/accept.png")))); JMenuItem validateStep = new JMenuItem("Validate Script"); validateStep.setIcon(new ImageIcon(Frame.class.getResource("images/accept.png"))); validateStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doValidate(); } }); transformerPopupMenu.add(validateStep); // move step up task transformerTasks.add(initActionCallback("moveStepUp", "Move the currently selected step up.", ActionFactory.createBoundAction("moveStepUp", "Move Step Up", "P"), new ImageIcon(Frame.class.getResource("images/arrow_up.png")))); JMenuItem moveStepUp = new JMenuItem("Move Step Up"); moveStepUp.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_up.png"))); moveStepUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveStepUp(); } }); transformerPopupMenu.add(moveStepUp); // move step down task transformerTasks.add(initActionCallback("moveStepDown", "Move the currently selected step down.", ActionFactory.createBoundAction("moveStepDown", "Move Step Down", "D"), new ImageIcon(Frame.class.getResource("images/arrow_down.png")))); JMenuItem moveStepDown = new JMenuItem("Move Step Down"); moveStepDown.setIcon(new ImageIcon(Frame.class.getResource("images/arrow_down.png"))); moveStepDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { moveStepDown(); } }); transformerPopupMenu.add(moveStepDown); // add the tasks to the taskpane, and the taskpane to the mirth client parent.setNonFocusable(transformerTasks); transformerTasks.setVisible(false); parent.taskPaneContainer.add(transformerTasks, parent.taskPaneContainer.getComponentCount() - 1); makeTransformerTable(); // BGN LAYOUT transformerTable.setBorder(BorderFactory.createEmptyBorder()); transformerTablePane.setBorder(BorderFactory.createEmptyBorder()); transformerTablePane.setMinimumSize(new Dimension(0, 40)); stepPanel.setBorder(BorderFactory.createEmptyBorder()); hSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, transformerTablePane, tabbedPane); hSplitPane.setContinuousLayout(true); // hSplitPane.setDividerSize(6); hSplitPane.setOneTouchExpandable(true); vSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hSplitPane, refPanel); // vSplitPane.setDividerSize(6); vSplitPane.setOneTouchExpandable(true); vSplitPane.setContinuousLayout(true); hSplitPane.setBorder(BorderFactory.createEmptyBorder()); vSplitPane.setBorder(BorderFactory.createEmptyBorder()); this.setLayout(new BorderLayout()); this.add(vSplitPane, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder()); resizePanes(); // END LAYOUT }
From source file:edu.ku.brc.af.ui.forms.validation.ValFormattedTextField.java
/** * Creates the various UI Components for the formatter. *///w ww . j a va 2s .c o m protected void createUI() { CellConstraints cc = new CellConstraints(); if (isViewOnly || (formatter != null && !formatter.isUserInputNeeded() && fields != null && fields.size() == 1)) { viewtextField = new JTextField(); setControlSize(viewtextField); // Remove by rods 12/5/08 this messes thihngs up // values don't get inserted correctly, shouldn't be needed anyway //JFormattedDoc document = new JFormattedDoc(viewtextField, formatter, formatter.getFields().get(0)); //viewtextField.setDocument(document); //document.addDocumentListener(this); //documents.add(document); ViewFactory.changeTextFieldUIForDisplay(viewtextField, false); PanelBuilder builder = new PanelBuilder(new FormLayout("1px,f:p:g,1px", "1px,f:p:g,1px"), this); builder.add(viewtextField, cc.xy(2, 2)); bgColor = viewtextField.getBackground(); } else { JTextField txt = new JTextField(); Font txtFont = txt.getFont(); Font font = new Font("Courier", Font.PLAIN, txtFont.getSize()); BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); Graphics2D g = bi.createGraphics(); g.setFont(font); FontMetrics fm = g.getFontMetrics(font); g.dispose(); Insets ins = txt.getBorder().getBorderInsets(txt); int baseWidth = ins.left + ins.right; bgColor = txt.getBackground(); StringBuilder sb = new StringBuilder("1px"); for (UIFieldFormatterField f : fields) { sb.append(","); if (f.getType() == FieldType.separator || f.getType() == FieldType.constant) { sb.append('p'); } else { sb.append(((fm.getMaxAdvance() * f.getSize()) + baseWidth) + "px"); } } sb.append(",1px"); PanelBuilder builder = new PanelBuilder(new FormLayout(sb.toString(), "1px,P:G,1px"), this); comps = new JComponent[fields.size()]; int inx = 0; for (UIFieldFormatterField f : fields) { JComponent comp = null; JComponent tfToAdd = null; if (f.getType() == FieldType.separator || f.getType() == FieldType.constant) { comp = createLabel(f.getValue()); if (f.getType() == FieldType.constant) { comp.setBackground(Color.WHITE); comp.setOpaque(true); } tfToAdd = comp; } else { JTextField tf = new BGTextField(f.getSize(), isViewOnly ? "" : f.getValue()); tfToAdd = tf; if (inx == 0) { tf.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { checkForPaste(e); } }); } JFormattedDoc document = new JFormattedDoc(tf, formatter, f); tf.setDocument(document); document.addDocumentListener(new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { isChanged = true; if (!shouldIgnoreNotifyDoc) { String fldStr = getText(); int len = StringUtils.isNotEmpty(fldStr) ? fldStr.length() : 0; if (formatter != null && len > 0 && formatter.isLengthOK(len)) { setState(formatter.isValid(fldStr) ? UIValidatable.ErrorType.Valid : UIValidatable.ErrorType.Error); repaint(); } //validateState(); if (changeListener != null) { changeListener.stateChanged(new ChangeEvent(this)); } if (documentListeners != null) { for (DocumentListener dl : documentListeners) { dl.changedUpdate(null); } } } currCachedValue = null; } }); documents.add(document); addFocusAdapter(tf); comp = tf; comp.setFont(font); if (f.isIncrementer()) { editTF = tf; cardLayout = new CardLayout(); cardPanel = new JPanel(cardLayout); cardPanel.add("edit", tf); viewTF = new BGTextField(f.getSize(), isViewOnly ? "" : f.getValue()); viewTF.setDocument(document); cardPanel.add("view", viewTF); cardLayout.show(cardPanel, "view"); comp = cardPanel; tfToAdd = cardPanel; } } setControlSize(tfToAdd); builder.add(comp, cc.xy(inx + 2, 2)); comps[inx] = tfToAdd; inx++; } } }
From source file:com.xilinx.ultrascale.gui.MainScreen_video.java
public void configureScreen(int mode, LandingPage lp) { // System.out.println("got in main screen configuration"); this.lp = lp; screenMode = mode;//from ww w. j av a 2 s . c o m testStarted = false; if (Develop.production == 1) { di = null; di = new DriverInfo(); if (mode == 2) { di.init(mode, 1); } else { di.init(mode, 2); } // System.out.println("reading bar info"); int ret = di.get_PCIstate(); ret = di.getBarInfo(); // System.out.println("read bar info"); // fill pcie data if (mode != 6) { //ie., not a control plane pciemodel = new MyTableModel(di.getPCIInfo().getPCIData(), pcieColumnNames); pcieSysmontable.setModel(pciemodel); hostCredits = new MyTableModel(di.getPCIInfo().getHostedData(), pcieColumnNames); hostsysmontable.setModel(hostCredits); } else { pciemodel = new MyTableModel(di.getPCIInfo().getPCIDataForCP(), pcieColumnNames); pcieSysmontable.setModel(pciemodel); hostCredits = new MyTableModel(di.getPCIInfo().getHostedDataForCP(), pcieColumnNames); hostsysmontable.setModel(hostCredits); // changing the title of the panel of host credits. // System.out.println("pcie infor read"); } testMode = DriverInfo.CHECKER; // initialize max packet size //ret = di.get_EngineState(); //EngState[] engData = di.getEngState(); if (screenMode == 6) { epInfo = di.getEndPointInfo(); } // System.out.println("end point infor"); } // System.out.println("moving in switch"); // maxSize = engData[0].MaxPktSize; // sizeTextField.setText(String.valueOf(maxSize)); switch (mode) { case 0://acc_perf_gen_check // No change in heading //hide all leds. ddricon.setVisible(false); DDR4label.setVisible(false); phy0icon.setVisible(false); phy0label.setVisible(false); phy1icon.setVisible(false); phty1label.setVisible(false); headinglable.setText("AXI-MM Dataplane : Performance Mode (GEN-CHK)"); messageLog.append("AXI-MM Dataplane : PCIe Performance Demo\n"); // updating block diagram blockdiagramlbl.setIcon( new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/BlockDiagram_pcie.jpg"))); // resize message log. // jPanel4.setPreferredSize(new Dimension(jPanel4.getWidth(), 140)); // jPanel4.setSize(new Dimension(jPanel4.getWidth(), 140)); // jPanel4.revalidate(); // jPanel4.repaint(); // DataPathPanelForOneDP.revalidate(); break; case 1: {//acc_perf_gen_check_ddr //hide all leds. // jLabel1.setVisible(false); // jLabel2.setVisible(false); phy0icon.setVisible(false); phy0label.setVisible(false); phy1icon.setVisible(false); phty1label.setVisible(false); // tabbedPanel.remove(statusPanel); headinglable.setText("AXI-MM Dataplane : Performance Mode (PCIe-DMA-DDR4)"); blockdiagramlbl.setIcon( new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/BlockDiagram_ddr.jpg"))); int ret = di.get_LedStats(); LedStats lstats = di.getLedStats(); ddrledState = lstats.ddrCalib1; if (lstats.ddrCalib1 == 0) { ddricon.setIcon(new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/gray.png"))); } else { ddricon.setIcon(new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/green.png"))); } // resize message log. // jPanel4.setPreferredSize(new Dimension(jPanel4.getWidth(), 130)); // jPanel4.setSize(new Dimension(jPanel4.getWidth(), 130)); // jPanel4.revalidate(); // jPanel4.repaint(); // DataPathPanelForOneDP.revalidate(); // renaming hw generator and checker CheckerChcekBox.setText("System to Card"); GeneratorCheckbox.setText("Card to System"); messageLog.append("AXI-MM Dataplane : Performance Mode (PCIe-DMA-DDR4)\n"); } break; case 2: {//acc_application //hide all leds. sysout("will load configuration"); phy0icon.setVisible(false); phy0label.setVisible(false); phy1icon.setVisible(false); phty1label.setVisible(false); blockdiagramlbl.setIcon( new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/BlockDiagram_video_acc.jpg"))); int ret = di.get_LedStats(); LedStats lstats = di.getLedStats(); ddrledState = lstats.ddrCalib1; if (lstats.ddrCalib1 == 0) { ddricon.setIcon(new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/gray.png"))); } else { ddricon.setIcon(new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/green.png"))); } headinglable.setText("AXI-MM Dataplane : Video Accelerator Mode"); messageLog2.append("AXI-MM Dataplane : Video Accelerator Mode\n"); tabbedPanel.remove(statusPanel); sysout("loaded configuration"); } break; case 3://ethernet_perf_raw ddricon.setVisible(false); DDR4label.setVisible(false); jCheckBox2.setEnabled(false); jCheckBox3.setEnabled(false); jCheckBox5.setEnabled(false); jCheckBox6.setEnabled(false); headinglable.setText("AXI4 Stream Dataplane : Performance mode (Raw Ethernet)"); break; case 7://ethernet_perf_gen_check ddricon.setVisible(false); DDR4label.setVisible(false); phy0icon.setVisible(false); phy0label.setVisible(false); phy1icon.setVisible(false); phty1label.setVisible(false); headinglable.setText("AXI4 Stream Dataplane : Performance mode (GEN/CHK)"); tabbedPanel.remove(sysmonpanel); tabbedPanel.setLayout(new CardLayout()); blockdiagramlbl.setIcon( new ImageIcon(getClass().getResource("/com/xilinx/ultrascale/gui/BlockDiagram_Eth_GC.jpg"))); messageLog1.append("AXI Stream Dataplane : Performance mode (GEN-CHK)\n"); break; case 4://ethernet_app headinglable.setText("AXI4 Stream Dataplane : Application Mode"); // disabling the controls. ddricon.setVisible(false); DDR4label.setVisible(false); jCheckBox1.setEnabled(false); jCheckBox2.setEnabled(false); jCheckBox3.setEnabled(false); jCheckBox4.setEnabled(false); jCheckBox5.setEnabled(false); jCheckBox6.setEnabled(false); jButton2.setEnabled(false); jButton3.setEnabled(false); break; case 6://control_plane // Set combobox values barComboBoxTop.removeAllItems(); barComboBoxTop1.removeAllItems(); barComboBoxbottom.removeAllItems(); if (epInfo.designMode == 0) { barComboBoxTop.addItem("Bar2"); barComboBoxTop1.addItem("Bar2"); barComboBoxbottom.addItem("Bar2"); } else if (epInfo.designMode == 1) { barComboBoxTop.addItem("Bar4"); barComboBoxTop1.addItem("Bar4"); barComboBoxbottom.addItem("Bar4"); } else if (epInfo.designMode == 2) { barComboBoxTop.addItem("Bar2"); barComboBoxTop1.addItem("Bar2"); barComboBoxbottom.addItem("Bar2"); barComboBoxTop.addItem("Bar4"); barComboBoxTop1.addItem("Bar4"); barComboBoxbottom.addItem("Bar4"); } ddricon.setVisible(false); DDR4label.setVisible(false); phy0icon.setVisible(false); phy0label.setVisible(false); phy1icon.setVisible(false); phty1label.setVisible(false); tabbedPanel.remove(PerformancePlotTab); tabbedPanel.remove(statusPanel); headinglable.setText("Control Plane"); this.setSize(this.getSize().width + 40, 610); jPanel1.setPreferredSize(new Dimension(279, 600));// jPanel1.setSize(279, 600); jPanel1.add(PcieEndStatuspanel); jPanel1.add(hostCreditsPanel); // pcieSysmontable.setPreferredSize(new Dimension(250, 300)); pcieSysmontable.getColumnModel().getColumn(1).setPreferredWidth(10); PcieEndStatuspanel.setSize(jPanel1.getSize().width, jPanel1.getSize().height - 365); PcieEndStatuspanel.setLocation(new Point(0, 0)); hostCreditsPanel.setSize(jPanel1.getSize().width, jPanel1.getSize().height - 340); hostCreditsPanel.setLocation(new Point(0, 250)); ((javax.swing.border.TitledBorder) hostCreditsPanel.getBorder()).setTitle("Endpoint BAR Information"); jPanel1.repaint(); jPanel1.revalidate(); // PcieEndStatuspanel.repaint(); // PcieEndStatuspanel.revalidate(); //TabelModel.getColoum(1).setsize(); PowerPanel.setPreferredSize(new Dimension(300, 445)); PowerPanel.revalidate(); PowerPanel.repaint(); /*MyTableModel tblModel = new MyTableModel(dummydata, pcieEndptClm); pcieSysmontable.setModel(tblModel); tblModel.setData(dataForPCIEDummy, dmaColumnNames0); tblModel.fireTableDataChanged();*/ MyTableModel tblModel1 = new MyTableModel(dummydata, hostPcie); hostsysmontable.setModel(tblModel1); tblModel1.setData(epInfo.getBarStats(), hostPcie); tblModel1.fireTableDataChanged(); MyCellRenderer renderer = new MyCellRenderer(); barDumpModel = new MyTableModel(bardumpDummy, bardumpNames); bardump.setModel(barDumpModel); bardump.getColumnModel().getColumn(0).setCellRenderer(renderer); bardump.getTableHeader().setReorderingAllowed(false); tabbedPanel.setLayout(new CardLayout()); break; } alignmentsOfTables(); }
From source file:mt.listeners.InteractiveRANSAC.java
public void CardTable() { this.lambdaSB = new Scrollbar(Scrollbar.HORIZONTAL, this.lambdaInt, 1, MIN_SLIDER, MAX_SLIDER + 1); maxSlopeSB.setValue(utility.Slicer.computeScrollbarPositionFromValue((float) maxSlope, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize)); maxDistSB.setValue(//ww w. j a va2s.c o m utility.Slicer.computeScrollbarPositionFromValue(maxDist, MIN_Gap, MAX_Gap, scrollbarSize)); minInliersSB.setValue(utility.Slicer.computeScrollbarPositionFromValue(minInliers, MIN_Inlier, MAX_Inlier, scrollbarSize)); maxErrorSB.setValue( utility.Slicer.computeScrollbarPositionFromValue(maxError, MIN_ERROR, MAX_ERROR, scrollbarSize)); minSlopeSB.setValue(utility.Slicer.computeScrollbarPositionFromValue((float) minSlope, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize)); lambdaLabel = new Label("Linearity (fraction) = " + new DecimalFormat("#.##").format(lambda), Label.CENTER); maxErrorLabel = new Label("Maximum Error (px) = " + new DecimalFormat("#.##").format(maxError) + " ", Label.CENTER); minInliersLabel = new Label( "Minimum No. of timepoints (tp) = " + new DecimalFormat("#.##").format(minInliers), Label.CENTER); maxDistLabel = new Label("Maximum Gap (tp) = " + new DecimalFormat("#.##").format(maxDist), Label.CENTER); minSlopeLabel = new Label("Min. Segment Slope (px/tp) = " + new DecimalFormat("#.##").format(minSlope), Label.CENTER); maxSlopeLabel = new Label("Max. Segment Slope (px/tp) = " + new DecimalFormat("#.##").format(maxSlope), Label.CENTER); maxResLabel = new Label( "MT is rescued if the start of event# i + 1 > start of event# i by px = " + this.restolerance, Label.CENTER); CardLayout cl = new CardLayout(); Object[] colnames = new Object[] { "Track File", "Growth velocity", "Shrink velocity", "Growth events", "Shrink events", "fcat", "fres", "Error" }; Object[][] rowvalues = new Object[0][colnames.length]; if (inputfiles != null) { rowvalues = new Object[inputfiles.length][colnames.length]; for (int i = 0; i < inputfiles.length; ++i) { rowvalues[i][0] = inputfiles[i].getName(); } } table = new JTable(rowvalues, colnames); table.setFillsViewportHeight(true); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.isOpaque(); int size = 100; table.getColumnModel().getColumn(0).setPreferredWidth(size); table.getColumnModel().getColumn(1).setPreferredWidth(size); table.getColumnModel().getColumn(2).setPreferredWidth(size); table.getColumnModel().getColumn(3).setPreferredWidth(size); table.getColumnModel().getColumn(4).setPreferredWidth(size); table.getColumnModel().getColumn(5).setPreferredWidth(size); table.getColumnModel().getColumn(6).setPreferredWidth(size); table.getColumnModel().getColumn(7).setPreferredWidth(size); maxErrorField = new TextField(5); maxErrorField.setText(Float.toString(maxError)); minInlierField = new TextField(5); minInlierField.setText(Float.toString(minInliers)); maxGapField = new TextField(5); maxGapField.setText(Float.toString(maxDist)); maxSlopeField = new TextField(5); maxSlopeField.setText(Float.toString(maxSlope)); minSlopeField = new TextField(5); minSlopeField.setText(Float.toString(minSlope)); maxErrorSB.setSize(new Dimension(SizeX, 20)); minSlopeSB.setSize(new Dimension(SizeX, 20)); minInliersSB.setSize(new Dimension(SizeX, 20)); maxDistSB.setSize(new Dimension(SizeX, 20)); maxSlopeSB.setSize(new Dimension(SizeX, 20)); maxErrorField.setSize(new Dimension(SizeX, 20)); minInlierField.setSize(new Dimension(SizeX, 20)); maxGapField.setSize(new Dimension(SizeX, 20)); minSlopeField.setSize(new Dimension(SizeX, 20)); maxSlopeField.setSize(new Dimension(SizeX, 20)); scrollPane = new JScrollPane(table); scrollPane.setMinimumSize(new Dimension(300, 200)); scrollPane.setPreferredSize(new Dimension(300, 200)); scrollPane.getViewport().add(table); scrollPane.setAutoscrolls(true); // Location panelFirst.setLayout(layout); panelSecond.setLayout(layout); PanelSavetoFile.setLayout(layout); PanelParameteroptions.setLayout(layout); Panelfunction.setLayout(layout); Panelslope.setLayout(layout); PanelCompileRes.setLayout(layout); PanelDirectory.setLayout(layout); panelCont.setLayout(cl); panelCont.add(panelFirst, "1"); panelCont.add(panelSecond, "2"); panelFirst.setName("Ransac fits for rates and frequency analysis"); c.insets = new Insets(5, 5, 5, 5); c.anchor = GridBagConstraints.BOTH; c.ipadx = 35; inputLabelT = new Label("Compute length distribution at time: "); inputLabelTcont = new Label("(Press Enter to start computation) "); inputFieldT = new TextField(5); inputFieldT.setText("1"); c.gridwidth = 10; c.gridheight = 10; c.gridy = 1; c.gridx = 0; String[] Method = { "Linear Function only", "Linearized Quadratic function", "Linearized Cubic function" }; JComboBox<String> ChooseMethod = new JComboBox<String>(Method); final Checkbox findCatastrophe = new Checkbox("Detect Catastrophies", this.detectCatastrophe); final Checkbox findmanualCatastrophe = new Checkbox("Detect Catastrophies without fit", this.detectmanualCatastrophe); final Scrollbar minCatDist = new Scrollbar(Scrollbar.HORIZONTAL, this.minDistCatInt, 1, MIN_SLIDER, MAX_SLIDER + 1); final Scrollbar maxRes = new Scrollbar(Scrollbar.HORIZONTAL, this.restoleranceInt, 1, MIN_SLIDER, MAX_SLIDER + 1); final Label minCatDistLabel = new Label("Min. Catastrophy height (tp) = " + this.minDistanceCatastrophe, Label.CENTER); final Button done = new Button("Done"); final Button batch = new Button("Save Parameters for Batch run"); final Button cancel = new Button("Cancel"); final Button Compile = new Button("Compute rates and freq. till current file"); final Button AutoCompile = new Button("Auto Compute Velocity and Frequencies"); final Button Measureserial = new Button("Select directory of MTrack generated files"); final Button WriteLength = new Button("Compute length distribution at framenumber : "); final Button WriteStats = new Button("Compute lifetime and mean length distribution"); final Button WriteAgain = new Button("Save Velocity and Frequencies to File"); PanelDirectory.add(Measureserial, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelDirectory.add(scrollPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelDirectory.setBorder(selectdirectory); PanelDirectory.setPreferredSize(new Dimension(SizeX, SizeY)); panelFirst.add(PanelDirectory, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomaxerror = new SliderBoxGUI(errorstring, maxErrorSB, maxErrorField, maxErrorLabel, scrollbarSize, maxError, MAX_ERROR); PanelParameteroptions.add(combomaxerror.BuildDisplay(), new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomininlier = new SliderBoxGUI(inlierstring, minInliersSB, minInlierField, minInliersLabel, scrollbarSize, minInliers, MAX_Inlier); PanelParameteroptions.add(combomininlier.BuildDisplay(), new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomaxdist = new SliderBoxGUI(maxgapstring, maxDistSB, maxGapField, maxDistLabel, scrollbarSize, maxDist, MAX_Gap); PanelParameteroptions.add(combomaxdist.BuildDisplay(), new GridBagConstraints(0, 3, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.add(ChooseMethod, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.add(lambdaSB, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.add(lambdaLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.setPreferredSize(new Dimension(SizeX, SizeY)); PanelParameteroptions.setBorder(selectparam); panelFirst.add(PanelParameteroptions, new GridBagConstraints(3, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combominslope = new SliderBoxGUI(minslopestring, minSlopeSB, minSlopeField, minSlopeLabel, scrollbarSize, (float) minSlope, (float) MAX_ABS_SLOPE); Panelslope.add(combominslope.BuildDisplay(), new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomaxslope = new SliderBoxGUI(maxslopestring, maxSlopeSB, maxSlopeField, maxSlopeLabel, scrollbarSize, (float) maxSlope, (float) MAX_ABS_SLOPE); Panelslope.add(combomaxslope.BuildDisplay(), new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(findCatastrophe, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(findmanualCatastrophe, new GridBagConstraints(4, 4, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(minCatDist, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(minCatDistLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.setBorder(selectslope); Panelslope.setPreferredSize(new Dimension(SizeX, SizeY)); panelFirst.add(Panelslope, new GridBagConstraints(3, 1, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(AutoCompile, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(WriteLength, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(inputFieldT, new GridBagConstraints(3, 1, 3, 1, 0.1, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(WriteStats, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.setPreferredSize(new Dimension(SizeX, SizeY)); PanelCompileRes.setBorder(compileres); panelFirst.add(PanelCompileRes, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); if (inputfiles != null) { table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 1) { if (!jFreeChartFrame.isVisible()) jFreeChartFrame = Tracking.display(chart, new Dimension(500, 500)); JTable target = (JTable) e.getSource(); row = target.getSelectedRow(); // do some action if appropriate column if (row > 0) displayclicked(row); else displayclicked(0); } } }); } maxErrorSB.addAdjustmentListener(new ErrorListener(this, maxErrorLabel, errorstring, MIN_ERROR, MAX_ERROR, scrollbarSize, maxErrorSB)); minInliersSB.addAdjustmentListener(new MinInlierListener(this, minInliersLabel, inlierstring, MIN_Inlier, MAX_Inlier, scrollbarSize, minInliersSB)); maxDistSB.addAdjustmentListener( new MaxDistListener(this, maxDistLabel, maxgapstring, MIN_Gap, MAX_Gap, scrollbarSize, maxDistSB)); ChooseMethod.addActionListener(new FunctionItemListener(this, ChooseMethod)); lambdaSB.addAdjustmentListener(new LambdaListener(this, lambdaLabel, lambdaSB)); minSlopeSB.addAdjustmentListener(new MinSlopeListener(this, minSlopeLabel, minslopestring, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize, minSlopeSB)); maxSlopeSB.addAdjustmentListener(new MaxSlopeListener(this, maxSlopeLabel, maxslopestring, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize, maxSlopeSB)); findCatastrophe.addItemListener( new CatastrophyCheckBoxListener(this, findCatastrophe, minCatDistLabel, minCatDist)); findmanualCatastrophe.addItemListener( new ManualCatastrophyCheckBoxListener(this, findmanualCatastrophe, minCatDistLabel, minCatDist)); minCatDist.addAdjustmentListener(new MinCatastrophyDistanceListener(this, minCatDistLabel, minCatDist)); Measureserial.addActionListener(new MeasureserialListener(this)); Compile.addActionListener(new CompileResultsListener(this)); AutoCompile.addActionListener(new AutoCompileResultsListener(this)); WriteLength.addActionListener(new WriteLengthListener(this)); WriteStats.addActionListener(new WriteStatsListener(this)); WriteAgain.addActionListener(new WriteRatesListener(this)); done.addActionListener(new FinishButtonListener(this, false)); batch.addActionListener(new RansacBatchmodeListener(this)); cancel.addActionListener(new FinishButtonListener(this, true)); inputFieldT.addTextListener(new LengthdistroListener(this)); maxSlopeField.addTextListener(new MaxSlopeLocListener(this, false)); minSlopeField.addTextListener(new MinSlopeLocListener(this, false)); maxErrorField.addTextListener(new ErrorLocListener(this, false)); minInlierField.addTextListener(new MinInlierLocListener(this, false)); maxGapField.addTextListener(new MaxDistLocListener(this, false)); panelFirst.setVisible(true); functionChoice = 0; cl.show(panelCont, "1"); Cardframe.add(panelCont, BorderLayout.CENTER); setFunction(); Cardframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Cardframe.pack(); Cardframe.setVisible(true); Cardframe.pack(); }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes centralPanel//from www . j a va 2 s . c om * * @return javax.swing.JPanel */ private JPanel getCentralPanel() { if (centralPanel == null) { centralPanel = new JPanel(); centralPanel.setLayout(new CardLayout()); centralPanel.add(getPanelCommandSelection(), "commandList"); centralPanel.add(getPanelFileContents(), "fileEdition"); centralPanel.add(getPanelProgramDestination(), "programDestination"); } return centralPanel; }
From source file:org.datacleaner.windows.AnalysisJobBuilderWindowImpl.java
@Inject protected AnalysisJobBuilderWindowImpl(DataCleanerConfiguration configuration, WindowContext windowContext, SchemaTreePanel schemaTreePanel, AnalysisJobBuilder analysisJobBuilder, DCModule dcModule, UserPreferences userPreferences, @Nullable @JobFile FileObject jobFilename, Provider<NewAnalysisJobActionListener> newAnalysisJobActionListenerProvider, Provider<OpenAnalysisJobActionListener> openAnalysisJobActionListenerProvider, Provider<SaveAnalysisJobActionListener> saveAnalysisJobActionListenerProvider, Provider<ReferenceDataDialog> referenceDataDialogProvider, UsageLogger usageLogger, Provider<OptionsDialog> optionsDialogProvider, Provider<MonitorConnectionDialog> monitorConnectionDialogProvider, OpenAnalysisJobActionListener openAnalysisJobActionListener, DatabaseDriverCatalog databaseDriverCatalog) { super(windowContext); _jobFilename = jobFilename;//from w w w .j ava2 s.c o m _configuration = configuration; _dcModule = dcModule; _newAnalysisJobActionListenerProvider = newAnalysisJobActionListenerProvider; _openAnalysisJobActionListenerProvider = openAnalysisJobActionListenerProvider; _saveAnalysisJobActionListenerProvider = saveAnalysisJobActionListenerProvider; _referenceDataDialogProvider = referenceDataDialogProvider; _monitorConnectionDialogProvider = monitorConnectionDialogProvider; _optionsDialogProvider = optionsDialogProvider; _userPreferences = userPreferences; _usageLogger = usageLogger; _windowSizePreference = new WindowSizePreferences(_userPreferences, getClass(), DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); if (analysisJobBuilder == null) { _analysisJobBuilder = new AnalysisJobBuilder(_configuration); } else { _analysisJobBuilder = analysisJobBuilder; DatastoreConnection con = _analysisJobBuilder.getDatastoreConnection(); if (con != null) { _datastore = con.getDatastore(); } } _datastoreSelectionEnabled = true; _presenterRendererFactory = new RendererFactory(configuration); _glassPane = new DCGlassPane(this); _graph = new JobGraph(windowContext, userPreferences, analysisJobBuilder, _presenterRendererFactory, usageLogger); _analysisJobChangeListener.onActivation(_analysisJobBuilder); _saveButton = createToolbarButton("Save", IconUtils.ACTION_SAVE_BRIGHT); _saveAsButton = createToolbarButton("Save As...", IconUtils.ACTION_SAVE_BRIGHT); _executeButton = createToolbarButton("Execute", IconUtils.MENU_EXECUTE); _executionAlternativesButton = createToolbarButton("\uf0d7", null); _executionAlternativesButton.setFont(WidgetUtils.FONT_FONTAWESOME); _welcomePanel = new WelcomePanel(this, _userPreferences, _openAnalysisJobActionListenerProvider.get(), _dcModule); _datastoreManagementPanel = new DatastoreManagementPanel(_configuration, this, _glassPane, _optionsDialogProvider, _dcModule, databaseDriverCatalog, _userPreferences); _selectDatastorePanel = new SelectDatastoreContainerPanel(this, _dcModule, databaseDriverCatalog, (MutableDatastoreCatalog) configuration.getDatastoreCatalog(), _userPreferences); _editingContentView = new DCPanel(); _editingContentView.setLayout(new BorderLayout()); _contentContainerPanel = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); _contentContainerPanel.setLayout(new CardLayout()); _contentContainerPanel.add(_welcomePanel, AnalysisWindowPanelType.WELCOME.getName()); _contentContainerPanel.add(_editingContentView, AnalysisWindowPanelType.EDITING_CONTEXT.getName()); _contentContainerPanel.add(_datastoreManagementPanel, AnalysisWindowPanelType.MANAGE_DS.getName()); _contentContainerPanel.add(_selectDatastorePanel, AnalysisWindowPanelType.SELECT_DS.getName()); final boolean graphPreferred = isGraphPreferred(); if (graphPreferred) { setEditingViewGraph(); } else { setEditingViewClassic(); } _classicViewButton = createViewToggleButton("Classic view", "images/actions/editing-view-classic.png"); _classicViewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setEditingViewClassic(); } }); _classicViewButton.setSelected(!graphPreferred); _graphViewButton = createViewToggleButton("Graph view", "images/actions/editing-view-graph.png"); _graphViewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setEditingViewGraph(); } }); _graphViewButton.setSelected(graphPreferred); final ActionListener viewToggleButtonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == _classicViewButton) { _classicViewButton.setSelected(true); _graphViewButton.setSelected(false); _userPreferences.getAdditionalProperties() .put(USER_PREFERENCES_PROPERTY_EDITING_MODE_PREFERENCE, "Classic"); } else { _classicViewButton.setSelected(false); _graphViewButton.setSelected(true); _userPreferences.getAdditionalProperties() .put(USER_PREFERENCES_PROPERTY_EDITING_MODE_PREFERENCE, "Graph"); } } }; _classicViewButton.addActionListener(viewToggleButtonActionListener); _graphViewButton.addActionListener(viewToggleButtonActionListener); _schemaTreePanel = schemaTreePanel; _leftPanel = new CollapsibleTreePanel(_schemaTreePanel); _leftPanel.setVisible(false); _leftPanel.setCollapsed(true); _schemaTreePanel.setUpdatePanel(_leftPanel); }
From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java
private JPanel createMiddlePanel() { middlePanel = new JPanel(new CardLayout()); ImageIcon usageExplanationIcon = new ImageIcon( getClass().getResource(solutionPanel.getUsageExplanationPath())); JLabel usageExplanationLabel = new JLabel(usageExplanationIcon); // Allow splitPane divider to be moved to the right usageExplanationLabel.setMinimumSize(new Dimension(100, 100)); middlePanel.add(usageExplanationLabel, "usageExplanationPanel"); JComponent wrappedSolutionPanel; if (solutionPanel.isWrapInScrollPane()) { wrappedSolutionPanel = new JScrollPane(solutionPanel); } else {// ww w. j av a 2s. c o m wrappedSolutionPanel = solutionPanel; } middlePanel.add(wrappedSolutionPanel, "solutionPanel"); return middlePanel; }