{ ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent ev) { if (!(StringUtil.isNullOrTrimmedEmpty(dstLoginId.getText())) && !(StringUtil.isNullOrTrimmedEmpty(sendMsg.getText()))) { try { plugin.sendMessage(getMyLoginId(), dstLoginId.getText(), sendMsg.getText()); sendMsg.setText("msg " + Math.random()); } catch (Throwable tr) { printException(tr); } } } }; sendMsg.selectAll(); sendMsg.addActionListener(al); dstLoginId.addActionListener(al); }
public void focusGained(FocusEvent e) { Component c = e.getComponent(); if (c instanceof TextField) ((TextField) c).selectAll(); }