本文整理汇总了Java中javax.swing.JTextField.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.addMouseListener方法的具体用法?Java JTextField.addMouseListener怎么用?Java JTextField.addMouseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.addMouseListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UserPanel
import javax.swing.JTextField; //导入方法依赖的package包/类
public UserPanel()
{
resultsModel = new GenericListModel<Object>();
results = new JList(resultsModel);
results.addListSelectionListener(this);
query = new JTextField();
query.addActionListener(this);
search = new JButton(CurrentLocale.get("searching.userGroupRole.executeQuery"));
search.addActionListener(this);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout(5, 5));
panel.add(new JLabel(CurrentLocale.get("com.tle.admin.recipients.browserfinder.users")), BorderLayout.WEST);
panel.add(query, BorderLayout.CENTER);
panel.add(search, BorderLayout.EAST);
query.addMouseListener(mouse);
search.addMouseListener(mouse);
results.addMouseListener(mouse);
setLayout(new BorderLayout(5, 5));
add(panel, BorderLayout.NORTH);
add(new JScrollPane(results), BorderLayout.CENTER);
setBorder(new EmptyBorder(5, 5, 5, 5));
}
示例2: WhoIsControl
import javax.swing.JTextField; //导入方法依赖的package包/类
public WhoIsControl() {
super();
setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
// top panel, start/cancel button and JTextField
_whoIsButton = new JButton(GO_IMG);
_whoIsButton.setToolTipText(Resources.getLabel("whois.button"));
_hostIpTextField = new JTextField(17);
_hostIpTextField.setText(Resources.getLabel("enter.whois"));
final FirstInputListener listener = new FirstInputListener(_hostIpTextField);
_hostIpTextField.addMouseListener(listener);
_hostIpTextField.addKeyListener(listener);
_hostIpTextField.setToolTipText(Resources.getLabel("enter.whois"));
add(_hostIpTextField);
add(_whoIsButton);
// search button enable if text is not blank
_hostIpTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
_whoIsButton.setEnabled(!_hostIpTextField.getText().equals(""));
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
_whoIsButton.getActionListeners()[0].actionPerformed(new ActionEvent(this, 0, "whois"));
}
}
});
// action of search/cancel trace route
_whoIsButton.addActionListener(arg0 -> whois());
_whoIsButton.setEnabled(false);
_autocomplete = new AutoCompleteComponent(_hostIpTextField, _services.getAutocomplete());
}
示例3: addListener
import javax.swing.JTextField; //导入方法依赖的package包/类
JTextField addListener(final JTextField f) {
f.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
body.setCaretPosition(Integer.valueOf(f.getText()));
body.getCaret().setVisible(true);
}
});
return f;
}
示例4: SnifferControl
import javax.swing.JTextField; //导入方法依赖的package包/类
public SnifferControl() {
super();
setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
_hostIpTextField = new JTextField(17);
_hostIpTextField.setText(Resources.getLabel("sniffer.host.tooltip"));
final FirstInputListener listener = new FirstInputListener(_hostIpTextField);
_hostIpTextField.addMouseListener(listener);
_hostIpTextField.addKeyListener(listener);
_hostIpTextField.setToolTipText(Resources.getLabel("sniffer.host.tooltip"));
add(_hostIpTextField);
final JLabel protocolLabel = new JLabel(Resources.getLabel("protocol.label"));
protocolLabel.setToolTipText(Resources.getLabel("protocol.desc"));
add(protocolLabel);
for (final Protocol type : Protocol.values()) {
if (type == Protocol.OTHER) {
continue;
}
final JCheckBox check = new JCheckBox(type.name(), type == Protocol.TCP);
_packets.put(type, check);
add(check);
}
final JLabel portLabel = new JLabel(Resources.getLabel("port.label"));
portLabel.setToolTipText(Resources.getLabel("port.desc"));
_allPortCheck = new JCheckBox(Resources.getLabel("all.port.label"));
_allPortCheck.setToolTipText(Resources.getLabel("all.port.desc"));
_allPortCheck.setSelected(false);
add(_allPortCheck);
_portTF = new JFormattedTextField();
_portTF.setText("80,443");
_portTF.setColumns(15);
// _portTF.setMaximumSize(new Dimension(30, _portTF.getPreferredSize().height));
add(portLabel);
add(_portTF);
_portTF.setEnabled(true);
_allPortCheck.addChangeListener(e -> _portTF.setEnabled(!_allPortCheck.isSelected()));
_filterPacketLengthCheck = new JCheckBox(Resources.getLabel("filter.length"));
_filterPacketLengthCheck.setToolTipText(Resources.getLabel("filter.length.desc"));
_filterPacketLengthCheck.setSelected(false);
add(_filterPacketLengthCheck);
_filterLengthTF = new JFormattedTextField(new NumberFormatterFactory());
_filterLengthTF.setText("128");
_filterLengthTF.setColumns(5);
add(_filterLengthTF);
_filterPacketLengthCheck.addChangeListener(e -> _filterLengthTF.setEnabled(_filterPacketLengthCheck.isEnabled() && _filterPacketLengthCheck.isSelected()));
_capturePeriod = new JFormattedTextField(new NumberFormatterFactory());
_capturePeriod.setText("0");
_capturePeriod.setColumns(5);
add(new JLabel(Resources.getLabel("capture.period")));
add(_capturePeriod);
_captureButton = new JButton(GO_IMG);
_captureButton.setToolTipText(Resources.getLabel("capture.packet.start"));
add(_captureButton);
_captureButton.addActionListener(arg0 -> start());
}