Java Code Examples for javax.swing.event.CaretEvent.getSource()

The following are Jave code examples for showing how to use getSource() of the javax.swing.event.CaretEvent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: POMModelPanel.java   Source Code and License Vote up 5 votes
@Override
public void caretUpdate(CaretEvent e) {
    JTextComponent cc = currentComponent != null ? currentComponent.get() : null;
    if (e.getSource() != cc) {
        ((JTextComponent)e.getSource()).removeCaretListener(this);
        //just a double check we do't get a persistent leak here..
        return;
    }
    currentDot = e.getDot();
    caretTask.schedule(1000);
}
 
Example 2
Project: powertext   File: Caretlistener.java   Source Code and License Vote up 5 votes
@Override        
    public void caretUpdate(CaretEvent evt) {
       JTextArea textPane1 =(JTextArea)evt.getSource();
        int row = getRow(evt.getDot(), textPane1); //row += 1;
        int col = getColumn(evt.getDot(), textPane1);
        
cal.setText("Line: " + row + " Column: " + col);
cln = row;
                
        //Get the location in the text
int dot = evt.getDot();
int mark = evt.getMark();
int totalsel = mark - dot ;
int totalsele = dot - mark ;
if (dot == mark) {  
    //Rectangle caretCoords = textPane.modelToView(dot);
    
    Totalsel.setText("Caret Position: " + dot ); doti = dot;
    //jLabel17.setText("Caret Position : " + dot);
    //jLabel18.setText("Current Line : " + row);
    jLabel500.setText(""+row);   jLabel501.setText(""+col);
    //jLabel19.setText("Current Column : " + col);
    mark +=1 ;
 } else if (dot < mark) {
    statusLabel.setText("Selection : " + totalsel + "\t | \t" + row);
    jLabel26.setText("Selection : " + totalsel + "\t | \t" + row);
    
 } else {
    jLabel26.setText("Selection : " + totalsele + "\t | " + row);
    statusLabel.setText("Selection : " + totalsele + "\t | \t" + row);
 }
    }
 
Example 3
Project: powertext   File: Caretlistener.java   Source Code and License Vote up 5 votes
@Override        
    public void caretUpdate(CaretEvent evt) {
       JTextArea textPane1 =(JTextArea)evt.getSource();
        int row = getRow(evt.getDot(), textPane1); //row += 1;
        int col = getColumn(evt.getDot(), textPane1);
        
cal.setText("Line: " + row + " Column: " + col);
cln = row;
                
        //Get the location in the text
int dot = evt.getDot();
int mark = evt.getMark();
int totalsel = mark - dot ;
int totalsele = dot - mark ;
if (dot == mark) {  
    //Rectangle caretCoords = textPane.modelToView(dot);
    
    Totalsel.setText("Caret Position: " + dot ); doti = dot;
    //jLabel17.setText("Caret Position : " + dot);
    //jLabel18.setText("Current Line : " + row);
    jLabel500.setText(""+row);   jLabel501.setText(""+col);
    //jLabel19.setText("Current Column : " + col);
    mark +=1 ;
 } else if (dot < mark) {
    statusLabel.setText("Selection : " + totalsel + "\t | \t" + row);
    jLabel26.setText("Selection : " + totalsel + "\t | \t" + row);
    
 } else {
    jLabel26.setText("Selection : " + totalsele + "\t | " + row);
    statusLabel.setText("Selection : " + totalsele + "\t | \t" + row);
 }
    }
 
Example 4
Project: powertext   File: FocusableTip.java   Source Code and License Vote up 5 votes
@Override
public void caretUpdate(CaretEvent e) {
	Object source = e.getSource();
	if (source == textArea) {
		possiblyDisposeOfTipWindow();
	}
}
 
Example 5
Project: DIA-Umpire-Maven   File: AlignWindow.java   Source Code and License Vote up 5 votes
/**
 * @param event
 */
private void handleCaretUpdateEvent(CaretEvent event) {
    if (event.getSource() == currentTextComponent) {
        boolean enabled = event.getDot() != event.getMark();
        // Read controls
        setCopyControlsEnabled(enabled);

        // Write controls
        enabled &= currentTextComponent.isEditable();
        setCutControlsEnabled(enabled);
        setDeleteControlsEnabled(enabled);
    }
}
 
Example 6
Project: GravSupport   File: CreateThemeDialog.java   Source Code and License Vote up 5 votes
@Override
public void caretUpdate(CaretEvent e) {
    if (e.getSource() == textField1) {
        themeData.setName(textField1.getText());
    }
    if (e.getSource() == textField2) {
        themeData.setDescription(textField2.getText());
    }
    if (e.getSource() == textField3) {
        themeData.setDeveloper(textField3.getText());
    }
    if (e.getSource() == textField4) {
        themeData.setEmail(textField4.getText());
    }
}