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

📄 jbrowse.java

📁 java写的多功能文件编辑器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			if (results.getErrorCount() > 0) {				errorLabel.setText( "" + results.getErrorCount() + " error(s)");				errorLabel.setVisible(true);				topPanel.validate();				Dimension dFrame    = getSize();				Dimension dTopPanel = topPanel.getPreferredSize();				if (dFrame.width < dTopPanel.width + 8) {					setPreferredSize();				}			} else {				errorLabel.setVisible(false);			}//%			log(7, this, "DONE. (" + curTokenLine + " lines, "//%					+ tokenCount + " tokens.)\n"//%					+ "\n             Classes: " + results.getClassCount//%					+ "\n          Interfaces: " + results.getInterfaceCount//%					+ "\n   Object Attributes: " + results.getObjAttrCount//%					+ "\nPrimitive Attributes: " + results.getPrimAttrCount//%					+ "\n             Methods: " + results.getMethodCount//%//%					+ "\n\n              Errors: " + results.geterrorCount//%					+ "\n\n     Final state was: " + parseState + " " + parseSubState//%					+ "\n         Brace Count: " + methodBraceCount//%					+ "\n  curElementStartPos: " + curElementStartPos//%					+ "\n	        memberMod: " + memberMod//%					+ "\n	       memberType: " + memberType//%					+ "\n	       memberName: " + memberName );			if ( results.getClassCount() + results.getInterfaceCount() == 0)				getToolkit().beep();		} // if (results != null) - required until File parser is implemented (???)	} // showResults(JBrowseParser.Results): void	//=========================================================================	/**	 * This class defines the JPanel that provides the gui content of the	 * JBrowse dialog (the actual tree display).	 */	class TreePane extends JPanel	{		//---------------------------------------------------------------------		/**		 * Creates a new JBrowse.TreePane. This is called in the in the		 * JBrowse constructor.		 * @param name The internal name		 */		public TreePane(String title)		{			super();			this.setName(title);			this.setLayout(new BorderLayout());			// Define and add JButtons for Action Panel			URL url;			url = this.getClass().getResource("Parse.gif");			if (url == null) {				parseBtn = new JextHighlightButton("Parse");			} else {				parseBtn  = new JextButton( new ImageIcon(url) );			}			url = this.getClass().getResource("Resize.gif");			if (url == null) {				resizeBtn = new JextHighlightButton("Resize");			} else {				resizeBtn = new JextButton( new ImageIcon(url) );			}			url = this.getClass().getResource("Config.gif");			if (url == null) {				configBtn = new JextHighlightButton("Config");			} else {				configBtn = new JextButton( new ImageIcon(url) );			}			Insets zeroMargin = new Insets(0, 0, 0, 0);			parseBtn.setMargin(zeroMargin);			resizeBtn.setMargin(zeroMargin);			configBtn.setMargin(zeroMargin);			parseBtn.setToolTipText("Parse the buffer");			resizeBtn.setToolTipText("Adjust width");			configBtn.setToolTipText("Set Options");			parseBtn.addActionListener(JBrowse.this);			resizeBtn.addActionListener(JBrowse.this);			configBtn.addActionListener(JBrowse.this);			// Error Indicator			errorLabel = new JLabel(UML.Type.ERROR.getIcon());			errorLabel.setIconTextGap(2);//			errorLabel.setToolTipText();			errorLabel.setFont(new Font("Helvetica", Font.PLAIN, 11));			// Build Top Panel for BorderLayout			JPanel leftPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 1));			leftPanel.add(parseBtn);			leftPanel.add(resizeBtn);			leftPanel.add(configBtn);			leftPanel.add(errorLabel);			topPanel = new JPanel( new BorderLayout(0, 0) );			topPanel.add(leftPanel,  BorderLayout.WEST);			this.add(topPanel, BorderLayout.NORTH);			scpTreePane = new JScrollPane(umlTree);			this.add(scpTreePane, BorderLayout.CENTER);		} // TreePane(String): <init>		//---------------------------------------------------------------------		/**		 * The initialization process for the TreePane, called as the last		 * step of the constructor.		 */		private void init()		{			//JBrowse.this.getRootPane().setDefaultButton(parseBtn);			// Status Panel			statusPanel = new JPanel(new GridLayout(1, 4, 0, 1));			classLabel     = new JLabel(UML.Type.CLASS.getIcon());			interfaceLabel = new JLabel(UML.Type.INTERFACE.getIcon());			attributeLabel = new JLabel(UML.Type.ATTRIBUTE.getIcon());			methodLabel    = new JLabel(UML.Type.METHOD.getIcon());			classLabel.setIconTextGap(2);			interfaceLabel.setIconTextGap(2);			attributeLabel.setIconTextGap(2);			methodLabel.setIconTextGap(2);			classLabel.setToolTipText("classes");			interfaceLabel.setToolTipText("interfaces");			attributeLabel.setToolTipText("attributes");			methodLabel.setToolTipText("methods");			classLabel.setBorder(new EtchedBorder());			interfaceLabel.setBorder(new EtchedBorder());			attributeLabel.setBorder(new EtchedBorder());			methodLabel.setBorder(new EtchedBorder());			Font monoFont = new Font("Monospaced", Font.PLAIN, 11);			classLabel.setFont(monoFont);			interfaceLabel.setFont(monoFont);			attributeLabel.setFont(monoFont);			methodLabel.setFont(monoFont);			statusPanel.add(classLabel);			statusPanel.add(interfaceLabel);			statusPanel.add(attributeLabel);			statusPanel.add(methodLabel);			this.add(statusPanel, BorderLayout.SOUTH);			if (options.getShowStatusBar() ) {				statusPanel.setVisible(true);			} else {				statusPanel.setVisible(false);			}			// Setup Tree			fileName = parser.getSourceName(); // get fileName			// set root node to file name//			if (!fileName.toUpperCase().endsWith(".JAVA") ) {			if (!((parser instanceof JBrowseLineParser			 && ((JBrowseLineParser)parser).usesJavaTokenMarker())			 || (fileName.toUpperCase().endsWith(".JAVA"))))			{				// N.B. some JDK's (1.1.x) will not compile += for a reference				// to a private member of an enclosing class.				fileName = fileName + " (NON-java file?)";				hasJavaFileExtension = false;				errorLabel.setText("" + "Un-parsed");				topPanel.validate();			} else {				hasJavaFileExtension = true;			}			root = new UMLTree.Node(fileName);			// get tree model and tree			treeModel = new UMLTree.Model(root);			//setDefaultCloseOperation(DISPOSE_ON_CLOSE);		} // init(): void	} // public class JBrowse.TreePane extends JPanel	//=========================================================================	public static interface Activator	{		public Frame getOwner();		public PropertyAccessor getPropertyAccessor();		public JBrowseParser getJBrowseParser();		public UMLTree getUMLTree();	} // public static interface JBrowse.Activator	//-------------------------------------------------------------------------	PropertyAccessor getPropertyAccessor() { return props; }	//=========================================================================	static class OptionDialog extends JDialog implements ActionListener	{		private JBrowse parent;		JBrowseOptionPane optionPane;		// private members		private JButton btnSetAsDefaults;		private JButton btnRestoreDefaults;		//---------------------------------------------------------------------		OptionDialog(Frame jparent, JBrowse parent, String title)		{			super(jparent, title, true);			this.parent = parent;/*			parent.addWindowListener(new WindowAdapter() {					public void windowClosed(WindowEvent e) {						dispose();					}			} );*/			optionPane = new JBrowseOptionPane("jbrowse_options");			optionPane.setPropertyAccessor(parent.getPropertyAccessor());			optionPane.load();			getContentPane().setLayout(new BorderLayout());			getContentPane().add(BorderLayout.CENTER, optionPane);			JPanel buttons = new JPanel();            btnSetAsDefaults = new JextHighlightButton("Set As Defaults");			btnSetAsDefaults.addActionListener(this);			buttons.add(btnSetAsDefaults);			btnRestoreDefaults = new JextHighlightButton("Restore Defaults");			btnRestoreDefaults.addActionListener(this);			buttons.add(btnRestoreDefaults);			getContentPane().add(BorderLayout.SOUTH, buttons);//			addKeyListener(this);//			addWindowListener(this);		} // OptionDialog(JBrowse, String): <init>		/**		 * Returns the option object associated with this OptionDialog's		 * JBrowseOptionPane.		 */		Options getOptions() { return optionPane.getOptions(); }		//---------------------------------------------------------------------		/**		 * Sets the state of the option object associated with this JBrowse		 * session's JBrowseOptionPane to that pane's current state as specified		 * by its GUI.		 */		void setOptions() { optionPane.setOptions(); }		//--------------------------------------------------------------------		void reInit()		{			// set optionPane GUI state to the inital model (as defined in properties)			if (!optionPane.isInitGui() ) {				optionPane.initGui();				pack();			}			// Synchronize Options object and JBrowseOptionPane to property values.			if (!optionPane.isInitModel() ) {				optionPane.initModel();				getOptions().addChangeListener( parent.getOptionListener() );			}		} // reInit(): void		//--------------------------------------------------------------------		public void actionPerformed(ActionEvent evt)		{			Object source = evt.getSource();			if (source == btnSetAsDefaults) {				optionPane.save();			} else if(source == btnRestoreDefaults) {				boolean wasShowingStatusBar = getOptions().getShowStatusBar();				optionPane.load();				optionPane.initModel();				parent.showResults(parent.results);				// Display or hide the status bar				boolean setShowingStatusBar = getOptions().getShowStatusBar();				if (wasShowingStatusBar != setShowingStatusBar ) {					if ( setShowingStatusBar ) {						parent.statusPanel.setVisible(true);					} else {						parent.statusPanel.setVisible(false);					}					parent.setPreferredSize();				}			}		} // actionPerformed(ActionEvent): void	} // static class JBrowse.OptionDialog} // public class JBrowse extends JDialog// End of JBrowse.java

⌨️ 快捷键说明

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