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

📄 layertab.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	/**	 * Class for catching drags in the list of layers.	 * These drags come from elsewhere in the layers tab.	 */	private class LayerTabTreeDropTarget implements DropTargetListener	{		private Rectangle lastDrawn = null;		public void dragEnter(DropTargetDragEvent e)		{			DropTarget dt = (DropTarget)e.getSource();			if (dt.getComponent() == layerList)				e.acceptDrag(e.getDropAction());		}		public void dragOver(DropTargetDragEvent e)		{			DropTarget dt = (DropTarget)e.getSource();			if (dt.getComponent() != layerList) return;			e.acceptDrag(e.getDropAction());			// erase former drawing			eraseDragImage();			// highlight the destination			int index = layerList.locationToIndex(e.getLocation());			Rectangle path = layerList.getCellBounds(index, index);			if (path == null) return;			Graphics2D g2 = (Graphics2D)layerList.getGraphics();			g2.setColor(Color.RED);			g2.drawRect(path.x, path.y, path.width-1, 1);			lastDrawn = path;		}		public void dropActionChanged(DropTargetDragEvent e)		{			e.acceptDrag(e.getDropAction());		}		public void dragExit(DropTargetEvent e)		{			eraseDragImage();		}		public void drop(DropTargetDropEvent dtde)		{			dtde.acceptDrop(DnDConstants.ACTION_LINK);			// erase former drawing			eraseDragImage();			// get the original index that was dragged			String text = null;			DataFlavor [] flavors = dtde.getCurrentDataFlavors();			if (flavors.length > 0)			{				if (flavors[0].isFlavorTextType())				{					try {						text = (String)dtde.getTransferable().getTransferData(flavors[0]);					} catch (Exception e) {}				}			}			if (text == null) return;			int start = TextUtils.atoi(text);			int end = layerList.locationToIndex(dtde.getLocation());			Layer moveIt = layersInList.get(start);			layersInList.remove(start);			if (start < end) end--;			layersInList.add(end, moveIt);			layerListModel.clear();			for(Layer layer : layersInList)				layerListModel.addElement(lineName(layer));			layerList.setSelectedIndex(end);			Technology tech = Technology.getCurrent();			tech.setSavedLayerOrder(layersInList);			dtde.dropComplete(false);		}		private void eraseDragImage()		{			if (lastDrawn == null) return;			layerList.paintImmediately(lastDrawn);			lastDrawn = null;		}	}	/** This method is called from within the constructor to	 * initialize the form.	 * 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 ">//GEN-BEGIN:initComponents    private void initComponents()    {        java.awt.GridBagConstraints gridBagConstraints;        layerPane = new javax.swing.JScrollPane();        technology = new javax.swing.JComboBox();        selectAll = new javax.swing.JButton();        makeVisible = new javax.swing.JButton();        makeInvisible = new javax.swing.JButton();        jPanel1 = new javax.swing.JPanel();        unhighlightAll = new javax.swing.JButton();        toggleHighlight = new javax.swing.JButton();        jPanel2 = new javax.swing.JPanel();        cellText = new javax.swing.JCheckBox();        arcText = new javax.swing.JCheckBox();        annotationText = new javax.swing.JCheckBox();        instanceNames = new javax.swing.JCheckBox();        exportText = new javax.swing.JCheckBox();        portText = new javax.swing.JCheckBox();        nodeText = new javax.swing.JCheckBox();        opacitySlider = new javax.swing.JSlider();        resetOpacity = new javax.swing.JButton();        setLayout(new java.awt.GridBagLayout());        setName("");        layerPane.setMinimumSize(new java.awt.Dimension(100, 300));        layerPane.setPreferredSize(new java.awt.Dimension(100, 300));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        add(layerPane, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        add(technology, gridBagConstraints);        selectAll.setText("Select All");        selectAll.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                selectAllActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 4;        gridBagConstraints.insets = new java.awt.Insets(1, 4, 1, 4);        add(selectAll, gridBagConstraints);        makeVisible.setText("Make Visible");        makeVisible.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                makeVisibleActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 5;        gridBagConstraints.insets = new java.awt.Insets(1, 4, 1, 4);        add(makeVisible, gridBagConstraints);        makeInvisible.setText("Make Invisible");        makeInvisible.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                makeInvisibleActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 6;        gridBagConstraints.insets = new java.awt.Insets(1, 4, 2, 4);        add(makeInvisible, gridBagConstraints);        jPanel1.setLayout(new java.awt.GridBagLayout());        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Highlighting"));        unhighlightAll.setText("Clear");        unhighlightAll.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                unhighlightAllActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.insets = new java.awt.Insets(1, 4, 2, 4);        jPanel1.add(unhighlightAll, gridBagConstraints);        toggleHighlight.setText("Toggle");        toggleHighlight.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                toggleHighlightActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.insets = new java.awt.Insets(2, 4, 1, 4);        jPanel1.add(toggleHighlight, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 7;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 1.0;        add(jPanel1, gridBagConstraints);        jPanel2.setLayout(new java.awt.GridBagLayout());        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Text Visibility"));        cellText.setText("Cell text");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 3;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        jPanel2.add(cellText, gridBagConstraints);        arcText.setText("Arc text");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        jPanel2.add(arcText, gridBagConstraints);        annotationText.setText("Annotation text");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 5;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        jPanel2.add(annotationText, gridBagConstraints);        instanceNames.setText("Instance names");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 4;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        jPanel2.add(instanceNames, gridBagConstraints);        exportText.setText("Export text");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 6;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        jPanel2.add(exportText, gridBagConstraints);        portText.setText("Port text");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        jPanel2.add(portText, gridBagConstraints);        nodeText.setText("Node text");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);        jPanel2.add(nodeText, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 8;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        add(jPanel2, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        add(opacitySlider, gridBagConstraints);        resetOpacity.setText("Reset Opacity");        resetOpacity.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                resetOpacityActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 3;        gridBagConstraints.insets = new java.awt.Insets(2, 4, 1, 4);        add(resetOpacity, gridBagConstraints);    }// </editor-fold>//GEN-END:initComponents    private void resetOpacityActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_resetOpacityActionPerformed    {//GEN-HEADEREND:event_resetOpacityActionPerformed		String techName = (String)technology.getSelectedItem();		Technology tech = Technology.findTechnology(techName);		if (tech == null) return;		EditWindow.setDefaultOpacity(tech);		updateLayersTab();		opacityChanged();    }//GEN-LAST:event_resetOpacityActionPerformed	private void toggleHighlightActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_toggleHighlightActionPerformed	{//GEN-HEADEREND:event_toggleHighlightActionPerformed		toggleHighlight();	}//GEN-LAST:event_toggleHighlightActionPerformed	private void unhighlightAllActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_unhighlightAllActionPerformed	{//GEN-HEADEREND:event_unhighlightAllActionPerformed		clearAllHighlight();	}//GEN-LAST:event_unhighlightAllActionPerformed	private void makeInvisibleActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_makeInvisibleActionPerformed	{//GEN-HEADEREND:event_makeInvisibleActionPerformed		setVisibility(false);	}//GEN-LAST:event_makeInvisibleActionPerformed	private void makeVisibleActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_makeVisibleActionPerformed	{//GEN-HEADEREND:event_makeVisibleActionPerformed		setVisibility(true);	}//GEN-LAST:event_makeVisibleActionPerformed	private void selectAllActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_selectAllActionPerformed	{//GEN-HEADEREND:event_selectAllActionPerformed		selectAll();	}//GEN-LAST:event_selectAllActionPerformed    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JCheckBox annotationText;    private javax.swing.JCheckBox arcText;    private javax.swing.JCheckBox cellText;    private javax.swing.JCheckBox exportText;    private javax.swing.JCheckBox instanceNames;    private javax.swing.JPanel jPanel1;    private javax.swing.JPanel jPanel2;    private javax.swing.JScrollPane layerPane;    private javax.swing.JButton makeInvisible;    private javax.swing.JButton makeVisible;    private javax.swing.JCheckBox nodeText;    private javax.swing.JSlider opacitySlider;    private javax.swing.JCheckBox portText;    private javax.swing.JButton resetOpacity;    private javax.swing.JButton selectAll;    private javax.swing.JComboBox technology;    private javax.swing.JButton toggleHighlight;    private javax.swing.JButton unhighlightAll;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

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