没有合适的资源?快使用搜索试试~ 我知道了~
java源程序代码
需积分: 12 1 下载量 197 浏览量
2014-07-03
08:37:46
上传
评论
收藏 11KB TXT 举报
温馨提示
试读
10页
这代码是我亲自完成,也是一个很不错的,登陆的界面,我是大二的学生,希望有JAVA厉害的,可以帮助我,可以吗?
资源推荐
资源详情
资源评论
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import java.io.*; import javax.swing.*;
import javax.swing.text.*;
class JNotePadUI extends JPanel
{
// 变量定义
JTextArea jta = new JTextArea("", 24, 40);
JScrollPane jsp = new JScrollPane(jta);
// 菜单条
JMenuBar jmb = new JMenuBar();
JMenu file = new JMenu("文件(F)", true);
JMenu edit = new JMenu("编辑(E)", true);
JMenu help = new JMenu("帮助(H)", true);
// 工具条
JToolBar toolBar = new JToolBar();
// 菜单内容
JMenuItem jmi;
// 实例化剪切板
Clipboard clipbd = getToolkit().getSystemClipboard();
String text = "";
// 构造函数
public JNotePadUI()
{
class newL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
jta.setDocument(new PlainDocument());
import java.awt.event.*;
import java.awt.datatransfer.*;
import java.io.*; import javax.swing.*;
import javax.swing.text.*;
class JNotePadUI extends JPanel
{
// 变量定义
JTextArea jta = new JTextArea("", 24, 40);
JScrollPane jsp = new JScrollPane(jta);
// 菜单条
JMenuBar jmb = new JMenuBar();
JMenu file = new JMenu("文件(F)", true);
JMenu edit = new JMenu("编辑(E)", true);
JMenu help = new JMenu("帮助(H)", true);
// 工具条
JToolBar toolBar = new JToolBar();
// 菜单内容
JMenuItem jmi;
// 实例化剪切板
Clipboard clipbd = getToolkit().getSystemClipboard();
String text = "";
// 构造函数
public JNotePadUI()
{
class newL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
jta.setDocument(new PlainDocument());
}
}
// 打开功能
class openL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JFileChooser fc = new JFileChooser();
int returnVal = fc.showDialog(JNotePadUI.this, "打开");
if (returnVal == JFileChooser.APPROVE_OPTION)
{
String file = fc.getSelectedFile().getPath();
if (file == null)
{
return;
}
// 读取文件
try
{
Reader in = new FileReader(file);
char[] buff = new char[4096];
int nch;
while ((nch = in.read(buff, 0, buff.length)) != -1)
{
jta.setDocument(new PlainDocument());
jta.append(new String(buff, 0, nch));
}
}
catch (IOException io)
{
}
// 打开功能
class openL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JFileChooser fc = new JFileChooser();
int returnVal = fc.showDialog(JNotePadUI.this, "打开");
if (returnVal == JFileChooser.APPROVE_OPTION)
{
String file = fc.getSelectedFile().getPath();
if (file == null)
{
return;
}
// 读取文件
try
{
Reader in = new FileReader(file);
char[] buff = new char[4096];
int nch;
while ((nch = in.read(buff, 0, buff.length)) != -1)
{
jta.setDocument(new PlainDocument());
jta.append(new String(buff, 0, nch));
}
}
catch (IOException io)
{
剩余9页未读,继续阅读
资源评论
qq_17186025
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功