本文整理汇总了Java中java.awt.event.FocusEvent.isTemporary方法的典型用法代码示例。如果您正苦于以下问题:Java FocusEvent.isTemporary方法的具体用法?Java FocusEvent.isTemporary怎么用?Java FocusEvent.isTemporary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.FocusEvent
的用法示例。
在下文中一共展示了FocusEvent.isTemporary方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
if (e.isTemporary()) {
return;
}
Component cmp = e.getComponent();
if(cmp instanceof JComponent) {
JViewport vp = getViewport(container);
if(vp == null) {
return;
}
Rectangle vr = vp.getViewRect();
Point p = SwingUtilities.convertPoint(cmp.getParent(), cmp.getLocation(), container);
final Rectangle r = new Rectangle(p, cmp.getSize());
if(vr.intersects(r)) {
return;
}
container.scrollRectToVisible(r);
}
}
示例2: EditorUI
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Construct extended UI for the use with a text component */
public EditorUI() {
focusL = new FocusAdapter() {
public @Override void focusGained(FocusEvent evt) {
/* Fix of #25475 - copyAction's enabled flag
* must be updated on focus change
*/
stateChanged(null);
if (component!=null){
BaseTextUI ui = (BaseTextUI)component.getUI();
if (ui!=null) ui.refresh();
}
}
@Override
public void focusLost(FocusEvent e) {
// see #222935, update actions before menu activates
if (e.isTemporary()) {
doStateChange(true);
}
}
};
getToolTipSupport();
}
示例3: processFocusEvent
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
super.processFocusEvent(fe);
//Remove the editor here if the new focus owner is not
//known to the table & the focus event is not temporary
if ((fe.getID() == FocusEvent.FOCUS_LOST) && !fe.isTemporary() && !inRemoveRequest && !inEditRequest) {
boolean stopEditing = ((fe.getOppositeComponent() != getParent()) &&
!isKnownComponent(fe.getOppositeComponent()) && (fe.getOppositeComponent() != null));
if (stopEditing) {
removeEditor();
}
}
//The UI will only repaint the lead selection, but we need to
//paint all selected rows for the color to change when focus
//is lost/gained
if (!inRemoveRequest && !inEditRequest) {
repaintSelection(fe.getID() == FocusEvent.FOCUS_GAINED);
}
}
示例4: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusLost(FocusEvent fe) {
if ((dragListener != null) && dragListener.isDragging()) {
dragListener.abortDrag();
}
PropUtils.log(BaseTable.class, fe);
//Ignore temporary focus changes, so sloppy focus middle mouse button
//cut/paste can work
if (fe.isTemporary()) {
return;
}
Component opposite = fe.getOppositeComponent();
if (!isKnownComponent(opposite)) {
doFocusLost(opposite);
}
}
示例5: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
if (!e.isTemporary()) {
JTextComponent textComp = (JTextComponent) e.getSource();
if (textComp.getText().length() != 0) {
textComp.selectAll();
}
}
}
示例6: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
int selectedRow = list.getSelectedIndex();
table.getSelectionModel().setAnchorSelectionIndex(selectedRow);
table.getColumnModel().getSelectionModel().setAnchorSelectionIndex(0);
}
示例7: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
if (!e.isTemporary()) {
setVisible(false);
textField.requestFocus();
}
}
示例8: focusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
if (!e.isTemporary()) {
setVisible(false);
completable.requestFocus();
}
}
示例9: focusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
if (!e.isTemporary()) {
// add a runnable to be executed later
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
field.selectAll();
}
});
}
super.focusGained(e);
}
示例10: forwardFocusLost
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
void forwardFocusLost( FocusEvent e) {
isFocused = false;
FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
e.getOppositeComponent(), e.getCause());
super.processFocusEvent(fe);
}
示例11: forwardFocusGained
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
void forwardFocusGained( FocusEvent e) {
isFocused = true;
FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
e.getOppositeComponent(), e.getCause());
super.processFocusEvent(fe);
}
示例12: retarget
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
* Retargets the original focus event to the new target. If the
* original focus event is CausedFocusEvent, it remains such and
* cause is copied. Otherwise, new CausedFocusEvent is created,
* with cause as RETARGETED.
* @return retargeted event, or null if e is null
*/
public static FocusEvent retarget(FocusEvent e, Component newSource) {
if (e == null) return null;
return new CausedFocusEvent(newSource, e.getID(), e.isTemporary(), e.getOppositeComponent(),
(e instanceof CausedFocusEvent) ? ((CausedFocusEvent)e).getCause() : Cause.RETARGETED);
}