📄 findtool.java
字号:
/************************************************************************************** 类名: FindTool * * 功能: 此类的主要功能为作为“查找对话框”类的工具类,此类作为一个方法封装类,其中* 的所有实现方法都是提供给“查找对话框”类及其相关联类所使用,此类实现了* FindTools接口* **************************************************************************************/package edit.com;import javax.swing.JComboBox;import javax.swing.JLabel;import java.awt.Font;import java.awt.Color;import java.awt.event.ItemListener;import java.awt.Dimension;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.Box;import javax.swing.JCheckBox;import javax.swing.JOptionPane;import java.awt.Component;class FindTool extends NewTool implements FindTools{ public void addItems( JComboBox findText ) { String editText = ( String )findText.getSelectedItem(); for ( int i = 0 ; i < findText.getItemCount() ; i++ ) { if ( ( editText.equals( ( String )findText.getItemAt( i ) ) ) || ( editText.equals( "" ) ) ) { return; } } findText.addItem( editText ); } public JLabel createLabel( String text , Font font , Color color ) { JLabel label = new JLabel( text ); label.setFont( font ); label.setForeground( color ); return label; } public JLabel createLabel( String text ) { JLabel label = new JLabel( text ); return label; } public JComboBox createComboBox( ItemListener i ) { JComboBox findText = new JComboBox(); findText.setMaximumSize( new Dimension( 100 , 25 ) ); findText.setPreferredSize( new Dimension( 100 , 25 ) ); findText.setEditable( true ); findText.addItemListener( i ); return findText; } public JButton createButton( String text , Color c , ActionListener a ) { JButton button = new JButton( text ); button.setMaximumSize( new Dimension( 100 , 25 ) ); button.setBackground( c ); button.addActionListener( a ); return button; } public Box createVerticalBox( JButton[] buttons ) { Box temBox = Box.createVerticalBox(); for ( int i = 0 ; i < buttons.length; i++ ) { temBox.add( buttons[i] ); } return temBox; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -