📄 toolbar.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ToolBar extends JFrame {
public ToolBar() {
super("ToolBar");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImageIcon image1 = new ImageIcon("button1.gif");
JButton button1 = new JButton(image1);
ImageIcon image2 = new ImageIcon("button2.gif");
JButton button2 = new JButton(image2);
ImageIcon image3 = new ImageIcon("button3.gif");
JButton button3 = new JButton(image3);
JToolBar bar = new JToolBar();
bar.add(button1);
bar.add(button2);
bar.add(button3);
JTextArea edit = new JTextArea(8,40);
JScrollPane scroll = new JScrollPane(edit);
JPanel pane = new JPanel();
BorderLayout bord = new BorderLayout();
pane.setLayout(bord);
pane.add("North", bar);
pane.add("Center", scroll);
setContentPane(pane);
}
public static void main(String[] arguments) {
ToolBar frame = new ToolBar();
frame.pack();
frame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -