📄 threedtab.java
字号:
} } // the MouseListener events public void mousePressed(MouseEvent evt) { Dimension dim = getSize(); String layerName = (String)dialog.threeDLayerList.getSelectedValue(); Layer selectedLayer = dialog.curTech.findLayer(layerName); GenMath.MutableDouble height = dialog.threeDDistanceMap.get(selectedLayer); int yValue = dim.height - (int)((height.doubleValue() - lowHeight) / (highHeight - lowHeight) * dim.height + 0.5); if (Math.abs(yValue - evt.getY()) > 5) { int bestDist = dim.height; for(Iterator<Layer> it = dialog.curTech.getLayers(); it.hasNext(); ) { Layer layer = it.next(); if (layer.isPseudoLayer()) continue; height = dialog.threeDDistanceMap.get(layer); yValue = dim.height - (int)((height.doubleValue() - lowHeight) / (highHeight - lowHeight) * dim.height + 0.5); int dist = Math.abs(yValue - evt.getY()); if (dist < bestDist) { bestDist = dist; selectedLayer = layer; } } dialog.threeDLayerList.setSelectedValue(selectedLayer.getName(), true); dialog.threeDValuesChanged(false); } } public void mouseReleased(MouseEvent evt) {} public void mouseClicked(MouseEvent evt) {} public void mouseEntered(MouseEvent evt) {} public void mouseExited(MouseEvent evt) {} // the MouseMotionListener events public void mouseMoved(MouseEvent evt) {} public void mouseDragged(MouseEvent evt) { Dimension dim = getSize(); String layerName = (String)dialog.threeDLayerList.getSelectedValue(); Layer layer = dialog.curTech.findLayer(layerName); GenMath.MutableDouble height = threeDDistanceMap.get(layer); double newHeight = (double)(dim.height - evt.getY()) / dim.height * (highHeight - lowHeight) + lowHeight; if (height.doubleValue() != newHeight) { height.setValue(newHeight); dialog.threeDHeight.setText(TextUtils.formatDouble(newHeight)); repaint(); } } } /** * Class to handle changes to the thickness or height. */ private static class ThreeDInfoDocumentListener implements DocumentListener { ThreeDTab dialog; ThreeDInfoDocumentListener(ThreeDTab dialog) { this.dialog = dialog; } public void changedUpdate(DocumentEvent e) { dialog.threeDValuesChanged(true); } public void insertUpdate(DocumentEvent e) { dialog.threeDValuesChanged(true); } public void removeUpdate(DocumentEvent e) { dialog.threeDValuesChanged(true); } } private void threeDValuesChanged(boolean set) { if (!set) initial3DTextChanging = true; else if (initial3DTextChanging) return; String layerName = (String)threeDLayerList.getSelectedValue(); Layer layer = curTech.findLayer(layerName); if (layer == null) return; GenMath.MutableDouble thickness = threeDThicknessMap.get(layer); GenMath.MutableDouble height = threeDDistanceMap.get(layer); if (set) { thickness.setValue(TextUtils.atof(threeDThickness.getText())); height.setValue(TextUtils.atof(threeDHeight.getText())); } else { threeDHeight.setText(TextUtils.formatDouble(height.doubleValue())); threeDThickness.setText(TextUtils.formatDouble(thickness.doubleValue())); } if (!set) initial3DTextChanging = false; threeDSideView.repaint(); } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the 3D tab. */ public void term() { for(Iterator<Layer> it = curTech.getLayers(); it.hasNext(); ) { Layer layer = it.next(); if (layer.isPseudoLayer()) continue; GenMath.MutableDouble thickness = threeDThicknessMap.get(layer); GenMath.MutableDouble height = threeDDistanceMap.get(layer); if (thickness.doubleValue() != layer.getThickness()) layer.setThickness(thickness.doubleValue()); if (height.doubleValue() != layer.getDistance()) layer.setDistance(height.doubleValue()); } } /** * Method called when the factory reset is requested. */ public void reset() { for(Iterator<Layer> it = curTech.getLayers(); it.hasNext(); ) { Layer layer = it.next(); if (layer.isPseudoLayer()) continue; if (layer.getFactoryThickness() != layer.getThickness()) layer.setThickness(layer.getFactoryThickness()); if (layer.getFactoryDistance() != layer.getDistance()) layer.setDistance(layer.getFactoryDistance()); } } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; threeD = new javax.swing.JPanel(); threeDTechnology = new javax.swing.JLabel(); threeDLayerPane = new javax.swing.JScrollPane(); jLabel45 = new javax.swing.JLabel(); jLabel47 = new javax.swing.JLabel(); threeDThickness = new javax.swing.JTextField(); threeDHeight = new javax.swing.JTextField(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Edit Options"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); threeD.setLayout(new java.awt.GridBagLayout()); threeDTechnology.setText("Layer cross section for technology:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); threeD.add(threeDTechnology, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.5; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); threeD.add(threeDLayerPane, gridBagConstraints); jLabel45.setText("Thickness:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); threeD.add(jLabel45, gridBagConstraints); jLabel47.setText("Distance:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); threeD.add(jLabel47, gridBagConstraints); threeDThickness.setColumns(6); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); threeD.add(threeDThickness, gridBagConstraints); threeDHeight.setColumns(6); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); threeD.add(threeDHeight, gridBagConstraints); getContentPane().add(threeD, new java.awt.GridBagConstraints()); pack(); }//GEN-END:initComponents /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { setVisible(false); dispose(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel45; private javax.swing.JLabel jLabel47; private javax.swing.JPanel threeD; private javax.swing.JTextField threeDHeight; private javax.swing.JScrollPane threeDLayerPane; private javax.swing.JLabel threeDTechnology; private javax.swing.JTextField threeDThickness; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -