public void ctor_MsTextBoxMultiline_() {
    txt_box = new GxwTextBox_lang();
    txt_box.ctor_MsTextBox_();
    core = new GxwCore_host(GxwCore_lang.new_(this), txt_box.ctrlMgr);
    this.setViewportView(txt_box);
    txt_box.setLineWrap(true);
    txt_box.setWrapStyleWord(true); // else text will wrap in middle of words
    this.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    this.setBorder(null);
    txt_box.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    txt_box.setCaretColor(Color.BLACK);
    txt_box.getCaret().setBlinkRate(0);
    txt_box.setMargin(new Insets(0, 200, 200, 0));
    OverrideKeyBindings();
    InitUndoMgr();
    txt_box.setCaret(
        new javax.swing.text.DefaultCaret() {
          public void setSelectionVisible(boolean vis) {
            super.setSelectionVisible(true);
          }
        }); // else highlighted selection will not be visible when text box loses focus
    //		this.setLayout(null);

    //		Object fontDefinition = new UIDefaults.ProxyLazyValue("javax.swing.plaf.FontUIResource",
    // null, new Object[] { "dialog", new Integer(Font.PLAIN), new Integer(12) });
    //		java.util.Enumeration keys = UIManager.getDefaults().keys();
    //		while (keys.hasMoreElements()) {
    //		    Object key = keys.nextElement();
    //		    Object value = UIManager.get(key);
    //		    if (value instanceof javax.swing.plaf.FontUIResource) {
    //		        UIManager.put(key, fontDefinition);
    //		    }
    //		}
  }
示例#2
0
 // todo: call Dispose when ownerForm is disposed
 //	@Override protected void Dispose(boolean disposing)					{if (host.DisposeCbk())
 // super.Dispose(disposing);}
 public void ctor_GxwElem() {
   ctrlMgr = GxwCore_lang.new_(this);
   GxwBoxListener lnr = new GxwBoxListener(this);
   // this.setFocusTraversalKeysEnabled(false);
   this.addComponentListener(lnr);
   this.addFocusListener(lnr);
   this.enableEvents(
       AWTEvent.MOUSE_EVENT_MASK
           | AWTEvent.MOUSE_MOTION_EVENT_MASK
           | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
 }
示例#3
0
 @Override
 public void paint(Graphics g) {
   // always paint background color; must happen before any controlPaint; extract to separate
   // method if override needed
   Graphics2D g2 = (Graphics2D) g;
   g2.setBackground(this.getBackground());
   RectAdp clipRect = GxwCore_lang.XtoRectAdp(g2.getClipBounds());
   g2.clearRect(clipRect.X(), clipRect.Y(), clipRect.Width(), clipRect.Height());
   if (host.PaintCbk(
       PaintArgs.new_(
           GfxAdpBase.new_(g2),
           clipRect))) // ClipRect not used by any clients; implement when necessary
   super.paint(
         g); // Reevaluate if necessary: super.paint might need to (a) always happen and (b) go
             // before PaintCbk (had issues with drawing text on images)
 }