?? j3dviewdialog.java
字號:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: J3DViewDialog.java * * Copyright (c) 2003 Sun Microsystems and Static Free Software * * Electric(tm) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Electric(tm) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Electric(tm); see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, Mass 02111-1307, USA. */package com.sun.electric.plugins.j3d.ui;import com.sun.electric.database.text.TextUtils;import com.sun.electric.plugins.j3d.View3DWindow;import com.sun.electric.plugins.j3d.utils.J3DClientApp;import com.sun.electric.plugins.j3d.utils.J3DUtils;import com.sun.electric.tool.Job;import com.sun.electric.tool.user.dialogs.EDialog;import com.sun.electric.tool.user.ui.WindowContent;import com.sun.electric.tool.user.ui.WindowFrame;import java.util.ArrayList;import java.util.List;import java.util.Map;import javax.media.j3d.BranchGroup;import javax.media.j3d.TransformGroup;/** * Class to handle the "3D View Demo Dialog" dialog. * @author Gilda Garreton * @version 0.1 */public class J3DViewDialog extends EDialog{ private View3DWindow view3D = null; private J3DClientApp socketJob = null; private List<J3DUtils.ThreeDDemoKnot> knots = new ArrayList<J3DUtils.ThreeDDemoKnot>(); private Map<TransformGroup,BranchGroup> interMap; public static void create3DViewDialog(java.awt.Frame parent) { View3DWindow view3D = null; WindowContent content = WindowFrame.getCurrentWindowFrame().getContent(); if (content instanceof View3DWindow) view3D = (View3DWindow)content; else { System.out.println("Current Window Frame is not a 3D View"); return; } J3DViewDialog dialog = new J3DViewDialog(parent, view3D, false); dialog.setVisible(true); } /** Creates new form ThreeView */ public J3DViewDialog(java.awt.Frame parent, View3DWindow view3d, boolean modal) { super(parent, modal); initComponents(); this.view3D = view3d; getRootPane().setDefaultButton(connect);// spline.addItem("KB Spline");// spline.addItem("TCB Spline"); if (J3DUtils.jAlpha != null) { slider.addChangeListener(J3DUtils.jAlpha); auto.setSelected(J3DUtils.jAlpha.getAutoMode()); } // setting initial other values setOtherValues("?", "?"); // to calculate window position finishInitialization(); } public void socketAction(String inData) { String[] stringValues = J3DUtils.parseValues(inData, 0); xField.setText(stringValues[0]); yField.setText(stringValues[1]); zField.setText(stringValues[2]); xRotField.setText(stringValues[3]); yRotField.setText(stringValues[4]); zRotField.setText(stringValues[5]); xRotPosField.setText(stringValues[6]); yRotPosField.setText(stringValues[7]); zRotPosField.setText(stringValues[8]); setOtherValues(stringValues[9], stringValues[10]); double[] values = J3DUtils.convertValues(stringValues); knots.add(view3D.moveAndRotate(values)); } private void setOtherValues(String capacitance, String radius) { capacitanceLabel.setText("Capacitance: " + capacitance + " [fF]"); radiusLabel.setText("Radius: " + radius + " [mm]"); } protected void escapePressed() { closeActionPerformed(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. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; rotationPanel = new javax.swing.JPanel(); zRotPosLabelUnit = new javax.swing.JLabel(); yRotLabelUnit = new javax.swing.JLabel(); yRotPosLabelUnit = new javax.swing.JLabel(); xRotPosLabelUnit = new javax.swing.JLabel(); zRotLabelUnit = new javax.swing.JLabel(); xRotLabelUnit = new javax.swing.JLabel(); zRotPosField = new javax.swing.JTextField(); zRotPosLabel = new javax.swing.JLabel(); yRotPosField = new javax.swing.JTextField(); yRotPosLabel = new javax.swing.JLabel(); xRotPosField = new javax.swing.JTextField(); xRotPosLabel = new javax.swing.JLabel(); zRotField = new javax.swing.JTextField(); zRotLabel = new javax.swing.JLabel(); yRotField = new javax.swing.JTextField(); yRotLabel = new javax.swing.JLabel(); xRotField = new javax.swing.JTextField(); xRotLabel = new javax.swing.JLabel(); xRotBox = new javax.swing.JCheckBox(); yRotBox = new javax.swing.JCheckBox(); zRotBox = new javax.swing.JCheckBox(); positionPanel = new javax.swing.JPanel(); zLabelUnit = new javax.swing.JLabel(); yLabelUnit = new javax.swing.JLabel(); xLabelUnit = new javax.swing.JLabel(); zField = new javax.swing.JTextField(); zLabel = new javax.swing.JLabel(); yField = new javax.swing.JTextField(); yLabel = new javax.swing.JLabel(); xField = new javax.swing.JTextField(); xLabel = new javax.swing.JLabel(); xBox = new javax.swing.JCheckBox(); yBox = new javax.swing.JCheckBox(); zBox = new javax.swing.JCheckBox(); otherPanel = new javax.swing.JPanel(); capacitanceLabel = new javax.swing.JLabel(); radiusLabel = new javax.swing.JLabel(); separator = new javax.swing.JSeparator(); slider = new javax.swing.JSlider(); auto = new javax.swing.JCheckBox(); demo = new javax.swing.JButton(); separator1 = new javax.swing.JSeparator(); close = new javax.swing.JButton(); connect = new javax.swing.JButton(); enter = new javax.swing.JButton(); read = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("3D Capacitance Demo Control Dialog"); setBackground(java.awt.Color.white); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); rotationPanel.setLayout(new java.awt.GridBagLayout()); rotationPanel.setBorder(new javax.swing.border.TitledBorder("Rotation Values")); zRotPosLabelUnit.setText("[um]"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rotationPanel.add(zRotPosLabelUnit, gridBagConstraints); yRotLabelUnit.setText("[degrees]"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rotationPanel.add(yRotLabelUnit, gridBagConstraints); yRotPosLabelUnit.setText("[um]"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rotationPanel.add(yRotPosLabelUnit, gridBagConstraints); xRotPosLabelUnit.setText("[um]"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rotationPanel.add(xRotPosLabelUnit, gridBagConstraints); zRotLabelUnit.setText("[degrees]"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rotationPanel.add(zRotLabelUnit, gridBagConstraints); xRotLabelUnit.setText("[degrees]"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); rotationPanel.add(xRotLabelUnit, gridBagConstraints); zRotPosField.setPreferredSize(new java.awt.Dimension(60, 21)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -