示例#1
0
 XAWTTextField(String text, XComponentPeer xwin, Container parent) {
   super(text);
   this.xwin = xwin;
   setDoubleBuffered(true);
   setFocusable(false);
   AWTAccessor.getComponentAccessor().setParent(this, parent);
   setBackground(xwin.getPeerBackground());
   setForeground(xwin.getPeerForeground());
   setFont(xwin.getPeerFont());
   setCaretPosition(0);
   addActionListener(this);
   addNotify();
 }
示例#2
0
 @Override
 public void dispose() {
   XToolkit.specialPeerMap.remove(xtext);
   // visible caret has a timer thread which must be stopped
   xtext.getCaret().setVisible(false);
   super.dispose();
 }
示例#3
0
 @Override
 public void setBounds(int x, int y, int width, int height, int op) {
   super.setBounds(x, y, width, height, op);
   if (xtext != null) {
     /*
      * Fixed 6277332, 6198290:
      * the coordinates is coming (to peer): relatively to closest HW parent
      * the coordinates is setting (to textField): relatively to closest ANY parent
      * the parent of peer is target.getParent()
      * the parent of textField is the same
      * see 6277332, 6198290 for more information
      */
     int childX = x;
     int childY = y;
     Component parent = target.getParent();
     // we up to heavyweight parent in order to be sure
     // that the coordinates of the text pane is relatively to closest parent
     while (parent.isLightweight()) {
       childX -= parent.getX();
       childY -= parent.getY();
       parent = parent.getParent();
     }
     xtext.setBounds(childX, childY, width, height);
     xtext.validate();
   }
 }
示例#4
0
 /** @see java.awt.peer.ComponentPeer */
 @Override
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (xtext != null) {
     xtext.setEnabled(enabled);
     xtext.repaint();
   }
 }
示例#5
0
 @Override
 @SuppressWarnings("deprecation")
 public void actionPerformed(ActionEvent actionEvent) {
   xwin.postEvent(
       new ActionEvent(
           xwin.target,
           ActionEvent.ACTION_PERFORMED,
           getText(),
           actionEvent.getWhen(),
           actionEvent.getModifiers()));
 }
示例#6
0
 @Override
 public void handleJavaMouseEvent(MouseEvent mouseEvent) {
   super.handleJavaMouseEvent(mouseEvent);
   if (xtext != null) {
     mouseEvent.setSource(xtext);
     int id = mouseEvent.getID();
     if (id == MouseEvent.MOUSE_DRAGGED || id == MouseEvent.MOUSE_MOVED)
       xtext.processMouseMotionEventImpl(mouseEvent);
     else xtext.processMouseEventImpl(mouseEvent);
   }
 }
示例#7
0
 @Override
 public Graphics getGraphics() {
   return xwin.getGraphics();
 }
示例#8
0
 @Override
 public void changedUpdate(DocumentEvent e) {
   if (xwin != null) {
     xwin.postEvent(new TextEvent(xwin.target, TextEvent.TEXT_VALUE_CHANGED));
   }
 }
示例#9
0
 @Override
 public void setVisible(boolean b) {
   super.setVisible(b);
   if (xtext != null) xtext.setVisible(b);
 }
示例#10
0
 @Override
 public void focusGained(FocusEvent e) {
   super.focusGained(e);
   xtext.forwardFocusGained(e);
 }
示例#11
0
 @Override
 public void focusLost(FocusEvent e) {
   super.focusLost(e);
   xtext.forwardFocusLost(e);
 }