1 16 17 package com.buchuki.ensmer.builtin; 18 19 import com.buchuki.ensmer.input.InputManager; 20 import com.buchuki.ensmer.input.command.*; 21 import com.buchuki.ensmer.input.event.*; 22 import com.buchuki.ensmer.object.Backend; 23 import com.buchuki.ensmer.text.TextInput; 24 import com.sun.j3d.utils.geometry.Text2D; 25 import java.awt.Font ; 26 import java.io.Serializable ; 27 import javax.media.j3d.Appearance; 28 import javax.media.j3d.BranchGroup; 29 import javax.media.j3d.PolygonAttributes; 30 import javax.vecmath.Color3f; 31 32 33 34 39 public class Note extends Backend { 40 41 44 public Note() { 45 text = new TextInput(); 46 text.setFocused(true); 47 } 48 49 54 public Note(Serializable data) { 55 text = (TextInput) data; 56 } 57 58 63 public Serializable getSerializable() { 64 return text; 65 } 66 67 72 public TextInput getText() { 73 return text; 74 } 75 76 81 public void processText(EnsmerInputEvent event) { 82 text.processInput(event); 83 fireChangeEvent(); 84 } 85 86 94 @Override 95 public static BranchGroup getRepresentation() { 96 Text2D text = new Text2D("Note", new Color3f(.7f, .2f, .1f), "Times", 97 16, Font.BOLD); 98 Appearance app = text.getAppearance(); 99 PolygonAttributes poly = new PolygonAttributes(); 100 poly.setCullFace(poly.CULL_NONE); 101 app.setPolygonAttributes(poly); 102 BranchGroup ret = new BranchGroup(); 103 ret.addChild(text); 104 return ret; 105 } 106 107 110 private TextInput text; 111 112 } 113 | Popular Tags |