コード例 #1
0
 @Override
 public void setBackground(Color c) {
   if (txt_box == null)
     return; // WORKAROUND.OSX: OSX LookAndFeel calls setBackground during ctor of Mem_html;
   // DATE:2015-05-11
   if (c.getRGB() == Color.BLACK.getRGB()) txt_box.setCaretColor(Color.WHITE);
   else if (c.getRGB() == Color.WHITE.getRGB()) txt_box.setCaretColor(Color.BLACK);
   super.setBackground(c);
 }
コード例 #2
0
  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);
    //		    }
    //		}
  }