📄 write.java
字号:
/*
* Created on 2006-3-8
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author 之诸暇
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Write extends JFrame implements ActionListener{
JButton bu,bu2,bu3;
JTextPane pa;
RandomAccessFile rf;
public Write() throws Exception{
Container cn = getContentPane();
Box box = Box.createHorizontalBox();
bu = new JButton("确定");
bu2 = new JButton("陷落");
bu2.setVisible(false);
bu3 = new JButton("取消");
bu.setSize(2,2);
box.add(bu);box.setVisible(false);
box.add(bu2);
box.add(bu3);
pa = new JTextPane();
pa.setSize(5,15);
pa.setEnabled(true);
bu.addActionListener(this);
cn.setLayout(new GridLayout(2,1));
cn.add(pa);
cn.add(box);
rf = new RandomAccessFile("1.txt","rw");
setSize(300,300);
setVisible(true);
}
public void actionPerformed (ActionEvent e){
try{
//rf.write(pa.getText().getBytes());
//pa.setText("");
bu2.setVisible(true);
}
catch(Exception ex){
}
}
public static void main(String args[])throws Exception{
Write w = new Write();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -