本文整理匯總了Java中javax.swing.event.CaretEvent.getSource方法的典型用法代碼示例。如果您正苦於以下問題:Java CaretEvent.getSource方法的具體用法?Java CaretEvent.getSource怎麽用?Java CaretEvent.getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.event.CaretEvent
的用法示例。
在下文中一共展示了CaretEvent.getSource方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: caretUpdate
import javax.swing.event.CaretEvent; //導入方法依賴的package包/類
@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);
}
示例2: caretUpdate
import javax.swing.event.CaretEvent; //導入方法依賴的package包/類
@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);
}
}
示例3: caretUpdate
import javax.swing.event.CaretEvent; //導入方法依賴的package包/類
@Override
public void caretUpdate(CaretEvent e) {
Object source = e.getSource();
if (source == textArea) {
possiblyDisposeOfTipWindow();
}
}
示例4: handleCaretUpdateEvent
import javax.swing.event.CaretEvent; //導入方法依賴的package包/類
/**
* @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);
}
}
示例5: caretUpdate
import javax.swing.event.CaretEvent; //導入方法依賴的package包/類
@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());
}
}