java类java.awt.event.FocusEvent的实例源码

ETable.java 文件源码 项目:incubator-netbeans 阅读 32 收藏 0 点赞 0 评论 0
@Override
public void focusLost(FocusEvent e) {
    Component c = e.getOppositeComponent();
    if (c != searchTextField) {
        removeSearchField();
    }
}
DFrame.java 文件源码 项目:ramus 阅读 24 收藏 0 点赞 0 评论 0
public DFrame(final Control control) {
    super(new BorderLayout());
    setFocusable(true);
    setFocusCycleRoot(true);
    this.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            control.focusGained(DFrame.this);
        }
    });
    control.addDFrame(this);
}
WhatsappCrushGUI.java 文件源码 项目:WhatsappCrush 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void focusLost(FocusEvent e) {
    PointerInfo pi = MouseInfo.getPointerInfo();
    Point p = pi.getLocation();
    System.out.println("X is " + p.x);
    System.out.println("Y is " + p.y);
    x = p.x;
    y = p.y;
    button1.setLabel("Try Again");
    label.setText("Successfully Clicked. Ready to Start Crushing...");
    label.setBackground(Color.GREEN);
    button2.setEnabled(true);
    button1.removeFocusListener(focusListerner);
}
NewConnectionPanel.java 文件源码 项目:incubator-netbeans 阅读 25 收藏 0 点赞 0 评论 0
@Override
public void focusLost(FocusEvent e) {
    Object source = e.getSource();
    if (source instanceof JTextField) {
        JTextField textField = (JTextField) source;
        String inputText = textField.getText();
        switch(targetToken) {
            case JdbcUrl.TOKEN_HOST:
            case JdbcUrl.TOKEN_DB:
            case JdbcUrl.TOKEN_SID:
            case JdbcUrl.TOKEN_SERVICENAME:
            case JdbcUrl.TOKEN_TNSNAME:
            case JdbcUrl.TOKEN_DSN:
            case JdbcUrl.TOKEN_SERVERNAME:
            case JdbcUrl.TOKEN_INSTANCE:
            case USERINPUT_FIELD:
                textField.setText(inputText.trim());
                break;
            case JdbcUrl.TOKEN_PORT:
                Integer port = null;
                try {
                    port = Integer.valueOf(inputText.trim());
                } catch (NumberFormatException ex) {}
                if(port != null) {
                    textField.setText(Integer.toString(port));
                } else {
                    Matcher numberMatcher = numbers.matcher(inputText);
                    if(numberMatcher.find()) {
                        textField.setText(numberMatcher.group(1));
                    } else {
                        textField.setText("");
                    }
                }
                break;
            default:
                // Unhandled fields are left untouched
                break;
        }
    }
}
PotPanel.java 文件源码 项目:jaer 阅读 31 收藏 0 点赞 0 评论 0
public void focusGained(FocusEvent e) { // some control sends this event, color the pot control border red for that control and others blank
        Component src=e.getComponent();
//        log.info("focus gained by "+src.getClass().getSimpleName());
        if (selectedControl != null)((JComponent)selectedControl).setBorder(unselectedBorder);
        do{
            Component parent=src.getParent();
            if (componentList.contains(parent)) {
                ((JComponent)parent).setBorder(selectedBorder);
                selectedControl=parent;
                break;
            }
            src = parent;
        } while(src != null);
    }
NewPropertyPanelTest.java 文件源码 项目:incubator-netbeans 阅读 29 收藏 0 点赞 0 评论 0
public void assertLost(String msg) {
    int currLostCount = lostCount;
    lostCount = 0;
    FocusEvent lost = lostEvent;
    lostEvent = null;
    assertNotNull (msg, lost);
    assertTrue("Received wrong number of focus lost events for a single click away from a focused renderer" + currLostCount, currLostCount == 1);
}
ConfigurationsComboModel.java 文件源码 项目:incubator-netbeans 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void focusLost(FocusEvent fe) {
    confirm(fe);
}
SynthTextFieldUI.java 文件源码 项目:jdk8u-jdk 阅读 28 收藏 0 点赞 0 评论 0
public void focusLost(FocusEvent e) {
    getComponent().repaint();
}
TextFieldFocusListener.java 文件源码 项目:incubator-netbeans 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void focusLost(FocusEvent e) {
    /*
     * do nothing
     */
}
WComponentPeer.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
@Override
public boolean requestFocus(Component lightweightChild, boolean temporary,
                            boolean focusedWindowChangeAllowed, long time,
                            FocusEvent.Cause cause)
{
    if (WKeyboardFocusManagerPeer.
        processSynchronousLightweightTransfer((Component)target, lightweightChild, temporary,
                                              focusedWindowChangeAllowed, time))
    {
        return true;
    }

    int result = WKeyboardFocusManagerPeer
        .shouldNativelyFocusHeavyweight((Component)target, lightweightChild,
                                        temporary, focusedWindowChangeAllowed,
                                        time, cause);

    switch (result) {
      case WKeyboardFocusManagerPeer.SNFH_FAILURE:
          return false;
      case WKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
          if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
              focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target);
          }
          Window parentWindow = SunToolkit.getContainingWindow((Component)target);
          if (parentWindow == null) {
              return rejectFocusRequestHelper("WARNING: Parent window is null");
          }
          final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
                                               .getPeer(parentWindow);
          if (wpeer == null) {
              return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
          }
          boolean res = wpeer.requestWindowFocus(cause);

          if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
              focusLog.finer("Requested window focus: " + res);
          }
          // If parent window can be made focused and has been made focused(synchronously)
          // then we can proceed with children, otherwise we retreat.
          if (!(res && parentWindow.isFocused())) {
              return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
          }
          return WKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
                                                        (Component)target,
                                                        temporary,
                                                        focusedWindowChangeAllowed,
                                                        time, cause);

      case WKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
          // Either lightweight or excessive request - all events are generated.
          return true;
    }
    return false;
}


问题


面经


文章

微信
公众号

扫码关注公众号