⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cellbrowser.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        done.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                doneActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);        gridBagConstraints.weightx = 1.0;        jPanel1.add(done, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 6;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        getContentPane().add(jPanel1, gridBagConstraints);        jScrollPane1.setPreferredSize(new java.awt.Dimension(230, 350));        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);        jList1.setPreferredSize(new java.awt.Dimension(150, 300));        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {                jList1ValueChanged(evt);            }        });        jList1.addMouseListener(new java.awt.event.MouseAdapter() {            public void mouseClicked(java.awt.event.MouseEvent evt) {                jList1MouseClicked(evt);            }        });        jScrollPane1.setViewportView(jList1);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 4;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);        getContentPane().add(jScrollPane1, gridBagConstraints);        extrasPanel.setLayout(new java.awt.GridBagLayout());        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 5;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        getContentPane().add(extrasPanel, gridBagConstraints);        pack();    }//GEN-END:initComponents    // ---------------------------- Extra Initialization ---------------------------------    /** Initialize Combo Boxes */    private void initComboBoxes() {        // initialize library combo box with choices        libraryComboBox.addItem("All");        lastSelectedLib = prefs.get(action+prefSelectedLib, null);        if (lastSelectedLib == null) // only in this case uses current cell        {            Cell cell = WindowFrame.getCurrentCell();            if (cell != null) lastSelectedLib = cell.getLibrary().getName();        }        int curLibIndex = -1;        int curIndex = -1;        int i = 1;        for (Library lib : Library.getVisibleLibraries()) {            libraryComboBox.addItem(lib.getName());            if (lib.getName().equals(lastSelectedLib))                curIndex = i;               // see if this is the last selected lib            if (lib == Library.getCurrent())                curLibIndex = i;            // see if this is the current lib            i++;        }        if (curIndex == -1) curIndex = curLibIndex;        if (curIndex > 0) libraryComboBox.setSelectedIndex(curIndex);        viewComboBox.addItem("All");        lastSelectedView = prefs.get(action+prefSelectedView, null);        curIndex = -1;        i = 1;        List<View> viewList = View.getOrderedViews();        for (View view : viewList) {            viewComboBox.addItem(view.getFullName());            if (view.getFullName().equals(lastSelectedView))                curIndex = i;               // see if this is the last selected view            i++;        }        if (curIndex == -1) curIndex = 0;        viewComboBox.setSelectedIndex(curIndex);    }    private JCheckBox sortNumerically;    // ---- Edit Cell extras ----    private JCheckBox editInNewWindow;    // ---- Rename Cell extras ----    private JLabel newCellNameLabel;    private JTextField newCellName;    // ---- Delete Cell extras ----    private JCheckBox confirmDeletions;    private void initExtras()    {        // extras should be added in gridboxlayout inside JPanel "extrasPanel",        //  starting with gridx = 0, gridy=0.        GridBagConstraints gridBagConstraints;        int yPos = 0;        // add in a check box to choose cell sorting method        boolean lexSort = prefs.getBoolean(prefSortLexically, false);        sortNumerically = new JCheckBox("Evaluate Numbers when Sorting Names", !lexSort);        gridBagConstraints = new GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = yPos++;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = GridBagConstraints.BOTH;        extrasPanel.add(sortNumerically, gridBagConstraints);        sortNumerically.addItemListener(new ItemListener() {            public void itemStateChanged(ItemEvent evt) { updateCellList(); }        });        if (action == DoAction.newInstance) {            doAction.setText("New Instance");            done.setText("New Instance & Close");        }        else if (action == DoAction.editCell) {            // add in a check box to open in a new window            boolean checked = prefs.getBoolean(prefEditInNewWindow, false);            editInNewWindow = new JCheckBox("Edit in New Window", checked);            gridBagConstraints = new GridBagConstraints();            gridBagConstraints.gridx = 0;            gridBagConstraints.gridy = yPos++;            gridBagConstraints.gridwidth = 2;            gridBagConstraints.fill = GridBagConstraints.BOTH;            extrasPanel.add(editInNewWindow, gridBagConstraints);            // remove done button, this is a one-shot action button            jPanel1.remove(done);            // however, it would be cool to be able to pick several cells to edit            jList1.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);        }        else if (action == DoAction.renameCell) {            // add in a text box for the new name            newCellNameLabel = new JLabel("New Cell Name:  ");            gridBagConstraints = new GridBagConstraints();            gridBagConstraints.gridx = 0;            gridBagConstraints.gridy = yPos;            gridBagConstraints.gridwidth = 1;            gridBagConstraints.fill = GridBagConstraints.BOTH;            extrasPanel.add(newCellNameLabel, gridBagConstraints);            newCellName = new JTextField();            if (lastSelectedCell != null) {                String nameOnly = lastSelectedCell.replaceAll("\\{.*?\\}", "");                newCellName.setText(nameOnly);            }            gridBagConstraints.gridx = 1;            gridBagConstraints.gridy = yPos++;            gridBagConstraints.gridwidth = 1;            gridBagConstraints.weightx = 1.0;            gridBagConstraints.fill = GridBagConstraints.BOTH;            extrasPanel.add(newCellName, gridBagConstraints);            // not a one-shot action:            doAction.setText("Apply Rename");        }        else if (action == DoAction.deleteCell) {            confirmDeletions = new JCheckBox("Confirm Deletions", confirmDelete);            gridBagConstraints = new GridBagConstraints();            gridBagConstraints.gridx = 0;            gridBagConstraints.gridy = yPos++;            gridBagConstraints.gridwidth = 2;            gridBagConstraints.fill = GridBagConstraints.BOTH;            extrasPanel.add(confirmDeletions, gridBagConstraints);            // set current cell as the default            Cell cell = WindowFrame.getCurrentCell();            setCell(cell);            // not a one-shot action:            jList1.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);            doAction.setText("Apply Delete");        }        else if (action == DoAction.duplicateCell || action == DoAction.selectCellToAssoc) {            // set current cell as the default            Cell cell = WindowFrame.getCurrentCell();            setCell(cell);            // remove done button, this is a one-shot action button            jPanel1.remove(done);        }    }    // --------------------------------- Actions ----------------------------------    private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged        int index = jList1.getSelectedIndex();        jList1.ensureIndexIsVisible(index);        if (jList1.getSelectedValue() != null) {            lastSelectedCell = (String)jList1.getSelectedValue();        }        if (action == DoAction.renameCell) {            if (lastSelectedCell != null && newCellName != null) {                String nameOnly = lastSelectedCell.replaceAll("\\{.*?\\}", "");                newCellName.setText(nameOnly);            }        }    }//GEN-LAST:event_jList1ValueChanged    private void cellFilterKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cellFilterKeyReleased        updateCellList();    }//GEN-LAST:event_cellFilterKeyReleased    private void viewComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_viewComboBoxItemStateChanged        updateCellList();    }//GEN-LAST:event_viewComboBoxItemStateChanged    private void libraryComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_libraryComboBoxItemStateChanged        updateCellList();    }//GEN-LAST:event_libraryComboBoxItemStateChanged    private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked        // do action on double click, close dialog        if (evt.getClickCount() >= 2) performAction();        if (jList1.getSelectedValue() != null) {            lastSelectedCell = (String)jList1.getSelectedValue();        }    }//GEN-LAST:event_jList1MouseClicked    private void doActionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doActionActionPerformed        performAction();    }//GEN-LAST:event_doActionActionPerformed    private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed		cancelled = true;        closeDialog(null);    }//GEN-LAST:event_cancelActionPerformed        private void doneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneActionPerformed        if (action == DoAction.newInstance)            performAction();        closeDialog(null);    }//GEN-LAST:event_doneActionPerformed    /** Closes the dialog */    private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog        // save all preferences        prefs.put(action+prefSelectedLib, (String)libraryComboBox.getSelectedItem());        prefs.put(action+prefSelectedView, (String)viewComboBox.getSelectedItem());        if (jList1.getSelectedValue() != null) {            prefs.put(action+prefSelectedCell, (String)jList1.getSelectedValue());        }        prefs.put(action+prefFilter, lastFilter);        prefs.putBoolean(prefSortLexically, !sortNumerically.isSelected());        if (action == DoAction.editCell)        {            prefs.putBoolean(prefEditInNewWindow, editInNewWindow.isSelected());        } else if (action == DoAction.deleteCell)        {        	confirmDelete = confirmDeletions.isSelected();        }        setVisible(false);        UserInterfaceMain.removeDatabaseChangeListener(this);        dispose();    }//GEN-LAST:event_closeDialog    private void performAction() {        if (action == DoAction.newInstance)        {            Cell cell = getSelectedCell();            if (cell == null) return;            PaletteFrame.placeInstance(cell, null, false);        } else if (action == DoAction.editCell)        {            boolean newWindow = editInNewWindow.isSelected();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -