⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notepadgui.java

📁 一个用swt开发的JAVA记事本
💻 JAVA
字号:
/* * NotepadGUI.java * * Created on 2007年1月4日, 下午12:47 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package net.vlinux.notepad.gui;import java.awt.BorderLayout;import javax.swing.JFrame;import javax.swing.JMenuBar;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import net.vlinux.notepad.Notepad;import net.vlinux.notepad.NotepadConfigure;/** * * @author vlinux */public class NotepadGUI {        private JFrame frame;    private JMenuBar menuBar;    private JTextArea textArea;    private boolean lineWrap;        private Notepad notepad;        public NotepadGUI(int x, int y, int w, int h, boolean lineWrap, Notepad notepad) {        this.notepad = notepad;        this.lineWrap = lineWrap;        frame = NotepadFrame.instance(x,y,w,h,this);        textArea = NotepadTextArea.instance(this);        JScrollPane scroll = new JScrollPane( textArea );        menuBar = NotepadMenuBar.instance(this);        if(lineWrap){            ((NotepadMenuBar)menuBar).setLineWrapChecked();            textArea.setLineWrap(lineWrap);        }        JPanel panel = new JPanel();        panel.setLayout(new BorderLayout());                frame.setJMenuBar(menuBar);        panel.add(scroll,BorderLayout.CENTER);        frame.getContentPane().add(panel);    }           public Notepad getNotepad() {        return notepad;    }        public void setVisible(boolean visible) {        frame.setVisible(visible);    }        public void setTitle(String title) {        frame.setTitle(title);    }        public void setTextContent(String content) {        textArea.setText(content);    }        public String getTextContent() {        return textArea.getText();    }        public NotepadConfigure getConfigure() {        int x = frame.getBounds().getLocation().x;        int y = frame.getBounds().getLocation().y;        int w = frame.getWidth();        int h = frame.getHeight();        return new NotepadConfigure(x,y,w,h,lineWrap);    }    public void lineWrap() {        lineWrap = !lineWrap;        textArea.setLineWrap(lineWrap);    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -