Package com.cburch.hex

Examples of com.cburch.hex.HexModel


      long t = p0; p0 = p1; p1 = t;
    }
    p1++;
   
    int[] data = new int[(int) (p1 - p0)];
    HexModel model = editor.getModel();
    for (long i = p0; i < p1; i++) {
      data[(int) (i - p0)] = model.get(i);
    }
   
    Clipboard clip = editor.getToolkit().getSystemClipboard();
    clip.setContents(new Data(data), this);
  }
View Full Code Here


    Caret caret = editor.getCaret();
    long p0 = caret.getMark();
    long p1 = caret.getDot();
    if (p0 == p1) {
      HexModel model = editor.getModel();
      if (p0 + data.length - 1 <= model.getLastOffset()) {
        model.set(p0, data);
      } else {
        JOptionPane.showMessageDialog(editor.getRootPane(),
            Strings.get("hexPasteEndError"),
            Strings.get("hexPasteErrorTitle"),
            JOptionPane.ERROR_MESSAGE);
      }
    } else {
      if (p0 < 0 || p1 < 0) return;
      if (p0 > p1) {
        long t = p0; p0 = p1; p1 = t;
      }
      p1++;
     
      HexModel model = editor.getModel();
      if (p1 - p0 == data.length) {
        model.set(p0, data);
      } else {
        JOptionPane.showMessageDialog(editor.getRootPane(),
            Strings.get("hexPasteSizeError"),
            Strings.get("hexPasteErrorTitle"),
            JOptionPane.ERROR_MESSAGE);
View Full Code Here

    }
  }
 
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    HexModel model = new Model();
    HexEditor editor = new HexEditor(model);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new JScrollPane(editor));
    frame.pack();
    frame.setVisible(true);
View Full Code Here

            long t = p0; p0 = p1; p1 = t;
        }
        p1++;

        int[] data = new int[(int) (p1 - p0)];
        HexModel model = editor.getModel();
        for (long i = p0; i < p1; i++) {
            data[(int) (i - p0)] = model.get(i);
        }

        Clipboard clip = editor.getToolkit().getSystemClipboard();
        clip.setContents(new Data(data), this);
    }
View Full Code Here

        Caret caret = editor.getCaret();
        long p0 = caret.getMark();
        long p1 = caret.getDot();
        if (p0 == p1) {
            HexModel model = editor.getModel();
            if (p0 + data.length - 1 <= model.getLastOffset()) {
                model.set(p0, data);
            } else {
                JOptionPane.showMessageDialog(editor.getRootPane(),
                        getFromLocale("hexPasteEndError"),
                        getFromLocale("hexPasteErrorTitle"),
                        JOptionPane.ERROR_MESSAGE);
            }
        } else {
            if (p0 < 0 || p1 < 0) {
                return;
            }

            if (p0 > p1) {
                long t = p0; p0 = p1; p1 = t;
            }
            p1++;

            HexModel model = editor.getModel();
            if (p1 - p0 == data.length) {
                model.set(p0, data);
            } else {
                JOptionPane.showMessageDialog(editor.getRootPane(),
                        getFromLocale("hexPasteSizeError"),
                        getFromLocale("hexPasteErrorTitle"),
                        JOptionPane.ERROR_MESSAGE);
View Full Code Here

TOP

Related Classes of com.cburch.hex.HexModel

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.