package org.best.example;
/*
JTextField ToolTip Example
This java example shows how to set of get ToolTip for JTextField
using Java Swing JTextField class.
*/
import java.awt.FlowLayout;
import javax.swing.JApplet;
import javax.swing.JTextField;
/*
<applet code="JTextFieldTooltipExample" width=200 height=200>
</applet>
*/
public class JTextFieldTooltipExample extends JApplet{
public void init(){
//set flow layout for the applet
this.getContentPane().setLayout(new FlowLayout());
//create new JTextField
JTextField field = new JTextField("JTextField ToolTip Example",20);
/*
* To set JTextField's ToolTip use
* void setToolTipText(String toolTip)
* method.
*/
field.setToolTipText("This is JTextField's ToolTip");
/*
* To get the ToolTip of JTextField , use
* String getToolTipText()
* method of JTextField class.
*/
String toolTip = field.getToolTipText();
add(field);
}
}
/*
JTextField ToolTip Example
This java example shows how to set of get ToolTip for JTextField
using Java Swing JTextField class.
*/
import java.awt.FlowLayout;
import javax.swing.JApplet;
import javax.swing.JTextField;
/*
<applet code="JTextFieldTooltipExample" width=200 height=200>
</applet>
*/
public class JTextFieldTooltipExample extends JApplet{
public void init(){
//set flow layout for the applet
this.getContentPane().setLayout(new FlowLayout());
//create new JTextField
JTextField field = new JTextField("JTextField ToolTip Example",20);
/*
* To set JTextField's ToolTip use
* void setToolTipText(String toolTip)
* method.
*/
field.setToolTipText("This is JTextField's ToolTip");
/*
* To get the ToolTip of JTextField , use
* String getToolTipText()
* method of JTextField class.
*/
String toolTip = field.getToolTipText();
add(field);
}
}
No comments:
Post a Comment