write.java

来自「一个简单的socket聊天工具,实现在发送文件和语音聊天等功能,还能聊天的同时听」· Java 代码 · 共 63 行

JAVA
63
字号
/*
 * 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 + =
减小字号Ctrl + -
显示快捷键?