예제 #1
0
  private void initItem(Graphics g) {
    if (false) {
      SimpleDisplayObject child = new TestDisplayObject();
      child.setRect(100, 100);
      mStage.getRoot().addChild(child);
    }
    if (false) {
      EmptyLineViewBufferSpecImpl e = new EmptyLineViewBufferSpecImpl(100);
      e.append(new KyoroString("--1--\n"));
      e.append(new KyoroString("--2--\n"));
      e.append(new KyoroString("--3--\n"));
      e.append(new KyoroString("--4--\n"));
      EditableLineView v = new EditableLineView(e, 22, 256);
      v.setRect(200, 200);
      mStage.getRoot().addChild(v);
    }
    if (true) {
      EmptyLineViewBufferSpecImpl e = new EmptyLineViewBufferSpecImpl(100);
      e.append(new KyoroString("--1--\n"));
      e.append(new KyoroString("--2--\n"));
      e.append(new KyoroString("--3--\n"));
      e.append(new KyoroString("--4--\n"));

      g.setFont(g.getFont().deriveFont(11));
      TextViewer viewer =
          new TextViewer(e, 11, 400, 10, new SimpleFontForJ2SE(null, g.getFontMetrics()), "utf8");
      readStartupMessage(viewer);
      viewer.setRect(800, 800);
      mStage.getRoot().addChild(viewer);
      //			viewer.getLineView().setMode(EditableLineView.MODE_SELECT);
      viewer.getLineView().setMode(EditableLineView.MODE_EDIT);
    }
  }
예제 #2
0
 public void readStartupMessage(TextViewer v) {
   try {
     File dir = new File("./");
     File filePathOfStartMessage = new File(dir, "startup_message.txt");
     createStartupMessageIfNonExist(filePathOfStartMessage);
     v.readFile(filePathOfStartMessage, false);
     // readFile(filePathOfStartMessage, true);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }