本文整理汇总了Java中javax.swing.JTextField.setToolTipText方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setToolTipText方法的具体用法?Java JTextField.setToolTipText怎么用?Java JTextField.setToolTipText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setToolTipText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: finishRename
import javax.swing.JTextField; //导入方法依赖的package包/类
private void finishRename(JTextField text, boolean saveName) {
String newName = text.getText();
if (saveName && newName != null && newName.length() > 0) {
try {
m_controller.rename(m_reference, newName);
} catch (IllegalNameException ex) {
text.setBorder(BorderFactory.createLineBorder(Color.red, 1));
text.setToolTipText(ex.getReason());
GuiTricks.showToolTipNow(text);
}
return;
}
// abort the rename
JPanel panel = (JPanel)m_infoPanel.getComponent(0);
panel.remove(panel.getComponentCount() - 1);
panel.add(GuiTricks.unboldLabel(new JLabel(m_reference.getNamableName(), JLabel.LEFT)));
m_editor.grabFocus();
redraw();
}
示例2: addClassNameEditor
import javax.swing.JTextField; //导入方法依赖的package包/类
static JTextField addClassNameEditor(JComponent comp, String className, String tooltipText) {
JTextField textField = new JTextField(className); // NOI18N
java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
comp.add(textField, gridBagConstraints);
textField.setToolTipText(tooltipText);
return textField;
}
示例3: getComponent
import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public JTextField getComponent() {
JTextField result = getTextField();
if (this.editingValueForKey != null) {
PropertyKey<?> key = getKey(this.editingValueForKey);
if (key != null) {
Parser<?> parser = key.parser();
String tip = parser.getDescription();
result.setToolTipText(HTMLConverter.HTML_TAG.on(tip));
}
}
return result;
}
示例4: 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());
}
示例5: Main
import javax.swing.JTextField; //导入方法依赖的package包/类
public Main() {
setTitle("Twitch Comment Talker");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImageIcon icon = new ImageIcon("./icon.png");
setIconImage(icon.getImage());
setBounds(100, 100, 300, 248);
setResizable(false);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblAuthPassword = new JLabel("OAuth Pass");
lblAuthPassword.setBounds(12, 10, 86, 13);
contentPane.add(lblAuthPassword);
textAuthPassword = new JPasswordField();
textAuthPassword.setBounds(110, 7, 172, 19);
contentPane.add(textAuthPassword);
textAuthPassword.setEchoChar('*');
textAuthPassword.setColumns(10);
textAuthPassword.setEditable(false);
JLabel lblUserName = new JLabel("Channel Name");
lblUserName.setBounds(12, 33, 86, 13);
contentPane.add(lblUserName);
textUserName = new JTextField();
textUserName.setBounds(110, 30, 172, 19);
contentPane.add(textUserName);
textUserName.setColumns(10);
textUserName.setToolTipText("https://www.twitch.tv/~~~の~~~部分をそのまま入力して下さい。");
btnConnect.setBounds(8, 148, 276, 38);
contentPane.add(btnConnect);
btnConnect.addActionListener(this);
btnConnect.setActionCommand("btnConnect");
btnConnect.setToolTipText("Twitchコメントに接続します。");
JLabel lblStatus = new JLabel("Status:");
lblStatus.setBounds(12, 196, 43, 13);
contentPane.add(lblStatus);
lblStatus_1.setBounds(67, 196, 215, 13);
contentPane.add(lblStatus_1);
chkReadName.setBounds(8, 52, 264, 21);
contentPane.add(chkReadName);
chkReadName.addActionListener(this);
chkReadName.setActionCommand("chkReadName");
chkReadName.setToolTipText("コメント投稿者のユーザー名を読み上げます。");
chkUseEnglish.setBounds(8, 75, 137, 21);
contentPane.add(chkUseEnglish);
chkUseEnglish.addActionListener(this);
chkUseEnglish.setActionCommand("chkUseEnglish");
chkUseEnglish.setToolTipText("英文が投稿された時、SAPI5で読み上げをします。");
btnSAPI = new JButton(vapi.getVoice());
btnSAPI.setBounds(153, 76, 129, 19);
contentPane.add(btnSAPI);
btnSAPI.addActionListener(this);
btnSAPI.setActionCommand("btnSAPI");
chkPopup.setBounds(8, 121, 137, 21);
contentPane.add(chkPopup);
chkPopup.addActionListener(this);
chkPopup.setActionCommand("chkPopup");
chkPopup.setToolTipText("コメント受信時に通知ポップアップを表示します。");
chkReadEmote.setBounds(8, 98, 137, 21);
contentPane.add(chkReadEmote);
chkReadEmote.addActionListener(this);
chkReadEmote.setActionCommand("chkReadEmote");
chkReadEmote.setToolTipText("エモート語句を読み上げします。");
loadConfigFile();
}
示例6: CollectionPanel
import javax.swing.JTextField; //导入方法依赖的package包/类
/**
* Create the panel.
*/
public CollectionPanel() {
setLayout(null);
collection = new ArrayList<String>();
txtSearch = new JTextField();
txtSearch.setToolTipText("Search...");
txtSearch.setBounds(208, 29, 278, 28);
add(txtSearch);
txtSearch.setColumns(100);
btnSearch = new JButton("Search");
btnSearch.setBounds(506, 30, 117, 29);
add(btnSearch);
JLabel lblSearch = new JLabel("Search:");
lblSearch.setFont(new Font("Lucida Grande", Font.PLAIN, 25));
lblSearch.setBounds(108, 23, 88, 31);
add(lblSearch);
btnCraft = new JButton("Craft");
btnCraft.setBounds(245, 266, 117, 29);
add(btnCraft);
btnDust = new JButton("Dust");
btnDust.setBounds(374, 266, 117, 29);
add(btnDust);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(23, 73, 646, 181);
add(scrollPane);
list = new JList<String>(collection_model);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scrollPane.setViewportView(list);
btnBack = new JButton("Back");
btnBack.setBounds(22, 266, 117, 29);
add(btnBack);
lblDust = new JLabel("Dust:");
lblDust.setHorizontalAlignment(SwingConstants.TRAILING);
lblDust.setBounds(563, 271, 106, 16);
add(lblDust);
}
示例7: createNewColumn
import javax.swing.JTextField; //导入方法依赖的package包/类
private void createNewColumn() {
// name
JTextField nameField = new JTextField();
nameField.setToolTipText("The name of the attribute.");
cellEditors.add(NAME_ROW, new DefaultCellEditor(nameField));
// type
JComboBox typeBox = new JComboBox(Attributes.KNOWN_ATTRIBUTE_TYPES);
typeBox.setEditable(true);
typeBox.setToolTipText("The type of the attribute ('attribute' for regular learning attributes or a special attribute name).");
cellEditors.add(TYPE_ROW, new DefaultCellEditor(typeBox));
// value type
List<String> usedTypes = new LinkedList<>();
for (int i = 0; i < Ontology.VALUE_TYPE_NAMES.length; i++) {
if (i != Ontology.ATTRIBUTE_VALUE && i != Ontology.FILE_PATH
&& !Ontology.ATTRIBUTE_VALUE_TYPE.isA(i, Ontology.DATE_TIME)) {
usedTypes.add(Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(i));
}
}
String[] valueTypes = new String[usedTypes.size()];
int vCounter = 0;
for (String type : usedTypes) {
valueTypes[vCounter++] = type;
}
JComboBox valueTypeBox = new JComboBox(valueTypes);
valueTypeBox.setToolTipText("The value type of the attribute.");
cellEditors.add(VALUE_TYPE_ROW, new DefaultCellEditor(valueTypeBox));
// block type
JComboBox blockTypeBox = new JComboBox(Ontology.ATTRIBUTE_BLOCK_TYPE.getNames());
blockTypeBox.setToolTipText("The block type of this attribute.");
cellEditors.add(BLOCK_TYPE_ROW, new DefaultCellEditor(blockTypeBox));
// separator
JTextField separator = new JTextField();
separator.setToolTipText("Separates meta data from data.");
separator.setEditable(false);
cellEditors.add(SEPARATOR_ROW, new DefaultCellEditor(separator));
for (int i = 0; i < cellRenderers.getSize(); i++) {
cellRenderers.add(i, new EditorCellRenderer(cellEditors.get(i, cellEditors.getSize(i) - 1)));
}
dataColumnVector.add(new Vector<String>());
this.dataChanged = true;
this.metaDataChanged = true;
}
示例8: initGuiComponents
import javax.swing.JTextField; //导入方法依赖的package包/类
protected void initGuiComponents(){
this.getContentPane().setLayout(new BoxLayout(this.getContentPane(),
BoxLayout.Y_AXIS));
//name field
Box nameBox = Box.createHorizontalBox();
nameBox.add(Box.createHorizontalStrut(5));
nameBox.add(new JLabel("Name: "));
nameBox.add(Box.createHorizontalStrut(5));
nameField = new JTextField(30);
nameField.setMaximumSize(
new Dimension(Integer.MAX_VALUE, nameField.getPreferredSize().height));
nameField.setRequestFocusEnabled(true);
nameField.selectAll();
nameField.setVerifyInputWhenFocusTarget(false);
nameBox.add(nameField);
nameField.setToolTipText("Enter a name for the resource");
nameBox.add(Box.createHorizontalStrut(5));
nameBox.add(Box.createHorizontalGlue());
this.getContentPane().add(nameBox);
this.getContentPane().add(Box.createVerticalStrut(5));
//parameters table
parametersEditor = new ResourceParametersEditor();
tableScroll = new JScrollPane(parametersEditor);
this.getContentPane().add(tableScroll);
this.getContentPane().add(Box.createVerticalStrut(5));
this.getContentPane().add(Box.createVerticalGlue());
//buttons box
JPanel buttonsBox = new JPanel();
buttonsBox.setLayout(new BoxLayout(buttonsBox, BoxLayout.X_AXIS));
buttonsBox.add(Box.createHorizontalStrut(10));
buttonsBox.add(okBtn = new JButton("OK"));
buttonsBox.add(Box.createHorizontalStrut(10));
buttonsBox.add(cancelBtn = new JButton("Cancel"));
buttonsBox.add(Box.createHorizontalStrut(10));
buttonsBox.add(helpBtn = new JButton("Help"));
buttonsBox.add(Box.createHorizontalStrut(10));
this.getContentPane().add(buttonsBox);
this.getContentPane().add(Box.createVerticalStrut(5));
setSize(400, 300);
getRootPane().setDefaultButton(okBtn);
}
示例9: initGui
import javax.swing.JTextField; //导入方法依赖的package包/类
void initGui() {
Font font = new Font("Courier", Font.PLAIN, 14);
command = new JTextField(40);
command.setFont(font);
command.setToolTipText("Type a Jason operation here.");
command.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
execCmd(command.getText().trim());
}
});
//mindPanel = new JTextPane();
//mindPanel.setEditable(false);
//mindPanel.setContentType("text/html");
output = new JTextArea(5,50);
output.setFont(font);
output.setEditable(false);
output.setText("Example of operations you can type:\n +bel; !goal; .add_plan({+!goal <- .print(ok) }); !!goal; \n .send(bob,tell,hello);\n");
output.append(" ?bel(A); .findall(X,bel(X),L); \n");
output.append(" .mi // to open mind inspector\n");
output.append(" .verbose(2) // to show debug messages\n");
output.append(" .clear // clean console\n");
output.append("\nYou can add more agents using the button 'new REPL ag' in MAS Console.");
output.append("\n");
frame = new JFrame(".:: REPL Interface for "+getTS().getUserAgArch().getAgName()+" ::.");
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(BorderLayout.NORTH,command);
//f.getContentPane().add(BorderLayout.CENTER, new JScrollPane(mindPanel));
frame.getContentPane().add(BorderLayout.CENTER,new JScrollPane(output));
frame.pack();
int h = 200;
int w = (int)(h*2*1.618);
frame.setBounds((int)(h*0.618), 20, w, h);
frame.setLocation(lastPos, 200+lastPos);
lastPos += 50;
frame.setVisible(true);
}
示例10: configureSMSFunctionality
import javax.swing.JTextField; //导入方法依赖的package包/类
public void configureSMSFunctionality()
{
System.out.println("configurateSMSFunctionality called");
JPanel topSMSPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel centerSMSPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel bottomSMSPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
SMSGui = new JFrame();
SMSGui.setSize(450, 200);
SMSGui.setLayout(new FlowLayout(FlowLayout.LEFT));
SMSGui.setTitle("Configure SMS Reminders");
SMSGui.setLocationRelativeTo(null);
JLabel spacer = new JLabel(" ");//spacer
JLabel phoneNumberPrompt = new JLabel("Phone Number:");
JLabel carrierPrompt = new JLabel("Select Carrier:");
JLabel passwordPrompt = new JLabel("Password:");
passwordField = new JTextField(10);
passwordField.setToolTipText("Password is Memoranda");
phoneNumberField = new JTextField(10);
carrierList = new JComboBox<String>();
carrierList.addItem("T-Mobile");//@tmomail.net
carrierList.addItem("Sprint");//@messaging.sprintpcs.com
carrierList.addItem("Verizon");//@vtext.com
carrierList.addItem("Virgin");//@vmobl.com
carrierList.addItem("Cingular");//@cingularme.com
carrierList.addItem("Nextel");//@messaging.nextel.com
JButton setConfigurationButton = new JButton("Set Configuration");
setConfigurationButton.addActionListener(captureSMSConfiguration);
topSMSPanel.add(phoneNumberPrompt);
topSMSPanel.add(phoneNumberField);
centerSMSPanel.add(carrierPrompt);
centerSMSPanel.add(carrierList);
bottomSMSPanel.add(passwordPrompt);
bottomSMSPanel.add(passwordField);
bottomSMSPanel.add(spacer);
bottomSMSPanel.add(setConfigurationButton);
SMSGui.add(topSMSPanel);
SMSGui.add(centerSMSPanel);
SMSGui.add(bottomSMSPanel);
SMSGui.setVisible(true);
}
示例11: 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());
}