當前位置:首頁 » 編程軟體 » 用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 14:47:04 瀏覽:777
安卓導航cd怎麼用 發布:2024-11-16 14:37:06 瀏覽:801
mysql同步兩個資料庫 發布:2024-11-16 14:20:55 瀏覽:759
北京php培訓 發布:2024-11-16 14:20:39 瀏覽:495
新秀麗拉桿箱密碼忘了怎麼辦 發布:2024-11-16 14:05:31 瀏覽:268
為什麼有些國外安卓機不支持電信 發布:2024-11-16 13:49:26 瀏覽:504
唱吧安卓版怎麼樣 發布:2024-11-16 13:39:43 瀏覽:336
抖音思維演算法 發布:2024-11-16 13:31:02 瀏覽:592
沈陽解壓店 發布:2024-11-16 13:28:36 瀏覽:171
集團雲伺服器 發布:2024-11-16 13:26:47 瀏覽:368