📄 showjbutton.java
字号:
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.FlowLayout;
import javax.swing.ImageIcon;
class ShowJButton extends JFrame{
JButton jbutton1=new JButton("上一笔");
ImageIcon imageIcon1=new ImageIcon("d:\\java_project\\image\\next.gif");
JButton jbutton2=new JButton("下一笔",imageIcon1);
ImageIcon imageIcon2=new ImageIcon("d:\\java_project\\image\\exit.gif");
JButton jbutton3=new JButton(imageIcon2);
FlowLayout flowLayout1=new FlowLayout();
ShowJButton(){
setTitle("按钮演示窗口");
setSize(200,150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbutton3.setToolTipText("退出程序");
this.getContentPane().setLayout(flowLayout1);
this.getContentPane().add(jbutton1);
this.getContentPane().add(jbutton2);
this.getContentPane().add(jbutton3);
show();
}
public static void main(String[] args){
ShowJButton sjb=new ShowJButton();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -