List of usage examples for javax.swing JList JList
public JList(final Vector<? extends E> listData)
JList
that displays the elements in the specified Vector
. From source file:com.orange.atk.graphAnalyser.LectureJATKResult.java
/** This method is called from within the constructor to * initialize the form.// w ww . j ava 2s. c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jListGraph = new JList(listModel); jComboBoxLeft = new JComboBox(comboModelLeft); jComboBoxRight = new JComboBox(comboModelRight); jListMarker = new JList(listModelMarker); jTable2 = new javax.swing.JTable(); jMenu1 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxLeftActionPerformed(evt); } }); jComboBoxRight.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxRightActionPerformed(evt); } }); jTable2.setModel(modeltable); jMenu1.setText("File"); JMenuItem jMenuItem1 = new JMenuItem(); jMenuItem1.setText("Open Directory"); jMenuItem1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { openDirectoryAction(evt); } }); JMenuItem jMenuItem2 = new JMenuItem(); jMenuItem2.setText("Add a reference Graph"); jMenuItem2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jMenuItemaddGraphActionPerformed(evt); } }); JMenuItem jMenuItem3 = new JMenuItem(); jMenuItem3.setText("set Graph color"); jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemChangecolorActionPerformed(evt); } }); JMenuItem jMenuItem4 = new JMenuItem(); jMenuItem4.setText("save config file"); jMenuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemSaveConfigFileActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenu1.add(jMenuItem2); jMenu1.add(jMenuItem3); jMenu1.add(jMenuItem4); JMenuBar jMenuBar1 = new JMenuBar(); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); //organise JFRAME JPanel mainpanel = (JPanel) getContentPane(); mainpanel.setLayout(new BorderLayout()); mainpanel.add(chartPanel, BorderLayout.CENTER); JPanel toolPanel = new JPanel(); toolPanel.setLayout(new FlowLayout()); toolPanel.add(jComboBoxLeft); Box graphbox = Box.createVerticalBox(); graphbox.add(new JLabel("List of Graph ")); JScrollPane jspaneGraph = new JScrollPane(); jspaneGraph.setViewportView(jListGraph); jspaneGraph.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jspaneGraph.setPreferredSize(new Dimension(150, 100)); graphbox.add(jspaneGraph); // graphbox.setBorder(BorderFactory.createLineBorder(Color.black)); toolPanel.add(graphbox); Box markerbox = Box.createVerticalBox(); markerbox.add(new JLabel("List of Marker")); JScrollPane jspaneMarker = new JScrollPane(); jspaneMarker.setViewportView(jListMarker); jspaneMarker.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jspaneMarker.setPreferredSize(new Dimension(150, 100)); markerbox.add(jspaneMarker); // markerbox.setBorder(BorderFactory.createLineBorder(Color.black)); toolPanel.add(markerbox); JScrollPane jspane = new JScrollPane(); jspane.setViewportView(jTable2); jspane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jspane.setPreferredSize(new Dimension(300, 100)); toolPanel.add(jspane); toolPanel.add(jComboBoxRight); mainpanel.add(toolPanel, BorderLayout.NORTH); pack(); }
From source file:net.sf.jabref.gui.plaintextimport.TextInputDialog.java
private void initRawPanel() { rawPanel.setLayout(new BorderLayout()); // Textarea//w ww . j a v a2 s . co m textPane.setEditable(false); document = textPane.getStyledDocument(); addStylesToDocument(); try { document.insertString(0, "", document.getStyle("regular")); } catch (BadLocationException ex) { LOGGER.warn("Problem setting style", ex); } OverlayPanel testPanel = new OverlayPanel(textPane, Localization.lang("paste text here")); testPanel.setPreferredSize(new Dimension(450, 255)); testPanel.setMaximumSize(new Dimension(450, Integer.MAX_VALUE)); // Setup fields (required to be done before setting up popup menu) fieldList = new JList<>(getAllFields()); fieldList.setCellRenderer(new SimpleCellRenderer(fieldList.getFont())); ListSelectionModel listSelectionModel = fieldList.getSelectionModel(); listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listSelectionModel.addListSelectionListener(new FieldListSelectionHandler()); fieldList.addMouseListener(new FieldListMouseListener()); // After the call to getAllFields initPopupMenuAndToolbar(); //Add listener to components that can bring up popup menus. MouseListener popupListener = new PopupListener(inputMenu); textPane.addMouseListener(popupListener); testPanel.addMouseListener(popupListener); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.add(toolBar, BorderLayout.NORTH); leftPanel.add(testPanel, BorderLayout.CENTER); JPanel inputPanel = setUpFieldListPanel(); // parse with FreeCite button parseWithFreeCiteButton.addActionListener(event -> { if (parseWithFreeCiteAndAddEntries()) { okPressed = false; // we do not want to have the super method to handle our entries, we do it on our own dispose(); } }); rawPanel.add(leftPanel, BorderLayout.CENTER); rawPanel.add(inputPanel, BorderLayout.EAST); JLabel desc = new JLabel("<html><h3>" + Localization.lang("Plain text import") + "</h3><p>" + Localization.lang("This is a simple copy and paste dialog. First load or paste some text into " + "the text input area.<br>After that, you can mark text and assign it to a BibTeX field.") + "</p></html>"); desc.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); rawPanel.add(desc, BorderLayout.SOUTH); }
From source file:com.t3.client.TabletopTool.java
/** * Same as {@link #showMessage(String, String, int, Object...)} except that * <code>messages</code> is stored into a JList and that component is then * used as the content of the dialog box. This allows multiple strings to be * displayed in a manner consistent with other message dialogs. * //from ww w .j a v a 2 s .c o m * @param messages * the Objects (normally strings) to put in the body of the * dialog; no properties file lookup is performed! * @param titleKey * the key in the properties file to use when creating the title * of the dialog window (formatted using <code>params</code>) * @param messageType * one of <code>JOptionPane.ERROR_MESSAGE</code>, * <code>JOptionPane.WARNING_MESSAGE</code>, * <code>JOptionPane.INFORMATION_MESSAGE</code> * @param params * optional parameters to use when formatting the title text from * the properties file */ public static void showMessage(List<String> messages, String titleKey, int messageType, Object... params) { String title = I18N.getText(titleKey, params); JList<String> list = new JList<String>(new Vector<String>(messages)); JOptionPane.showMessageDialog(clientFrame, list, title, messageType); }
From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeoChooserDlg.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override/*from w w w .ja va 2s. c o m*/ public void createUI() { boolean doStatesOrCounties = doAllCountries[1] || doAllCountries[2] || doInvCountry[1] || doInvCountry[2]; //this.whichBtns = doStatesOrCounties && !doInvCountry[1] && rankId > 200 ? CustomDialog.OKCANCELAPPLYHELP : CustomDialog.OKCANCELHELP; boolean isStCnty = true;//rankId > 200; dataListModel = new DefaultListModel<GeoSearchResultsItem>(); mainList = new JList<GeoSearchResultsItem>(dataListModel); JScrollPane sb = createScrollPane(mainList, true); String listDim; if (UIHelper.isWindows()) { listDim = "250px"; Dimension sz = new Dimension(250, 250); mainList.setPreferredSize(sz); sb.setPreferredSize(sz); } else { listDim = "f:p:g"; } CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p,12px,p,2px," + listDim + ",8px,p,4px,p,10px,p" + (isStCnty ? ",8px,p" : ""))); this.contentPanel = pb.getPanel(); super.createUI(); okBtn.setEnabled(false); calcProgress(); try { if (coInfoList != null && coInfoList.size() > 0) { fillFromLuceneResults(); } else { fillFromQuery(); } mainList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { getOkBtn().doClick(); } else if (e.getClickCount() == 1 && !noMatchesFound && !mainList.isSelectionEmpty()) { getOkBtn().setEnabled(true); } } }); mainList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { listItemSelected(); } } }); updateNameCB = createCheckBox("Update the Name in the Geography tree."); // I18N //mergeCB = createCheckBox("Merge all the geographies with the same name."); addISOCodeCB = createCheckBox("Add the ISO Code to the record"); isoCodeTF = createTextField(8); isoCodeTF.setVisible(rankId < 400); updateNameCB.setSelected(isUpdateNamesChecked); //mergeCB.setSelected(true); addISOCodeCB.setSelected(true); updateNameCB.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { isUpdateNamesChecked = updateNameCB.isSelected(); } }); DocumentListener dl = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { okBtn.setEnabled(!isoCodeTF.getText().isEmpty()); } }; isoCodeTF.getDocument().addDocumentListener(dl); //labels.add(nameStr);// + " (Unknown)"); PanelBuilder lookPB = null; JButton lookupBtn = null; if (isStCnty) { lookPB = new PanelBuilder(new FormLayout("f:p:g,p", "p")); lookupBtn = createI18NButton("CLNUP_GEO_LOOK_UP_ISO"); lookPB.add(lookupBtn, cc.xy(2, 1)); lookupBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { globalRankSearch(); } }); } int i = 0; ArrayList<String> labels = new ArrayList<String>(); while (i < parentNames.length && parentRanks[i] > -1) { labels.add(i18NLabelsMap.get(parentRanks[i++])); } PanelBuilder pbTop = new PanelBuilder( new FormLayout("p,2px,f:p:g", UIHelper.createDuplicateJGoodiesDef("p", "2px", labels.size()))); int y = 1; for (i = 0; i < labels.size(); i++) { JLabel lbl = createLabel(parentNames[i]); pbTop.add(createFormLabel(labels.get(i)), cc.xy(1, y)); pbTop.add(lbl, cc.xy(3, y)); lbl.setBackground(Color.WHITE); lbl.setOpaque(true); y += 2; } pb.add(pbTop.getPanel(), cc.xy(1, 3)); pb.addSeparator("Possible standard Geography choices", cc.xy(1, 5)); // I18N pb.add(sb, cc.xy(1, 7)); pb.add(updateNameCB, cc.xy(1, 9)); PanelBuilder pbc = new PanelBuilder(new FormLayout("p,10px,p,f:p:g", "p")); pbc.add(addISOCodeCB, cc.xy(1, 1)); pbc.add(isoCodeTF, cc.xy(3, 1)); pb.add(pbc.getPanel(), cc.xy(1, 11)); i = 13; if (isStCnty) { pb.add(lookPB.getPanel(), cc.xy(1, i)); i += 2; } //if (doAllCountries[0]) if (false) // hidding it for now { progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); PanelBuilder prgPB = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p")); prgPB.add(createFormLabel("Progress"), cc.xy(1, 1)); prgPB.add(progressBar, cc.xy(3, 1)); pb.add(prgPB.getPanel(), cc.xy(1, i)); i += 2; } mainList.setSelectedIndex(selectedIndex); mainList.ensureIndexIsVisible(selectedIndex); noMatchesFound = dataListModel.size() == 0; // Optional Depending on States / Countries if (doStatesOrCounties) { if (dataListModel.getSize() == 0) { dataListModel.addElement(new GeoSearchResultsItem("No matches found."));// I18N } } pb.setDefaultDialogBorder(); } catch (Exception ex) { ex.printStackTrace(); } if (UIHelper.isWindows()) { setResizable(false); } setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // Must be called at the end 'createUI' }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java
/** * //from w ww . jav a 2 s. c o m */ @SuppressWarnings("unchecked") //$NON-NLS-1$ public ViewSetSelectorPanel(final BasicFormPreviewPanel previewPanel) { this.previewPanel = previewPanel; Vector<String> levelsVec = new Vector<String>(); SpecifyUser user = AppContextMgr.getInstance().getClassObject(SpecifyUser.class); @SuppressWarnings("unused") Hashtable<Discipline, Boolean> usedColTypes = new Hashtable<Discipline, Boolean>(); levelsVec.add(user.getUserType()); // for (Agent agent : user.getAgents()) // { // // XXX Commented Out // /*Discipline ct = agent.getDiscipline(); // if (usedColTypes.get(ct) == null) // { // levelsVec.add(ct.getName()); // usedColTypes.put(ct, true); // }*/ // } levelsVec.add("BackStop"); //$NON-NLS-1$ addBtn = UIHelper.createIconBtn("PlusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$ public void actionPerformed(ActionEvent arg0) { addControl(); } }); delBtn = UIHelper.createIconBtn("MinusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$ public void actionPerformed(ActionEvent arg0) { delControl(TYPE.SelectedObj); } }); ActionListener addViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { addView(); } }; ActionListener delViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { delView(); } }; viewControlPanel = new EditDeleteAddPanel(null, delViewAL, addViewAL); ActionListener addAltViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { addAltView(); } }; ActionListener delAltViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { delAltView(); } }; altViewControlPanel = new EditDeleteAddPanel(null, delAltViewAL, addAltViewAL); ActionListener addDefViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { addViewDef(); } }; ActionListener delDefViewAL = new ActionListener() { public void actionPerformed(ActionEvent e) { delViewDef(); } }; viewDefControlPanel = new EditDeleteAddPanel(null, delDefViewAL, addDefViewAL); ActionListener saveAL = new ActionListener() { public void actionPerformed(ActionEvent e) { save(); } }; EditDeleteAddPanel saveControlPanel = new EditDeleteAddPanel(null, null, saveAL); saveControlPanel.getAddBtn().setIcon(IconManager.getIcon("Save", IconManager.IconSize.Std16)); //$NON-NLS-1$ saveControlPanel.getAddBtn().setEnabled(true); setLayout(new BorderLayout()); levelsList = new JList(levelsVec); panel = new EditorPropPanel(controlHash, subcontrolHash, null, true, this); //panel.setFormViewDef(null); PanelBuilder pb = new PanelBuilder(new FormLayout("p,4px,p, 6px,10px,6px, p,6px,p, 6px,10px,6px, p,f:p:g", //$NON-NLS-1$ "p,2px,f:p:g,2px,p,10px,p,4px")); //$NON-NLS-1$ CellConstraints cc = new CellConstraints(); String[] labels = new String[] { "User Level", "ViewSets", " ", "Views", "AltViews", " ", "View Defs" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ int x = 1; for (String label : labels) { pb.add(createLabel(label, SwingConstants.CENTER), cc.xy(x, 1)); x += 2; } Color vsFGColor = new Color(224, 224, 224); Color vsBGColor = new Color(124, 124, 124); Dimension ps = new Dimension(200, 150); x = 1; JScrollPane sp = createScrollPane(levelsList); pb.add(sp, cc.xy(x, 3)); x += 2; viewSetsList = new JList(new DefaultListModel()); sp = createScrollPane(viewSetsList); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3)); x += 2; viewsList = new JList(new DefaultListModel()); sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; altViewsList = new JList(new DefaultListModel()); sp = createScrollPane(altViewsList); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3)); x += 2; viewDefsList = new JList(new DefaultListModel()); sp = createScrollPane(viewDefsList); sp.setPreferredSize(ps); pb.add(sp, cc.xy(x, 3)); x += 2; pb.add(saveControlPanel, cc.xy(1, 5)); //pb.add(createLabel(" "), cc.xy(3, 5)); //pb.add(createLabel(" "), cc.xy(5, 5)); pb.add(viewControlPanel, cc.xy(7, 5)); pb.add(altViewControlPanel, cc.xy(9, 5)); //pb.add(createLabel(" "), cc.xy(11, 5)); pb.add(viewDefControlPanel, cc.xy(13, 5)); pb.addSeparator("View Def Editor", cc.xywh(1, 7, 13, 1)); //$NON-NLS-1$ add(pb.getPanel(), BorderLayout.NORTH); pb = new PanelBuilder(new FormLayout("max(250px;p),4px,f:p:g", "t:p")); //$NON-NLS-1$ //$NON-NLS-2$ PanelBuilder inner = new PanelBuilder(new FormLayout("max(250px;p)", "t:p,2px,t:p")); //$NON-NLS-1$ //$NON-NLS-2$ tree = new JTree(); ((DefaultTreeModel) tree.getModel()).setRoot(null); sp = createScrollPane(tree); inner.add(sp, cc.xy(1, 1)); PanelBuilder btnPb = new PanelBuilder(new FormLayout("f:p:g,p,2px,p", "p")); //$NON-NLS-1$ //$NON-NLS-2$ btnPb.add(delBtn, cc.xy(2, 1)); btnPb.add(addBtn, cc.xy(4, 1)); inner.add(btnPb.getPanel(), cc.xy(1, 3)); pb.add(inner.getPanel(), cc.xy(1, 1)); pb.add(panel, cc.xy(3, 1)); add(pb.getPanel(), BorderLayout.CENTER); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { treeSelected(); } }); levelsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { levelSelected(); } } }); viewSetsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { viewSetSelected(); } } }); viewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { viewSelected(); } } }); altViewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { altViewSelected(); } } }); viewDefsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { viewDefSelected(); } } }); tree.addMouseListener(new MouseAdapter() { protected void doPopup(MouseEvent e) { if (e.isPopupTrigger()) { int xc = e.getX(); int yc = e.getY(); TreePath path = tree.getPathForLocation(xc, yc); if (path != null) { tree.setSelectionPath(path); } treeSelected(); DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getSelectionModel() .getSelectionPath().getLastPathComponent(); if (selectedCell != null || selectedRow != null) { new TreePopupMenu((Component) e.getSource(), e, selectedCell); } else if (selectedNode.getUserObject() instanceof FormViewDef) { new TreePopupMenu((Component) e.getSource(), e); } } } public void mouseReleased(MouseEvent e) { doPopup(e); } public void mousePressed(MouseEvent e) { doPopup(e); } }); XStream xstream = new XStream(); xstream.alias("control", Control.class); //$NON-NLS-1$ xstream.useAttributeFor(Control.class, "type"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "type"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "name"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "required"); //$NON-NLS-1$ xstream.useAttributeFor(Attr.class, "defaultValue"); //$NON-NLS-1$ xstream.aliasAttribute("default", "defaultValue"); //$NON-NLS-1$ //$NON-NLS-2$ xstream.alias("uicontrols", Vector.class); //$NON-NLS-1$ xstream.alias("attr", Attr.class); //$NON-NLS-1$ xstream.alias("param", Param.class); //$NON-NLS-1$ xstream.alias("subcontrol", SubControl.class); //$NON-NLS-1$ xstream.aliasAttribute("desc", "desc"); //$NON-NLS-1$ //$NON-NLS-2$ xstream.aliasAttribute(Attr.class, "values", "values"); //$NON-NLS-1$ //$NON-NLS-2$ xstream.useAttributeFor(SubControl.class, "type"); //$NON-NLS-1$ try { controls = (Vector<Control>) xstream.fromXML(FileUtils.readFileToString(new File("UIControls.xml"))); //$NON-NLS-1$ for (Control control : controls) { controlHash.put(control.getType(), control); if (control.getSubcontrols() != null) { for (SubControl sc : control.getSubcontrols()) { //System.out.println(" ["+sc.getType()+"] "); subcontrolHash.put(sc.getType(), sc); } } } } catch (IOException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ViewSetSelectorPanel.class, ex); ex.printStackTrace(); } }
From source file:misc.TextBatchPrintingDemo.java
/** * Create and display the main application frame. */// ww w . j a v a 2 s . c o m void createAndShowGUI() { messageArea = new JLabel(defaultMessage); selectedPages = new JList(new DefaultListModel()); selectedPages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); selectedPages.addListSelectionListener(this); setPage(homePage); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(pageItem), new JScrollPane(selectedPages)); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); /** Menu item and keyboard shortcuts for the "add page" command. */ fileMenu.add(createMenuItem(new AbstractAction("Add Page") { public void actionPerformed(ActionEvent e) { DefaultListModel pages = (DefaultListModel) selectedPages.getModel(); pages.addElement(pageItem); selectedPages.setSelectedIndex(pages.getSize() - 1); } }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK))); /** Menu item and keyboard shortcuts for the "print selected" command.*/ fileMenu.add(createMenuItem(new AbstractAction("Print Selected") { public void actionPerformed(ActionEvent e) { printSelectedPages(); } }, KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.ALT_MASK))); /** Menu item and keyboard shortcuts for the "clear selected" command.*/ fileMenu.add(createMenuItem(new AbstractAction("Clear Selected") { public void actionPerformed(ActionEvent e) { DefaultListModel pages = (DefaultListModel) selectedPages.getModel(); pages.removeAllElements(); } }, KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK))); fileMenu.addSeparator(); /** Menu item and keyboard shortcuts for the "home page" command. */ fileMenu.add(createMenuItem(new AbstractAction("Home Page") { public void actionPerformed(ActionEvent e) { setPage(homePage); } }, KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK))); /** Menu item and keyboard shortcuts for the "quit" command. */ fileMenu.add(createMenuItem(new AbstractAction("Quit") { public void actionPerformed(ActionEvent e) { for (Window w : Window.getWindows()) { w.dispose(); } } }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK))); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); JPanel contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(pane); contentPane.add(messageArea); JFrame frame = new JFrame("Text Batch Printing Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(menuBar); frame.setContentPane(contentPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); if (printService == null) { // Actual printing is not possible, issue a warning message. JOptionPane.showMessageDialog(frame, "No default print service", "Print Service Alert", JOptionPane.WARNING_MESSAGE); } }
From source file:net.sf.jabref.gui.preftabs.TableColumnsTab.java
/** * Customization of external program paths. * * @param prefs a <code>JabRefPreferences</code> value *///from ww w . j a v a 2 s . c o m public TableColumnsTab(JabRefPreferences prefs, JabRefFrame frame) { this.prefs = prefs; this.frame = frame; setLayout(new BorderLayout()); TableModel tm = new AbstractTableModel() { @Override public int getRowCount() { return rowCount; } @Override public int getColumnCount() { return 2; } @Override public Object getValueAt(int row, int column) { int internalRow = row; if (internalRow == 0) { return column == 0 ? InternalBibtexFields.NUMBER_COL : String.valueOf(ncWidth); } internalRow--; if (internalRow >= tableRows.size()) { return ""; } Object rowContent = tableRows.get(internalRow); if (rowContent == null) { return ""; } TableRow tr = (TableRow) rowContent; // Only two columns if (column == 0) { return tr.getName(); } else { return tr.getLength() > 0 ? Integer.toString(tr.getLength()) : ""; } } @Override public String getColumnName(int col) { return col == 0 ? Localization.lang("Field name") : Localization.lang("Column width"); } @Override public Class<?> getColumnClass(int column) { if (column == 0) { return String.class; } return Integer.class; } @Override public boolean isCellEditable(int row, int col) { return !((row == 0) && (col == 0)); } @Override public void setValueAt(Object value, int row, int col) { tableChanged = true; // Make sure the vector is long enough. while (row >= tableRows.size()) { tableRows.add(new TableRow("", -1)); } if ((row == 0) && (col == 1)) { ncWidth = Integer.parseInt(value.toString()); return; } TableRow rowContent = tableRows.get(row - 1); if (col == 0) { rowContent.setName(value.toString()); if ("".equals(getValueAt(row, 1))) { setValueAt(String.valueOf(BibtexSingleField.DEFAULT_FIELD_LENGTH), row, 1); } } else { if (value == null) { rowContent.setLength(-1); } else { rowContent.setLength(Integer.parseInt(value.toString())); } } } }; colSetup = new JTable(tm); TableColumnModel cm = colSetup.getColumnModel(); cm.getColumn(0).setPreferredWidth(140); cm.getColumn(1).setPreferredWidth(80); FormLayout layout = new FormLayout("1dlu, 8dlu, left:pref, 4dlu, fill:pref", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); JPanel pan = new JPanel(); JPanel tabPanel = new JPanel(); tabPanel.setLayout(new BorderLayout()); JScrollPane sp = new JScrollPane(colSetup, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); colSetup.setPreferredScrollableViewportSize(new Dimension(250, 200)); sp.setMinimumSize(new Dimension(250, 300)); tabPanel.add(sp, BorderLayout.CENTER); JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL); toolBar.setFloatable(false); AddRowAction addRow = new AddRowAction(); DeleteRowAction deleteRow = new DeleteRowAction(); MoveRowUpAction moveUp = new MoveRowUpAction(); MoveRowDownAction moveDown = new MoveRowDownAction(); toolBar.setBorder(null); toolBar.add(addRow); toolBar.add(deleteRow); toolBar.addSeparator(); toolBar.add(moveUp); toolBar.add(moveDown); tabPanel.add(toolBar, BorderLayout.EAST); fileColumn = new JCheckBox(Localization.lang("Show file column")); urlColumn = new JCheckBox(Localization.lang("Show URL/DOI column")); preferUrl = new JRadioButton(Localization.lang("Show URL first")); preferDoi = new JRadioButton(Localization.lang("Show DOI first")); ButtonGroup preferUrlDoiGroup = new ButtonGroup(); preferUrlDoiGroup.add(preferUrl); preferUrlDoiGroup.add(preferDoi); urlColumn.addChangeListener(arg0 -> { preferUrl.setEnabled(urlColumn.isSelected()); preferDoi.setEnabled(urlColumn.isSelected()); }); arxivColumn = new JCheckBox(Localization.lang("Show ArXiv column")); Collection<ExternalFileType> fileTypes = ExternalFileTypes.getInstance().getExternalFileTypeSelection(); String[] fileTypeNames = new String[fileTypes.size()]; int i = 0; for (ExternalFileType fileType : fileTypes) { fileTypeNames[i++] = fileType.getName(); } listOfFileColumns = new JList<>(fileTypeNames); JScrollPane listOfFileColumnsScrollPane = new JScrollPane(listOfFileColumns); listOfFileColumns.setVisibleRowCount(3); extraFileColumns = new JCheckBox(Localization.lang("Show extra columns")); extraFileColumns.addChangeListener(arg0 -> listOfFileColumns.setEnabled(extraFileColumns.isSelected())); /*** begin: special table columns and special fields ***/ JButton helpButton = new HelpAction(Localization.lang("Help on special fields"), HelpFile.SPECIAL_FIELDS) .getHelpButton(); rankingColumn = new JCheckBox(Localization.lang("Show rank")); qualityColumn = new JCheckBox(Localization.lang("Show quality")); priorityColumn = new JCheckBox(Localization.lang("Show priority")); relevanceColumn = new JCheckBox(Localization.lang("Show relevance")); printedColumn = new JCheckBox(Localization.lang("Show printed status")); readStatusColumn = new JCheckBox(Localization.lang("Show read status")); // "sync keywords" and "write special" fields may be configured mutually exclusive only // The implementation supports all combinations (TRUE+TRUE and FALSE+FALSE, even if the latter does not make sense) // To avoid confusion, we opted to make the setting mutually exclusive syncKeywords = new JRadioButton(Localization.lang("Synchronize with keywords")); writeSpecialFields = new JRadioButton( Localization.lang("Write values of special fields as separate fields to BibTeX")); ButtonGroup group = new ButtonGroup(); group.add(syncKeywords); group.add(writeSpecialFields); specialFieldsEnabled = new JCheckBox(Localization.lang("Enable special fields")); specialFieldsEnabled.addChangeListener(event -> { boolean isEnabled = specialFieldsEnabled.isSelected(); rankingColumn.setEnabled(isEnabled); qualityColumn.setEnabled(isEnabled); priorityColumn.setEnabled(isEnabled); relevanceColumn.setEnabled(isEnabled); printedColumn.setEnabled(isEnabled); readStatusColumn.setEnabled(isEnabled); syncKeywords.setEnabled(isEnabled); writeSpecialFields.setEnabled(isEnabled); }); builder.appendSeparator(Localization.lang("Special table columns")); builder.nextLine(); builder.append(pan); DefaultFormBuilder specialTableColumnsBuilder = new DefaultFormBuilder( new FormLayout("8dlu, 8dlu, 8cm, 8dlu, 8dlu, left:pref:grow", "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref")); CellConstraints cc = new CellConstraints(); specialTableColumnsBuilder.add(specialFieldsEnabled, cc.xyw(1, 1, 3)); specialTableColumnsBuilder.add(rankingColumn, cc.xyw(2, 2, 2)); specialTableColumnsBuilder.add(relevanceColumn, cc.xyw(2, 3, 2)); specialTableColumnsBuilder.add(qualityColumn, cc.xyw(2, 4, 2)); specialTableColumnsBuilder.add(priorityColumn, cc.xyw(2, 5, 2)); specialTableColumnsBuilder.add(printedColumn, cc.xyw(2, 6, 2)); specialTableColumnsBuilder.add(readStatusColumn, cc.xyw(2, 7, 2)); specialTableColumnsBuilder.add(syncKeywords, cc.xyw(2, 10, 2)); specialTableColumnsBuilder.add(writeSpecialFields, cc.xyw(2, 11, 2)); specialTableColumnsBuilder.add(helpButton, cc.xyw(1, 12, 2)); specialTableColumnsBuilder.add(fileColumn, cc.xyw(5, 1, 2)); specialTableColumnsBuilder.add(urlColumn, cc.xyw(5, 2, 2)); specialTableColumnsBuilder.add(preferUrl, cc.xy(6, 3)); specialTableColumnsBuilder.add(preferDoi, cc.xy(6, 4)); specialTableColumnsBuilder.add(arxivColumn, cc.xyw(5, 5, 2)); specialTableColumnsBuilder.add(extraFileColumns, cc.xyw(5, 6, 2)); specialTableColumnsBuilder.add(listOfFileColumnsScrollPane, cc.xywh(5, 7, 2, 6)); builder.append(specialTableColumnsBuilder.getPanel()); builder.nextLine(); /*** end: special table columns and special fields ***/ builder.appendSeparator(Localization.lang("Entry table columns")); builder.nextLine(); builder.append(pan); builder.append(tabPanel); builder.nextLine(); builder.append(pan); JButton buttonWidth = new JButton(new UpdateWidthsAction()); JButton buttonOrder = new JButton(new UpdateOrderAction()); builder.append(buttonWidth); builder.nextLine(); builder.append(pan); builder.append(buttonOrder); builder.nextLine(); builder.append(pan); builder.nextLine(); pan = builder.getPanel(); pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(pan, BorderLayout.CENTER); }
From source file:es.emergya.ui.gis.popups.GenericDialog.java
protected void addList(Object[] lista, String label) { rows++;/*from w w w. j a va2 s .c o m*/ mid.add(new JLabel(i18n.getString(label), JLabel.RIGHT)); if (lista != null) { JList jlist = new JList(lista); final JScrollPane jScrollPane = new JScrollPane(jlist); jScrollPane.getViewport().setPreferredSize(new Dimension(100, 100)); mid.add(jScrollPane); } for (int i = 2; i < cols; i++) mid.add(Box.createHorizontalGlue()); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.diagnostics.ApproximationSetViewer.java
/** * Initializes this window. This method is invoked in the constructor, and * should not be invoked again./* w ww . jav a 2s. com*/ */ protected void initialize() { //initialize the NFE slider int minimumNFE = Integer.MAX_VALUE; int maximumNFE = Integer.MIN_VALUE; for (Accumulator accumulator : accumulators) { minimumNFE = Math.min(minimumNFE, (Integer) accumulator.get("NFE", 0)); maximumNFE = Math.max(maximumNFE, (Integer) accumulator.get("NFE", accumulator.size("NFE") - 1)); } slider = new JSlider(minimumNFE, maximumNFE, minimumNFE); slider.setPaintTicks(true); slider.setMinorTickSpacing(100); slider.setMajorTickSpacing(1000); slider.addChangeListener(this); //initializes the options available for axis plotting Solution solution = (Solution) ((List<?>) accumulators.get(0).get("Approximation Set", 0)).get(0); Vector<String> objectives = new Vector<String>(); for (int i = 0; i < solution.getNumberOfObjectives(); i++) { objectives.add(localization.getString("text.objective", i + 1)); } for (int i = 0; i < solution.getNumberOfConstraints(); i++) { objectives.add(localization.getString("text.constraint", i + 1)); } for (int i = 0; i < solution.getNumberOfVariables(); i++) { objectives.add(localization.getString("text.variable", i + 1)); } xAxisSelection = new JComboBox(objectives); yAxisSelection = new JComboBox(objectives); xAxisSelection.setSelectedIndex(0); yAxisSelection.setSelectedIndex(1); xAxisSelection.addActionListener(this); yAxisSelection.addActionListener(this); //initialize the reference set bounds initializeReferenceSetBounds(); //initialize plotting controls useInitialBounds = new JRadioButton(localization.getString("action.useInitialBounds.name")); useReferenceSetBounds = new JRadioButton(localization.getString("action.useReferenceSetBounds.name")); useDynamicBounds = new JRadioButton(localization.getString("action.useDynamicBounds.name")); useZoomBounds = new JRadioButton(localization.getString("action.useZoom.name")); useInitialBounds.setToolTipText(localization.getString("action.useInitialBounds.description")); useReferenceSetBounds.setToolTipText(localization.getString("action.useReferenceSetBounds.description")); useDynamicBounds.setToolTipText(localization.getString("action.useDynamicBounds.description")); useZoomBounds.setToolTipText(localization.getString("action.useZoom.description")); ButtonGroup rangeButtonGroup = new ButtonGroup(); rangeButtonGroup.add(useInitialBounds); rangeButtonGroup.add(useReferenceSetBounds); rangeButtonGroup.add(useDynamicBounds); rangeButtonGroup.add(useZoomBounds); if (referenceSet == null) { useReferenceSetBounds.setEnabled(false); } useInitialBounds.setSelected(true); useInitialBounds.addActionListener(this); useReferenceSetBounds.addActionListener(this); useDynamicBounds.addActionListener(this); useZoomBounds.addActionListener(this); //initialize the seed list String[] seeds = new String[accumulators.size()]; for (int i = 0; i < accumulators.size(); i++) { seeds[i] = localization.getString("text.seed", i + 1); } seedList = new JList(seeds); seedList.addListSelectionListener(this); selectAll = new JButton(new AbstractAction() { private static final long serialVersionUID = -3709557130361259485L; { putValue(Action.NAME, localization.getString("action.selectAll.name")); } @Override public void actionPerformed(ActionEvent e) { seedList.getSelectionModel().setSelectionInterval(0, seedList.getModel().getSize() - 1); } }); //initialize miscellaneous components paintHelper = new PaintHelper(); paintHelper.set(localization.getString("text.referenceSet"), Color.BLACK); chartContainer = new JPanel(new BorderLayout()); }
From source file:edu.ku.brc.specify.config.ResourceImportExportDlg.java
@Override public void createUI() { this.setHelpContext("Import"); super.createUI(); CellConstraints cc = new CellConstraints(); levelCBX = createComboBox();/*ww w.ja va 2 s .c om*/ DataProviderSessionIFace session = null; try { session = DataProviderFactory.getInstance().createSession(); for (SpAppResourceDir curDir : contextMgr.getSpAppResourceList()) { SpAppResourceDir dir; if (curDir.getId() != null) { dir = session.get(SpAppResourceDir.class, curDir.getId()); dir.setTitle(curDir.getTitle()); // Force Load dir.getSpAppResources().size(); dir.getSpPersistedAppResources().size(); dir.getSpPersistedViewSets().size(); for (SpAppResource appRes : curDir.getSpAppResources()) { if (appRes.getId() == null) { dir.getSpAppResources().add(appRes); } } for (SpViewSetObj vso : curDir.getSpViewSets()) { if (vso.getId() == null) { dir.getSpViewSets().add(vso); } } } else { dir = (SpAppResourceDir) curDir.clone(); } dirs.add(dir); levelCBX.addItem(dir); } } catch (Exception ex) { ex.printStackTrace(); edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ResourceImportExportDlg.class, ex); } finally { if (session != null) { session.close(); } } PanelBuilder centerPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p,10px,p")); centerPB.add(createLabel(UIRegistry.getLocalizedMessage("RIE_USR_LBL", userName)), cc.xy(2, 1)); centerPB.add(levelCBX, cc.xy(2, 3)); tabbedPane = new JTabbedPane(); PanelBuilder viewPanel = new PanelBuilder(new FormLayout("f:p:g,10px,f:p:g", "p,2px,f:p:g")); viewPanel.add(createLabel(getResourceString("RIE_VIEWSETS"), SwingConstants.CENTER), cc.xy(1, 1)); viewSetsList = new JList(viewSetsModel); viewSetsList.setCellRenderer(new ARListRenderer()); JScrollPane sp = new JScrollPane(viewSetsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); viewPanel.add(sp, cc.xy(1, 3)); viewPanel.add(createLabel(getResourceString("RIE_VIEWS"), SwingConstants.CENTER), cc.xy(3, 1)); viewsList = new JList(viewsModel); viewsList.setCellRenderer(new ViewRenderer()); sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); viewPanel.add(sp, cc.xy(3, 3)); viewsList.setEnabled(false); PanelBuilder resPane = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p")); resPane.add(createLabel(getResourceString("RIE_OTHER_RES"), SwingConstants.CENTER), cc.xy(1, 1)); resList = new JList(resModel); resList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); resList.setCellRenderer(new ARListRenderer()); sp = new JScrollPane(resList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); resPane.add(sp, cc.xy(1, 3)); PanelBuilder repPane = new PanelBuilder(new FormLayout("f:p:g", "p,2px,f:p:g")); repPane.add(createLabel(getResourceString("RIE_REPORT_RES"), SwingConstants.CENTER), cc.xy(1, 1)); repList = new JList(repModel); repList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); repList.setCellRenderer(new ARListRenderer()); sp = new JScrollPane(repList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); repPane.add(sp, cc.xy(1, 3)); boolean addResourcesPanel = AppPreferences.getLocalPrefs().getBoolean("ADD_IMP_RES", false); viewsPanel = viewPanel.getPanel(); tabbedPane.addTab(getResourceString("RIE_VIEWSETS"), viewsPanel); if (addResourcesPanel) { resPanel = resPane.getPanel(); tabbedPane.addTab(getResourceString("RIE_OTHER_RES"), resPanel); } repPanel = repPane.getPanel(); tabbedPane.addTab(getResourceString("RIE_REPORT_RES"), repPanel); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,2px,p")); pb.add(centerPB.getPanel(), cc.xy(1, 1)); pb.add(tabbedPane, cc.xy(1, 3)); exportBtn = createButton(getResourceString("RIE_EXPORT")); importBtn = createButton(getResourceString("RIE_IMPORT")); revertBtn = createButton(getResourceString("RIE_REVERT")); PanelBuilder btnPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g,p,f:p:g,p,f:p:g", "p,10px")); btnPB.add(exportBtn, cc.xy(2, 1)); btnPB.add(importBtn, cc.xy(4, 1)); btnPB.add(revertBtn, cc.xy(6, 1)); pb.add(btnPB.getPanel(), cc.xy(1, 5)); pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); contentPanel = pb.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Component selectedComp = tabbedPane.getSelectedComponent(); if (selectedComp != null) { if (selectedComp == viewsPanel) { viewSetsList.setSelectedIndex(-1); } else if (selectedComp == resPanel) { resList.setSelectedIndex(-1); } else { repList.setSelectedIndex(-1); } //revertBtn.setVisible(selectedComp != repPanel); } enableUI(); // JGoodies Resizes the panel in the Dialog and // partially hides the buttons, this fixes that. Dimension size = ResourceImportExportDlg.this.getSize(); //ResourceImportExportDlg.this.pack(); //Dimension newSize = ResourceImportExportDlg.this.getSize(); Dimension newSize = ResourceImportExportDlg.this.getPreferredSize(); size.height = newSize.height; ResourceImportExportDlg.this.setSize(size); } }); levelCBX.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { levelSelected(); } }); } }); levelCBX.setSelectedIndex(0); pack(); exportBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { exportResource(); } }); importBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { importResource(); } }); revertBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { revertResource(); } }); viewSetsList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (viewSetsList.getSelectedIndex() > -1) { resList.clearSelection(); repList.clearSelection(); } fillViewsList(); enableUI(); } } }); resList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (resList.getSelectedIndex() > -1) { viewSetsList.clearSelection(); repList.clearSelection(); } enableUI(); } } }); repList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (resList.getSelectedIndex() > -1) { viewSetsList.clearSelection(); resList.clearSelection(); } enableUI(); } } }); pack(); }