Package de.FBEditor.struct

Examples of de.FBEditor.struct.JTextPane2


import de.FBEditor.struct.JTextPane2;

public class Listener {

  public static void addKeyListener(final FBEdit fbedit) {
    final JTextPane2 pane2 = fbedit.getJTextPane();
   
    pane2.addKeyListener(new KeyListener() {

      public void keyTyped(KeyEvent keyevent) {
      }

      public void keyPressed(KeyEvent keyevent) {
View Full Code Here


    }

    updateTitle();
    setIconImage(getImageFromJAR("/icon.gif"));

    pane = new JTextPane2();

    setProperties(properties);

    // load supported languages
    loadLanguages();
View Full Code Here

    mi.setAccelerator(ks);
  }

  // Konfiguration von Box holen
  void getFile() {
    JTextPane2 pane2 = this.getJTextPane();
    DocumentListener docListen2 = this.getDocListener();
// Consolas Font Pack for Microsoft Visual Studio 2005 or 2008
// Download: http://www.microsoft.com/en-us/download/details.aspx?id=17879
    pane2.setFont(new Font("Consolas", 0, 16));
    /* Speedup */
    removeDocumentListener(pane2, docListen2);
    pane2.setText(FBEdit.getMessage("box.get_config"));
    EventQueue.invokeLater(new ImportData());
    fileName = "fritzbox.export";
    jFile = null;
  }
View Full Code Here

    jFile = null;
  }

  // Editor mit Inhalt füllen
  public void setData(String data) {
    JTextPane2 pane2 = this.getJTextPane();

    pane2.setText("");
    pane2.setFont(new Font("Consolas", 0, 12));
    pane2.setEditable(false);
    undoManager.pause();
    pane2.setText(data);
    pane2.setCaretPosition(0);
    undoManager.resume();
    undoManager.discardAllEdits();
    addDocumentListener(pane2, this.getDocListener());
    pane2.setEditable(true);
  }
View Full Code Here

      }
    }
  }

  void loadFile() {
    JTextPane2 pane2 = this.getJTextPane();
    JFileChooser chooser = new JFileChooser(".");
    ExampleFileFilter filter = new ExampleFileFilter("export");
    filter.setDescription(FBEdit.getMessage("export.file"));
    chooser.setFileFilter(filter);
    int returnVal = chooser.showOpenDialog(this);
    if (returnVal == 0) {
      fileName = chooser.getSelectedFile().getName();
      jFile = chooser.getSelectedFile().getAbsolutePath();
      try {
        FileInputStream fis = new FileInputStream(jFile);
        byte[] donnees = new byte[fis.available()];
        fis.read(donnees);
        setData(new String(donnees));
        fis.close();
      } catch (IOException e) {
        pane2.setText(FBEdit.getMessage("export.load.error"));
      }
      undoManager.discardAllEdits();
    }
  }
View Full Code Here

      undoManager.discardAllEdits();
    }
  }

  void saveFile() {
    JTextPane2 pane2 = this.getJTextPane();
    JFileChooser chooser = new JFileChooser(".");
    ExampleFileFilter filter = new ExampleFileFilter("export");
    filter.setDescription(FBEdit.getMessage("export.file"));
    chooser.setFileFilter(filter);

    chooser.setSelectedFile(new File(fileName));
    int returnVal = chooser.showSaveDialog(this);

    // int javax.swing.JFileChooser.CANCEL_OPTION = 1 [0x1]
    // CANCEL_OPTION Return value if cancel is chosen.
    // int javax.swing.JFileChooser.APPROVE_OPTION = 0 [0x0]
    // APPROVE_OPTION Return value if approve (yes, ok) is chosen.
    if (returnVal == JFileChooser.APPROVE_OPTION) {

          fileName = chooser.getSelectedFile().getName();
        jFile = chooser.getSelectedFile().getAbsolutePath();

        try {
          FileOutputStream fos = new FileOutputStream(jFile);
          PrintStream pfos = new PrintStream(fos);
          String text = CalcChecksum.replaceChecksum(pane2.getText());
          pfos.print(text);
          fos.close();
        } catch (IOException e) {
          JOptionPane.showMessageDialog(this.getframe(),
              FBEdit.getMessage("export.save.error"),
View Full Code Here

TOP

Related Classes of de.FBEditor.struct.JTextPane2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.