/[classpath]/classpath/javax/swing/text/DefaultCaret.java
ViewVC logotype

Diff of /classpath/javax/swing/text/DefaultCaret.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by rabbit78, Thu Nov 3 11:19:28 2005 UTC revision 1.21 by rabbit78, Thu Nov 3 14:39:37 2005 UTC
# Line 51  import java.beans.PropertyChangeEvent; Line 51  import java.beans.PropertyChangeEvent;
51  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
52  import java.util.EventListener;  import java.util.EventListener;
53    
54    import javax.swing.JComponent;
55  import javax.swing.SwingUtilities;  import javax.swing.SwingUtilities;
56  import javax.swing.Timer;  import javax.swing.Timer;
57  import javax.swing.event.ChangeEvent;  import javax.swing.event.ChangeEvent;
# Line 327  public class DefaultCaret extends Rectan Line 328  public class DefaultCaret extends Rectan
328     */     */
329    public void mouseDragged(MouseEvent event)    public void mouseDragged(MouseEvent event)
330    {    {
331      // FIXME: Implement this properly.      moveCaret(event);
332    }    }
333    
334    /**    /**
# Line 357  public class DefaultCaret extends Rectan Line 358  public class DefaultCaret extends Rectan
358     */     */
359    public void mouseClicked(MouseEvent event)    public void mouseClicked(MouseEvent event)
360    {    {
361      // FIXME: Implement this properly.      // TODO: Implement double- and triple-click behaviour here.
362    }    }
363    
364    /**    /**
# Line 379  public class DefaultCaret extends Rectan Line 380  public class DefaultCaret extends Rectan
380     */     */
381    public void mouseExited(MouseEvent event)    public void mouseExited(MouseEvent event)
382    {    {
383      // TODO: What to do here, if anything?      // Nothing to do here.
384    }    }
385    
386    /**    /**
# Line 392  public class DefaultCaret extends Rectan Line 393  public class DefaultCaret extends Rectan
393     */     */
394    public void mousePressed(MouseEvent event)    public void mousePressed(MouseEvent event)
395    {    {
396      // FIXME: Implement this properly.      positionCaret(event);
     if (!(event.getButton() == MouseEvent.BUTTON1))  
       return;  
     setDot(textComponent.viewToModel(event.getPoint()));  
397    }    }
398    
399    /**    /**
# Line 438  public class DefaultCaret extends Rectan Line 436  public class DefaultCaret extends Rectan
436     */     */
437    protected void moveCaret(MouseEvent event)    protected void moveCaret(MouseEvent event)
438    {    {
439      // FIXME: Implement this properly.      int newDot = getComponent().viewToModel(event.getPoint());
440        moveDot(newDot);
441    }    }
442    
443    /**    /**
# Line 449  public class DefaultCaret extends Rectan Line 448  public class DefaultCaret extends Rectan
448     */     */
449    protected void positionCaret(MouseEvent event)    protected void positionCaret(MouseEvent event)
450    {    {
451      // FIXME: Implement this properly.      int newDot = getComponent().viewToModel(event.getPoint());
452        moveDot(newDot);
453    }    }
454    
455    /**    /**
# Line 767  public class DefaultCaret extends Rectan Line 767  public class DefaultCaret extends Rectan
767    {    {
768      this.dot = dot;      this.dot = dot;
769      handleHighlight();      handleHighlight();
770        adjustVisibility(this);
771      repaint();      repaint();
772    }    }
773    
# Line 784  public class DefaultCaret extends Rectan Line 785  public class DefaultCaret extends Rectan
785      this.dot = dot;      this.dot = dot;
786      this.mark = dot;      this.mark = dot;
787      handleHighlight();      handleHighlight();
788        adjustVisibility(this);
789      repaint();      repaint();
790    }    }
791    
# Line 870  public class DefaultCaret extends Rectan Line 872  public class DefaultCaret extends Rectan
872    }    }
873    
874    /**    /**
875       * Adjusts the text component so that the caret is visible. This default
876       * implementation simply calls
877       * {@link JComponent#scrollRectToVisible(Rectangle)} on the text component.
878       * Subclasses may wish to change this.
879       */
880      protected void adjustVisibility(Rectangle rect)
881      {
882        getComponent().scrollRectToVisible(rect);
883      }
884    
885      /**
886     * Initializes the blink timer.     * Initializes the blink timer.
887     */     */
888    private void initBlinkTimer()    private void initBlinkTimer()

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26