求大神指教 java初学者
import java.awt.Graphics;
/**
* http://bbs.csdn.net/topics/390325804
*/
import java.awt.Point;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.event.ChangeListener;
import javax.swing.text.Caret;
import javax.swing.text.JTextComponent;
public class HideCaret extends JFrame{
JTextArea jt=new JTextArea("sdgsdagfsaf");
public static void main(String[] args){
new HideCaret();
}
public HideCaret(){
jt.setCaret(new Caret() {
@Override
public void setVisible(boolean v) {
v=false;//关键在这
}
@Override
public void setSelectionVisible(boolean v) {
// TODO Auto-generated method stub
}
@Override
public void setMagicCaretPosition(Point p) {
// TODO Auto-generated method stub
}
@Override
public void setDot(int dot) {
// TODO Auto-generated method stub
}
@Override
public void setBlinkRate(int rate) {
// TODO Auto-generated method stub
}
@Override
public void removeChangeListener(ChangeListener l) {
// TODO Auto-generated method stub
}
@Override
public void paint(Graphics g) {
// TODO Auto-generated method stub
}
@Override
public void moveDot(int dot) {
// TODO Auto-generated method stub
}
@Override
public boolean isVisible() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSelectionVisible() {
// TODO Auto-generated method stub
return false;
}
@Override
public void install(JTextComponent c) {
// TODO Auto-generated method stub
}
@Override
public int getMark() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Point getMagicCaretPosition() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getDot() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getBlinkRate() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void deinstall(JTextComponent c) {
// TODO Auto-generated method stub
}
@Override
public void addChangeListener(ChangeListener l) {
// TODO Auto-generated method stub
}
});
add(jt);
setVisible(true);
setSize(500,500);
}
}