window.java
来自「由于想一次上传成功 所以将二个教程打包成了一个 这些例子几乎包含了所有java的」· Java 代码 · 共 53 行
JAVA
53 行
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/*
<APPLET
CODE = window.class
WIDTH = 350
HEIGHT = 280 >
</APPLET>
*/
public class window extends JApplet implements ActionListener
{
JWindow jwindow = new JWindow();
public void init()
{
Container contentPane = getContentPane();
JButton jbutton = new JButton("Display window");
JButton jwindowbutton = new JButton("Close");
contentPane.setLayout(new FlowLayout());
contentPane.add(jbutton);
jwindow.getRootPane().setBorder(
BorderFactory.createRaisedBevelBorder()
);
Container windowContentPane = jwindow.getContentPane();
windowContentPane.setLayout(new FlowLayout());
windowContentPane.add(jwindowbutton);
jwindowbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jwindow.dispose();
}
});
jbutton.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
jwindow.setBounds(200, 200, 100, 100);
jwindow.show();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?