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

📄 statusbar.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* -*- tab-width: 4 -*- * * Electric(tm) VLSI Design System * * File: StatusBar.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.tool.user.ui;import com.sun.electric.database.change.DatabaseChangeEvent;import com.sun.electric.database.change.DatabaseChangeListener;import com.sun.electric.database.hierarchy.Cell;import com.sun.electric.database.hierarchy.Export;import com.sun.electric.database.network.Netlist;import com.sun.electric.database.network.Network;import com.sun.electric.database.prototype.PortProto;import com.sun.electric.database.text.TextUtils;import com.sun.electric.database.topology.ArcInst;import com.sun.electric.database.topology.NodeInst;import com.sun.electric.database.topology.PortInst;import com.sun.electric.database.variable.ElectricObject;import com.sun.electric.technology.ArcProto;import com.sun.electric.technology.PrimitiveNodeSize;import com.sun.electric.technology.PrimitivePort;import com.sun.electric.technology.Technology;import com.sun.electric.technology.technologies.Generic;import com.sun.electric.tool.Client;import com.sun.electric.tool.user.Highlight2;import com.sun.electric.tool.user.HighlightListener;import com.sun.electric.tool.user.Highlighter;import com.sun.electric.tool.user.UserInterfaceMain;import java.awt.Dimension;import java.awt.FontMetrics;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Rectangle;import java.awt.geom.Rectangle2D;import java.util.Iterator;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.SwingUtilities;import javax.swing.border.BevelBorder;/** * This class manages the Electric status bar at the bottom of the edit window. */public class StatusBar extends JPanel implements HighlightListener, DatabaseChangeListener{	private WindowFrame frame;	private String coords = null;	private String hierCoords = null;	private JLabel fieldSelected, fieldSize, fieldTech, fieldCoords, fieldHierCoords;	private static String selectionOverride = null;	public StatusBar(WindowFrame frame)	{		super(new GridBagLayout());		setBorder(new BevelBorder(BevelBorder.LOWERED));		this.frame = frame;		fieldSelected = new JLabel();		addField(fieldSelected, 0, 0, 1);		fieldSize = new JLabel();		Dimension d = new Dimension(300, 16);        fieldSize.setMinimumSize(d);        fieldSize.setMaximumSize(d);        fieldSize.setPreferredSize(d);		addField(fieldSize, 1, 0, 1);        fieldTech = new JLabel();        d = new Dimension (400, 16);        fieldTech.setMinimumSize(d);        fieldTech.setMaximumSize(d);        fieldTech.setPreferredSize(d);        addField(fieldTech, 2, 0, 1);        fieldCoords = new JLabel();        fieldCoords.setMinimumSize(new Dimension(100, 16));        fieldCoords.setMaximumSize(new Dimension(500, 16));        fieldCoords.setPreferredSize(new Dimension(140, 16));        fieldCoords.setHorizontalAlignment(JLabel.RIGHT);		addField(fieldCoords, 3, 0, 1);		fieldHierCoords = new JLabel(" ");		fieldHierCoords.setHorizontalAlignment(JLabel.RIGHT);		addField(fieldHierCoords, 0, 1, 4);        // add myself as listener for highlight changes in SDI mode        if (TopLevel.isMDIMode()) {            // do nothing        } else if (frame.getContent().getHighlighter() != null) {            Highlighter.addHighlightListener(this);        }        UserInterfaceMain.addDatabaseChangeListener(this);	}	private void addField(JLabel field, int x, int y, int width)	{		GridBagConstraints gbc = new GridBagConstraints();		gbc.gridx = x;   gbc.gridy = y;		gbc.gridwidth = width;        if (x == 0)        {            gbc.weightx = 0.2;            gbc.fill = GridBagConstraints.HORIZONTAL;        }        gbc.anchor = GridBagConstraints.WEST;        int rightInsert = (Client.isOSMac()) ? 20 : 4;        gbc.insets = new java.awt.Insets(0, 4, 0, rightInsert);		add(field, gbc);	}    /**     * Highlighter depends on MDI or SDI mode.     * @return the highlighter to use. May be null if none.     */    private Highlighter getHighlighter() {        if (TopLevel.isMDIMode()) {            // get current internal frame highlighter            EditWindow wnd = EditWindow.getCurrent();            if (wnd == null) return null;            return wnd.getHighlighter();        }        return frame.getContent().getHighlighter();    }	public static void setCoordinates(String coords, WindowFrame wf)	{		StatusBar sb = null;		if (TopLevel.isMDIMode())		{			sb = TopLevel.getCurrentJFrame().getStatusBar();		} else		{			sb = wf.getFrame().getStatusBar();		}		sb.coords = coords;		sb.redoStatusBar();	}	public static void setHierarchicalCoordinates(String hierCoords, WindowFrame wf)	{		StatusBar sb = null;		if (TopLevel.isMDIMode())		{			sb = TopLevel.getCurrentJFrame().getStatusBar();		} else		{			sb = wf.getFrame().getStatusBar();		}		sb.hierCoords = hierCoords;		sb.redoStatusBar();	}	public static void setSelectionOverride(String ov)	{		selectionOverride = ov;		updateStatusBar();	}    public void highlightChanged(Highlighter which)    {        updateSelectedText();    }    /**     * Called when by a Highlighter when it loses focus. The argument     * is the Highlighter that has gained focus (may be null).     * @param highlighterGainedFocus the highlighter for the current window (may be null).     */    public void highlighterLostFocus(Highlighter highlighterGainedFocus) {}	/**	 * Method to update the status bar from current values.	 * Call this when any of those values change.	 */	public static void updateStatusBar()	{		if (TopLevel.isMDIMode())		{			StatusBar sb = TopLevel.getCurrentJFrame().getStatusBar();			sb.redoStatusBar();		} else		{			for(Iterator<WindowFrame> it = WindowFrame.getWindows(); it.hasNext(); )			{				WindowFrame wf = it.next();				StatusBar sb = wf.getFrame().getStatusBar();                if (sb != null)				    sb.redoStatusBar();			}		}	}	private void redoStatusBar()	{        updateSelectedText();        		Cell cell = null;		WindowFrame thisFrame = frame;		if (thisFrame == null)		{			thisFrame = WindowFrame.getCurrentWindowFrame(false);			if (thisFrame != null) cell = thisFrame.getContent().getCell();		} else		{			Cell cellInPanel = thisFrame.getContent().getCell();			if (cellInPanel != null) cell = cellInPanel;		}		String sizeMsg = "";		if (cell != null)		{

⌨️ 快捷键说明

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