📄 smarttexttab.java
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: SmartTextTab.java * * Copyright (c) 2006 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.tool.user.User;import javax.swing.JPanel;/** * Class to handle the "Smart Text" tab of the Preferences dialog. */public class SmartTextTab extends PreferencePanel{ /** Creates new form SmartTextTab */ public SmartTextTab(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** return the panel to use for this preferences tab. */ public JPanel getPanel() { return text; } /** return the name of this preferences tab. */ public String getName() { return "Smart Text"; } /** * Method called at the start of the dialog. * Caches current values and displays them in the Text tab. */ public void init() { // set arc defaults switch (User.getSmartVerticalPlacementArc()) { case 0: arcVerticalInside.setSelected(true); break; case 1: arcVerticalLeft.setSelected(true); break; case 2: arcVerticalRight.setSelected(true); break; } switch (User.getSmartHorizontalPlacementArc()) { case 0: arcHorizontalInside.setSelected(true); break; case 1: arcHorizontalAbove.setSelected(true); break; case 2: arcHorizontalBelow.setSelected(true); break; } // set export defaults switch (User.getSmartVerticalPlacementExport()) { case 0: textSmartVerticalOff.setSelected(true); break; case 1: textSmartVerticalInside.setSelected(true); break; case 2: textSmartVerticalOutside.setSelected(true); break; } switch (User.getSmartHorizontalPlacementExport()) { case 0: textSmartHorizontalOff.setSelected(true); break; case 1: textSmartHorizontalInside.setSelected(true); break; case 2: textSmartHorizontalOutside.setSelected(true); break; } } /** * Method called when the "OK" panel is hit. * Updates any changed fields in the Text tab. */ public void term() { // set arc changes int currInt = 0; if (arcVerticalLeft.isSelected()) currInt = 1; else if (arcVerticalRight.isSelected()) currInt = 2; if (currInt != User.getSmartVerticalPlacementArc()) User.setSmartVerticalPlacementArc(currInt); currInt = 0; if (arcHorizontalAbove.isSelected()) currInt = 1; else if (arcHorizontalBelow.isSelected()) currInt = 2; if (currInt != User.getSmartHorizontalPlacementArc()) User.setSmartHorizontalPlacementArc(currInt); // set export changes currInt = 0; if (textSmartVerticalInside.isSelected()) currInt = 1; else if (textSmartVerticalOutside.isSelected()) currInt = 2; if (currInt != User.getSmartVerticalPlacementExport()) User.setSmartVerticalPlacementExport(currInt); currInt = 0; if (textSmartHorizontalInside.isSelected()) currInt = 1; else if (textSmartHorizontalOutside.isSelected()) currInt = 2; if (currInt != User.getSmartHorizontalPlacementExport()) User.setSmartHorizontalPlacementExport(currInt); } /** * Method called when the factory reset is requested. */ public void reset() { if (User.getFactorySmartVerticalPlacementArc() != User.getSmartVerticalPlacementArc()) User.setSmartVerticalPlacementArc(User.getFactorySmartVerticalPlacementArc()); if (User.getFactorySmartHorizontalPlacementArc() != User.getSmartHorizontalPlacementArc()) User.setSmartHorizontalPlacementArc(User.getFactorySmartHorizontalPlacementArc()); if (User.getFactorySmartVerticalPlacementExport() != User.getSmartVerticalPlacementExport()) User.setSmartVerticalPlacementExport(User.getFactorySmartVerticalPlacementExport()); if (User.getFactorySmartHorizontalPlacementExport() != User.getSmartHorizontalPlacementExport()) User.setSmartHorizontalPlacementExport(User.getFactorySmartHorizontalPlacementExport()); } /** 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; arcVerticalGroup = new javax.swing.ButtonGroup(); arcHorizontalGroup = new javax.swing.ButtonGroup(); exportVerticalGroup = new javax.swing.ButtonGroup(); exportHorizontalGroup = new javax.swing.ButtonGroup(); text = new javax.swing.JPanel(); exportText = new javax.swing.JPanel(); jLabel56 = new javax.swing.JLabel(); textSmartVerticalOff = new javax.swing.JRadioButton(); textSmartVerticalInside = new javax.swing.JRadioButton(); textSmartVerticalOutside = new javax.swing.JRadioButton(); jLabel57 = new javax.swing.JLabel(); textSmartHorizontalOff = new javax.swing.JRadioButton(); textSmartHorizontalInside = new javax.swing.JRadioButton(); textSmartHorizontalOutside = new javax.swing.JRadioButton(); arcText = new javax.swing.JPanel(); jLabel58 = new javax.swing.JLabel(); arcVerticalInside = new javax.swing.JRadioButton(); arcVerticalLeft = new javax.swing.JRadioButton(); arcVerticalRight = new javax.swing.JRadioButton(); jLabel59 = new javax.swing.JLabel(); arcHorizontalInside = new javax.swing.JRadioButton(); arcHorizontalAbove = new javax.swing.JRadioButton(); arcHorizontalBelow = new javax.swing.JRadioButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); 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); } }); text.setLayout(new java.awt.GridBagLayout()); exportText.setLayout(new java.awt.GridBagLayout()); exportText.setBorder(javax.swing.BorderFactory.createTitledBorder("Smart Placement of Export Text")); jLabel56.setText("Near cell top/bottom:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4); exportText.add(jLabel56, gridBagConstraints); exportVerticalGroup.add(textSmartVerticalOff); textSmartVerticalOff.setText("Off"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -