?? fieldfocuslistener.java
字號:
/* * Copyright 2006-2007 JavaAtWork All rights reserved. * Use is subject to license terms. */package javaatwork.myuploader.listeners;import java.awt.event.FocusEvent;import java.awt.event.FocusListener;import javax.swing.JTextField;/** * Class for selecting the text of a input field when this * field gaines the focus. * * @author Johannes Postma */ public class FieldFocusListener implements FocusListener { /** * When the field gaines the focus. * * @param e The FocusEvent. */ public void focusGained(FocusEvent e) { JTextField field = (JTextField)e.getSource(); field.setSelectionStart(0); field.setSelectionEnd(field.getText().length()); } /** * When the field loses the focus. * * @param e The FocusEvent. */ public void focusLost(FocusEvent e) { JTextField field = (JTextField)e.getSource(); field.setSelectionStart(0); field.setSelectionEnd(0); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -