📄 textpaneimages.java
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/*
<APPLET
CODE = textpaneimages.class
WIDTH = 350
HEIGHT = 280>
</APPLET>
*/
public class textpaneimages extends JApplet implements ActionListener
{
JTextPane jtextpane = new JTextPane();
JButton jbutton = new JButton("Click Me");
public void init()
{
Container contentPane = getContentPane();
jtextpane.setFont(new Font("Times-Roman", Font.BOLD, 18));
jtextpane.setText("Hello from Swing!");
jbutton.addActionListener(this);
jtextpane.insertComponent(jbutton);
jtextpane.insertIcon(new ImageIcon("image.jpg"));
contentPane.add(jtextpane);
}
public void actionPerformed(ActionEvent e)
{
showStatus("You clicked the button.");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -