Thursday, 4 October 2012

java tool tip

This java program is used to display a tool-tip.
//Java Core Package
import javax.swing.*;
//Java Extension Package
import java.awt.*;

public class JavaApplication2 extends JFrame {
    //Initializing JButton
    private JButton button;

    //Setting up GUI
    public JavaApplication2() {
        //Setting up the Title of the Window
        super("Add ToolTipText on JButton");

        //Set Size of the Window (WIDTH, HEIGHT)

        //Exit Property of the Window

        //Constructing JButton
        button = new JButton("Place The Cursor Here...");
        //Setting or Adding ToolTipText on JButton
        button.setToolTipText("My First ToolTipText on JButton");

        //Setting up the container ready for the components to be added.
        Container pane = getContentPane();
        //Setting up the container layout
        FlowLayout flow = new FlowLayout(FlowLayout.CENTER);

        //Adding the JButton component to the container

        /**Set all the Components Visible.
         * If it is set to "false", the components in the container will not be visible.
    //Main Method
    public static void main (String[] args) {
        JavaApplication2 ttt = new JavaApplication2();

Post a Comment