fasthenrytab.java

来自「The ElectricTM VLSI Design System is an 」· Java 代码 · 共 404 行 · 第 1/2 页

JAVA
404
字号
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: FastHenryTab.java * * Copyright (c) 2004 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.tool.user.dialogs.options;import com.sun.electric.database.text.TextUtils;import com.sun.electric.tool.simulation.Simulation;import com.sun.electric.tool.user.dialogs.EDialog;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JPanel;/** * Class to handle the "FastHenry" tab of the Preferences dialog. */public class FastHenryTab extends PreferencePanel{	/** Creates new form FastHenryTab */	public FastHenryTab(java.awt.Frame parent, boolean modal)	{		super(parent, modal);		initComponents();		// make all text fields select-all when entered	    EDialog.makeTextFieldSelectAllOnTab(fhFrequencyStart);	    EDialog.makeTextFieldSelectAllOnTab(fhFrequencyEnd);	    EDialog.makeTextFieldSelectAllOnTab(fhRunsPerDecade);	    EDialog.makeTextFieldSelectAllOnTab(fhNumberOfPoles);	    EDialog.makeTextFieldSelectAllOnTab(fhDefaultThickness);	    EDialog.makeTextFieldSelectAllOnTab(fhDefaultWidthSubs);	    EDialog.makeTextFieldSelectAllOnTab(fhDefaultHeightSubs);	    EDialog.makeTextFieldSelectAllOnTab(fhMaxSegmentLength);	}	/** return the panel to use for this preferences tab. */	public JPanel getPanel() { return fastHenry; }	/** return the name of this preferences tab. */	public String getName() { return "Fast Henry"; }	/**	 * Method called at the start of the dialog.	 * Caches current values and displays them in the Fast Henry tab.	 */	public void init()	{		fhUseSingleFrequency.setSelected(Simulation.isFastHenryUseSingleFrequency());		fhUseSingleFrequency.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { updateWhatIsEnabled(); }		});		fhFrequencyStart.setText(TextUtils.formatDouble(Simulation.getFastHenryStartFrequency()));		fhFrequencyEnd.setText(TextUtils.formatDouble(Simulation.getFastHenryEndFrequency()));		fhRunsPerDecade.setText(Integer.toString(Simulation.getFastHenryRunsPerDecade()));		fhMakeMultipole.setSelected(Simulation.isFastHenryMultiPole());		fhMakeMultipole.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt) { updateWhatIsEnabled(); }		});		fhNumberOfPoles.setText(Integer.toString(Simulation.getFastHenryNumPoles()));		fhDefaultThickness.setText(TextUtils.formatDouble(Simulation.getFastHenryDefThickness()));		fhDefaultWidthSubs.setText(Integer.toString(Simulation.getFastHenryWidthSubdivisions()));		fhDefaultHeightSubs.setText(Integer.toString(Simulation.getFastHenryHeightSubdivisions()));		fhMaxSegmentLength.setText(TextUtils.formatDouble(Simulation.getFastHenryMaxSegLength()));		updateWhatIsEnabled();	}	private void updateWhatIsEnabled()	{		fhFrequencyEnd.setEnabled(!fhUseSingleFrequency.isSelected());		fhFreqEndLabel.setEnabled(!fhUseSingleFrequency.isSelected());		fhRunsPerDecade.setEnabled(!fhUseSingleFrequency.isSelected());		fhRunsPerDecadeLabel.setEnabled(!fhUseSingleFrequency.isSelected());		fhNumberOfPoles.setEnabled(fhMakeMultipole.isSelected());		fhNumPolesLabel.setEnabled(fhMakeMultipole.isSelected());	}	/**	 * Method called when the "OK" panel is hit.	 * Updates any changed fields in the Fast Henry tab.	 */	public void term()	{		boolean currBoolean = fhUseSingleFrequency.isSelected();		if (currBoolean != Simulation.isFastHenryUseSingleFrequency())			Simulation.setFastHenryUseSingleFrequency(currBoolean);		double currDouble = TextUtils.atof(fhFrequencyStart.getText());		if (currDouble != Simulation.getFastHenryStartFrequency())			Simulation.setFastHenryStartFrequency(currDouble);		currDouble = TextUtils.atof(fhFrequencyEnd.getText());		if (currDouble != Simulation.getFastHenryEndFrequency())			Simulation.setFastHenryEndFrequency(currDouble);		int currInt = TextUtils.atoi(fhRunsPerDecade.getText());		if (currInt != Simulation.getFastHenryRunsPerDecade())			Simulation.setFastHenryRunsPerDecade(currInt);		currBoolean = fhMakeMultipole.isSelected();		if (currBoolean != Simulation.isFastHenryMultiPole())			Simulation.setFastHenryMultiPole(currBoolean);		currInt = TextUtils.atoi(fhNumberOfPoles.getText());		if (currInt != Simulation.getFastHenryNumPoles())			Simulation.setFastHenryNumPoles(currInt);		currDouble = TextUtils.atof(fhDefaultThickness.getText());		if (currDouble != Simulation.getFastHenryDefThickness())			Simulation.setFastHenryDefThickness(currDouble);		currInt = TextUtils.atoi(fhDefaultWidthSubs.getText());		if (currInt != Simulation.getFastHenryWidthSubdivisions())			Simulation.setFastHenryWidthSubdivisions(currInt);		currInt = TextUtils.atoi(fhDefaultHeightSubs.getText());		if (currInt != Simulation.getFastHenryHeightSubdivisions())			Simulation.setFastHenryHeightSubdivisions(currInt);		currDouble = TextUtils.atof(fhMaxSegmentLength.getText());		if (currDouble != Simulation.getFastHenryMaxSegLength())			Simulation.setFastHenryMaxSegLength(currDouble);	}	/**	 * Method called when the factory reset is requested.	 */	public void reset()	{		if (Simulation.isFactoryFastHenryUseSingleFrequency() != Simulation.isFastHenryUseSingleFrequency())			Simulation.setFastHenryUseSingleFrequency(Simulation.isFactoryFastHenryUseSingleFrequency());		if (Simulation.getFactoryFastHenryDefThickness() != Simulation.getFastHenryDefThickness())			Simulation.setFastHenryDefThickness(Simulation.getFactoryFastHenryDefThickness());		if (Simulation.getFactoryFastHenryStartFrequency() != Simulation.getFastHenryStartFrequency())			Simulation.setFastHenryStartFrequency(Simulation.getFactoryFastHenryStartFrequency());		if (Simulation.getFactoryFastHenryEndFrequency() != Simulation.getFastHenryEndFrequency())			Simulation.setFastHenryEndFrequency(Simulation.getFactoryFastHenryEndFrequency());		if (Simulation.getFactoryFastHenryRunsPerDecade() != Simulation.getFastHenryRunsPerDecade())			Simulation.setFastHenryRunsPerDecade(Simulation.getFactoryFastHenryRunsPerDecade());		if (Simulation.getFactoryFastHenryWidthSubdivisions() != Simulation.getFastHenryWidthSubdivisions())			Simulation.setFastHenryWidthSubdivisions(Simulation.getFactoryFastHenryWidthSubdivisions());		if (Simulation.getFactoryFastHenryHeightSubdivisions() != Simulation.getFastHenryHeightSubdivisions())			Simulation.setFastHenryHeightSubdivisions(Simulation.getFactoryFastHenryHeightSubdivisions());		if (Simulation.getFactoryFastHenryMaxSegLength() != Simulation.getFastHenryMaxSegLength())			Simulation.setFastHenryMaxSegLength(Simulation.getFactoryFastHenryMaxSegLength());		if (Simulation.isFactoryFastHenryMultiPole() != Simulation.isFastHenryMultiPole())			Simulation.setFastHenryMultiPole(Simulation.isFactoryFastHenryMultiPole());		if (Simulation.getFactoryFastHenryNumPoles() != Simulation.getFastHenryNumPoles())			Simulation.setFastHenryNumPoles(Simulation.getFactoryFastHenryNumPoles());	}	/** 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;        fastHenry = new javax.swing.JPanel();        fhUseSingleFrequency = new javax.swing.JCheckBox();        jLabel55 = new javax.swing.JLabel();        fhFreqEndLabel = new javax.swing.JLabel();        fhRunsPerDecadeLabel = new javax.swing.JLabel();        fhMakeMultipole = new javax.swing.JCheckBox();        fhNumPolesLabel = new javax.swing.JLabel();        fhFrequencyStart = new javax.swing.JTextField();        fhFrequencyEnd = new javax.swing.JTextField();        fhRunsPerDecade = new javax.swing.JTextField();        fhNumberOfPoles = new javax.swing.JTextField();        jLabel59 = new javax.swing.JLabel();        jLabel60 = new javax.swing.JLabel();        jLabel61 = new javax.swing.JLabel();

⌨️ 快捷键说明

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