Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
   }
 }
Exemplo n.º 4
0
 /** @see java.awt.peer.ComponentPeer */
 @Override
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (xtext != null) {
     xtext.setEnabled(enabled);
     xtext.repaint();
   }
 }
Exemplo n.º 5
0
 @Override
 @SuppressWarnings("deprecation")
 public void actionPerformed(ActionEvent actionEvent) {
   xwin.postEvent(
       new ActionEvent(
           xwin.target,
           ActionEvent.ACTION_PERFORMED,
           getText(),
           actionEvent.getWhen(),
           actionEvent.getModifiers()));
 }
Exemplo n.º 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);
   }
 }
Exemplo n.º 7
0
 @Override
 public Graphics getGraphics() {
   return xwin.getGraphics();
 }
Exemplo n.º 8
0
 @Override
 public void changedUpdate(DocumentEvent e) {
   if (xwin != null) {
     xwin.postEvent(new TextEvent(xwin.target, TextEvent.TEXT_VALUE_CHANGED));
   }
 }
Exemplo n.º 9
0
 @Override
 public void setVisible(boolean b) {
   super.setVisible(b);
   if (xtext != null) xtext.setVisible(b);
 }
Exemplo n.º 10
0
 @Override
 public void focusGained(FocusEvent e) {
   super.focusGained(e);
   xtext.forwardFocusGained(e);
 }
Exemplo n.º 11
0
 @Override
 public void focusLost(FocusEvent e) {
   super.focusLost(e);
   xtext.forwardFocusLost(e);
 }