public VText(SessionShare sshare, ButtonIF vif, String typ) { this.vnmrIf = vif; setOpaque(false); setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); twin = new VTextWin(this, sshare, vif, typ); setViewportView(twin); JViewport vp = getViewport(); vp.setBackground(Util.getBgColor()); orgBg = getBackground(); ml = new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int clicks = evt.getClickCount(); int modifier = evt.getModifiers(); if ((modifier & (1 << 4)) != 0) { if (clicks >= 2) { ParamEditUtil.setEditObj((VObjIF) evt.getSource()); } } } }; new DropTarget(this, this); DisplayOptions.addChangeListener(this); }
private void setBorder(boolean isEnabled) { JTextField txfTmp = new JTextField(); if (isEnabled) setBorder(txfTmp.getBorder()); else { String strStyle = getAttribute(DISABLE); if (strStyle != null && strStyle.equals(m_arrStrDisAbl[1])) { setBorder(null); setBackground(Util.getBgColor()); } else { setBorder(txfTmp.getBorder()); setBackground(Global.NPCOLOR); } } }
public void setAttribute(int attr, String c) { switch (attr) { case TYPE: type = c; break; case FGCOLOR: fg = c; fgColor = DisplayOptions.getColor(fg); setForeground(fgColor); repaint(); break; case BGCOLOR: if (!DisplayOptions.isOption(DisplayOptions.COLOR, c)) c = null; bg = c; if (c != null) { bgColor = DisplayOptions.getColor(c); setOpaque(true); } else { bgColor = Util.getBgColor(); if (isActive < 1) setOpaque(true); else setOpaque(inEditMode); } setBackground(bgColor); repaint(); break; case COLOR2: caretColor = c; if (DisplayOptions.isOption(DisplayOptions.COLOR, c)) { Color col = DisplayOptions.getColor(c); setCaretColor(col); setSelectionColor(col); } break; case SHOW: showVal = c; setBorder(isEnabled); break; case FONT_NAME: fontName = c; break; case FONT_STYLE: fontStyle = c; break; case FONT_SIZE: fontSize = c; break; case SETVAL: setVal = c; break; case SETVAL2: caretQuery = c; break; case VARIABLE: vnmrVar = c; break; case CMD: vnmrCmd = c; break; case CMD2: caretCmd = c; break; case NUMDIGIT: precision = c; break; case LABEL: label = c; break; case VALUE: value = c; setText(c); break; case KEYSTR: keyStr = c; break; case KEYVAL: setText(c); break; case DISABLE: m_strDisAbl = c; break; } }
public void propertyChange(PropertyChangeEvent evt) { JViewport vp = getViewport(); if (vp != null) vp.setBackground(Util.getBgColor()); }