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

📄 tabsevents.java

📁 270的linux说明
💻 JAVA
字号:
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*/import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTabbedPane;import javax.swing.JTextArea;/* * Created on 2004-11-26 * * Window - Preferences - Java - Code Style - Code Templates *//** * @ * * Window - Preferences - Java - Code Style - Code Templates */public class tabsEvents extends JPanel {	private JTabbedPane jTabbedPane = null;	private JPanel EventPanel=null;	private JPanel ThresholdPanel=null;	private JScrollPane jEventScrollPane = null;	private JScrollPane jThresholdScrollPane = null;	public JTextArea jTextArea = null;	public JTextArea jTextArea1 = null;	private javax.swing.JPopupMenu jPopupMenu = null;	private javax.swing.JMenuItem jMenuItem = null;		/**	 * This is the default constructor	 */	public tabsEvents() {		super();		initialize();	}	/**	 * This method initializes this	 * 	 * @return void	 */	private  void initialize() {		this.setLayout(new BorderLayout());		this.setSize(600, 300);		this.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);	}	/**	 * This method initializes jTabbedPane		 * 		 * @return javax.swing.JTabbedPane		 */    	private JTabbedPane getJTabbedPane() {		if (jTabbedPane == null) {			jTabbedPane = new JTabbedPane();			jTabbedPane.setTabPlacement(JTabbedPane.BOTTOM);			jTabbedPane.addTab("Event",getEventJScrollPane());			jTabbedPane.addTab("Threshold",getThresholdJScrollPane());		}		return jTabbedPane;	}		private JPanel getEventPanel()	{		if(EventPanel==null)		{			EventPanel=new JPanel();			EventPanel.setSize(600,300);			EventPanel.setLayout(new BorderLayout());			this.add(getEventJScrollPane(), BorderLayout.CENTER);			//EventPanel.add(getJTextArea(), java.awt.BorderLayout.CENTER);		}				return EventPanel;	}		/**     * This method initializes jScrollPane     *      * @return javax.swing.JScrollPane     */    private JScrollPane getEventJScrollPane()    {        if (jEventScrollPane == null)        {        	jEventScrollPane = new JScrollPane();        	jEventScrollPane.setSize(600,300);        	jEventScrollPane.setViewportView(getJTextArea());        }        return jEventScrollPane;    }        /**     * This method initializes jScrollPane     *      * @return javax.swing.JScrollPane     */    private JScrollPane getThresholdJScrollPane()    {        if (jThresholdScrollPane == null)        {        	jThresholdScrollPane = new JScrollPane();        	jThresholdScrollPane.setSize(600,300);        	jThresholdScrollPane.setViewportView(getJTextArea1());        	//jThresholdScrollPane.add(getJTextArea1());        }        return jThresholdScrollPane;    }		private JPanel getThresholdPanel()	{		if(ThresholdPanel==null)		{			ThresholdPanel=new JPanel();			ThresholdPanel.setSize(600,300);			ThresholdPanel.setLayout(new BorderLayout());			this.add(getThresholdJScrollPane(), BorderLayout.CENTER);			//ThresholdPanel.add(getJTextArea1(), java.awt.BorderLayout.CENTER);		}				return ThresholdPanel;	}	/**	 * This method initializes jTextArea		 * 		 * @return javax.swing.JTextArea		 */    	private JTextArea getJTextArea() {		if (jTextArea == null) {			jTextArea = new JTextArea();			jTextArea.setEditable(false);			jTextArea.setSize(600,300);			jTextArea.addMouseListener(new java.awt.event.MouseAdapter() 		        	{ 						public void mouseClicked(java.awt.event.MouseEvent e) 						{							if(e.getButton() == MouseEvent.BUTTON3)							{								getJPopupMenu().show(e.getComponent(),e.getX(),e.getY());							}						}					}		        	);		}		return jTextArea;	}		private JTextArea getJTextArea1() {		if (jTextArea1 == null) {			jTextArea1 = new JTextArea();			jTextArea1.setEditable(false);			jTextArea1.setSize(600,300);			jTextArea1.addMouseListener(new java.awt.event.MouseAdapter() 		        	{ 						public void mouseClicked(java.awt.event.MouseEvent e) 						{							if(e.getButton() == MouseEvent.BUTTON3)							{								getJPopupMenu().show(e.getComponent(),e.getX(),e.getY());							}						}					}		        	);		}		return jTextArea1;	}		/**	 * This method initializes jPopupMenu	 * 	 * @return javax.swing.JPopupMenu	 */	private javax.swing.JPopupMenu getJPopupMenu() {		if(jPopupMenu == null) {			jPopupMenu = new javax.swing.JPopupMenu();			jPopupMenu.add(getJMenuItem());			jPopupMenu.setVisible(true);		}		return jPopupMenu;	}	/**	 * This method initializes jMenuItem	 * 	 * @return javax.swing.JMenuItem	 */	private javax.swing.JMenuItem getJMenuItem() {		if(jMenuItem == null) {			jMenuItem = new javax.swing.JMenuItem();			jMenuItem.setVisible(true);			jMenuItem.setText("Clear");						jMenuItem.addActionListener (new ActionListener() {				public void actionPerformed (ActionEvent e) {                    					clearLog();                    				}			});					}		return jMenuItem;	}		private void clearLog()	{		if(jTabbedPane.getSelectedIndex()==0)		{			jTextArea.setText("");		}else if(jTabbedPane.getSelectedIndex()==1)		{			jTextArea1.setText("");		}	}  }  //  @jve:decl-index=0:visual-constraint="10,10"

⌨️ 快捷键说明

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