?? roundbutton.java
字號:
import java.awt.*;
import javax.swing.*;
public class RoundButton extends JButton {
public RoundButton( String label )
{
super( label );
Dimension size = getPreferredSize();
setPreferredSize( size );
setContentAreaFilled( false );
}
protected void paintComponent( Graphics g )
{
if ( getModel().isArmed() )
g.setColor( Color.lightGray );
else
g.setColor( getBackground() );
g.fillOval( 0, 0, getSize().width - 1,getSize().height - 1 );
super.paintComponent( g );
}
protected void paintBorder( Graphics g )
{
g.setColor( getForeground() );
g.drawOval( 0, 0, getSize().width - 1, getSize().height - 1 );
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -