当前位置:首页 » 编程软件 » 用java写一个简单文本编译器

用java写一个简单文本编译器

发布时间: 2024-01-26 19:21:21

java文本编辑器源代码

import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; import java.util.*; //Date needed import java.io.PrintWriter; public class NotePad extends JFrame { JTextArea jta; class newl implements ActionListener { public void actionPerformed(ActionEvent e) { jta.setText(""); } } class openl implements ActionListener { public void actionPerformed(ActionEvent e) { JFileChooser jf=new JFileChooser(); jf.showOpenDialog(NotePad.this); } } //保存文件的监听 class savel implements ActionListener { public void actionPerformed(ActionEvent e) { JFileChooser jf = new JFileChooser(); 写不了那么多啊 http://..com/question/87179404.html详细看这里把

② 如何用java编写一个简单的文本编辑器

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class f1 extends Frame implements ActionListener
{
private MenuBar menubar=new MenuBar();
private Menu filemenu=new Menu("文件");
private Menu editmenu=new Menu("编辑");
private Menu formmenu=new Menu("格式");
private MenuItem[] itemf=new MenuItem[4];
private MenuItem[] iteme=new MenuItem[6];
private MenuItem[] items=new MenuItem[2];
private TextArea tf=new TextArea();

public int a=0,b=0,c=0,style=Font.PLAIN,size=15;
public String s1="red:"+a+" "+"green:"+b+" "+"blue"+c,
s2="宋体";

public String[] sz1={"10","16","24","30","32","36"},
sz2={"宋体","黑体","幼圆","隶书","行楷","Arial","Georgia"},
sz3={"粗体","倾斜","常规","粗斜"};

JDialog dialog=new JDialog(this,"字体",true);
Container cp=dialog.getContentPane();
JLabel[] lb=new JLabel[8];
JLabel lb1=new JLabel(s1,JLabel.LEFT);
JButton b1=new JButton("确定"),
b2=new JButton("取消");
JComboBox jc1=new JComboBox(),
jc2=new JComboBox(),
jc3=new JComboBox();
JScrollBar jb1=new JScrollBar(JScrollBar.HORIZONTAL,10,5,0,260);
JScrollBar jb2=new JScrollBar(JScrollBar.HORIZONTAL,10,5,0,260);
JScrollBar jb3=new JScrollBar(JScrollBar.HORIZONTAL,10,5,0,260);

热点内容
安卓手机如何使用印象笔记剪影 发布:2024-11-16 12:32:18 浏览:177
电脑服务器在哪里输入 发布:2024-11-16 12:27:22 浏览:263
魅族16th如何设置热点密码 发布:2024-11-16 12:22:15 浏览:396
浙江密码文件柜哪里有 发布:2024-11-16 12:20:34 浏览:953
c语言逆序输出整数 发布:2024-11-16 12:20:31 浏览:797
蓝桥杯c语言 发布:2024-11-16 12:20:24 浏览:398
安卓阵营哪个手机外放好 发布:2024-11-16 12:16:02 浏览:651
国外云服务器免费 发布:2024-11-16 12:13:49 浏览:554
苏宁茅台脚本 发布:2024-11-16 12:12:18 浏览:252
访问乞丐 发布:2024-11-16 12:07:19 浏览:436