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

📄 containedi.java

📁 JTREE的例子
💻 JAVA
字号:
package util2;import java.awt.*;import javax.swing.*;import javax.swing.border.*;import java.io.*;import javax.swing.text.*;import util5.*;public class ContainEdi extends JPanel implements CountListener{  BorderLayout borderLayout1 = new BorderLayout();  JPanel statePan = new JPanel();  Border border1;  TitledBorder titledBorder1;  Xeditor xeditor=new Xeditor();  GridBagLayout gridBagLayout1 = new GridBagLayout();  JPanel filePan = new JPanel();  BorderLayout borderLayout2 = new BorderLayout();  JPanel countPan = new JPanel(new FlowLayout(1,0,0));  JLabel fileNameLab = new JLabel();  JLabel countLab = new JLabel();  JScrollPane scroPan = new JScrollPane();  Document doc;  File file;  public ContainEdi(File file)  {    this.file=file;    try    {      jbInit();    }    catch(Exception e)    {      e.printStackTrace();    }  }  private void jbInit() throws Exception  {    border1 = new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(142, 142, 142));    titledBorder1 = new TitledBorder("");    this.setLayout(borderLayout1);    //fileNameLab    statePan.setLayout(gridBagLayout1);    filePan.setLayout(borderLayout2);    fileNameLab.setFont(new java.awt.Font("DialogInput", 1, 11));    fileNameLab.setForeground(Color.black);    fileNameLab.setBorder(BorderFactory.createLoweredBevelBorder());    fileNameLab.setText("jLabel1");    countLab.setFont(new java.awt.Font("DialogInput", 1, 11));    countLab.setForeground(Color.black);    countLab.setText("1:1");    countPan.setBorder(BorderFactory.createLoweredBevelBorder());    countPan.setPreferredSize(new Dimension(25, 18));    scroPan.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);    scroPan.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);    xeditor.setDoubleBuffered(true);    filePan.setPreferredSize(new Dimension(4, 18));    this.add(statePan, BorderLayout.SOUTH);    statePan.add(filePan,   new GridBagConstraints(0, 0, 1, 1, 0.9, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));    filePan.add(fileNameLab, BorderLayout.CENTER);    statePan.add(countPan, new GridBagConstraints(1, 0, 1, 1, 0.1, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));    countPan.add(countLab, null);    this.add(scroPan, BorderLayout.CENTER);    scroPan.getViewport().add(xeditor);    this.xeditor.addCountListener(this);    doc=xeditor.getDocument();    this.fileNameLab.setText(this.file.getAbsolutePath());  }  public UtilUndoer getUndoManager(){return this.xeditor.getUndoManager();}  public void addUndoRedoListener(UndoRedoListener l){    this.getUndoManager().addUndoRedoListener(l);  }  public void addERCListener(ERCListener l){    this.xeditor.addERCListener(l);  }  public Xeditor getXeditor(){return this.xeditor;}  public void setFile(File file){this.file=file;}  public File getFile(){return this.file;}  public Document getDoc(){return this.doc;}  public void setCountText(String cou){    this.countLab.setText(cou);  }  public void saved(){this.xeditor.setModified(false);}  public boolean isModified(){return this.xeditor.getModified();}  public void eraseUR(){this.xeditor.eraseUR();}  public String getAllText(){return this.xeditor.getText();}  public static void main(String [] arg){    JFrame jf=new JFrame("try");    jf.setBounds(100,100,300,300);    jf.getContentPane().add(new ContainEdi(new File("cl.cl")));    jf.show();  }}

⌨️ 快捷键说明

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