📄 newtool.java
字号:
/*************************************************************************************
* 类名: NewTool
*
* 功能: 此类为实现顶层接口Tool的工具类,主要提供给所有类的公共方法
*
**************************************************************************************/
package edit.com;
import java.awt.*;
import javax.swing.*;
class NewTool implements Tools {
public void addSouthPanel( JComponent c[], JComponent aPanel ) {
int i = 0;
for( i = 0; i < c.length; i++ ) {
aPanel.add( c[i] );
}
}
public void addToCenterWithConstraint( JComponent c ,
GridBagConstraints constraint ,
JComponent aPanel ,
int x ,
int y ,
int width ,
int height ,
int fill ,
int anchor ) {
constraint.gridx = x;
constraint.gridy = y;
constraint.gridwidth = width;
constraint.gridheight = height;
constraint.fill = fill;
constraint.anchor = anchor;
aPanel.add( c, constraint );
}
public void setShowText( JComponent c , Color color ) {
c.setBackground( color );
}
public Box createVerticalBox( int height ) {
Box temBox = Box.createVerticalBox();
temBox.add( Box.createVerticalStrut( height ) );
return temBox;
}
public Box createHorizontalBox( int width ) {
Box temBox = Box.createHorizontalBox();
temBox.add( Box.createHorizontalStrut( width ));
return temBox;
}
public JButton createButton( Action a , Color c ) {
JButton button = new JButton( a );
button.setBackground( c );
return button;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -