public class OpenMenuListener implements ActionListener
{
    public void actionPerformed(ActionEvent ev)
{
if(ev.getSource() == b)
{

    f2 = new JFrame("shashikant verma");
    p2 = new JPanel();
    f2.getContentPane().add(p2);


    String str = "<html>"+"<h>"+"<P ALIGN = \"CENTER\">"+"<i>"+"<font size = \"10\">"+"<font color= \"#800080\">"+"2. Definition of Function<br>"+"<br>"+"</i>"+"</h>"+"<P ALIGN = \"LEFT\">"+"<font size = \"5\">"+"2.1 "+"<u>"+"Mathematical Definition <br>"+"</u>"+"<P ALIGN=\"LEFT\">"+ "<font size = \"4\">"+
    " The nineteenth century has named as the century of theory of functions (Volterra(1894) and (1881)). From the point of view of  <br>"+
    "mathematicians we first state the definition of a function .<br>"+"<br>"+
                "A function "+"<i>"+" f "+"</i>"+" as assigning to each element "+"<i>"+" x "+"</i>" +"of some set S an element"+ "<i>"+"<font size =\"4\"> "+" f(x) "+"</i>" +"of another set T. The element"+"<i>"+"<font size =\"4\"> "+" f (x)"+"</i>"+"is called the value of  <br>"+
    "<i>"+"<font size =\"4\"> "+" f "+"</i>"+"at "+"<i>"+"<font size =\"4\"> "+" x "+"</i>" +". However, this is not a satisfactory definition of function because of the ambiguity of the word assign. Mathematicians were <br>"+
    "well known about the said unsatisfactory definition of function. Moreover,they describe another definition so called "+ "&#34"+"Cartesian product sets"+"&#34"+" <br>"+
    "which is given below<br>"+"<br>"+
    "<font size = \"5\">"+"2.1.1 "+"<u>"+"Cartesian product sets <br>"+"</u>"+"</font>"+"<P ALIGN=\"LEFT\">"+ "<font size = \"4\">"+
    "If S and T are two sets, then the Cartesian product set S "+"&#215"+" T is formed by taking all ordered pairs (p, q) where p"+ "<font size =\"4\"> "+"&#8712"+"<font size =\"4\"> "+ "Sand q"+"&#8712"+" T.<br>"+
    "For example, if S = {1,2,3,..............n} and T = { 1,2,3,................,m}, then the elements of S"+"&#215"+"T are pairs (i,j) of positive integers with s<br>"+
    "1"+" &#8804 "+" i "+" &#8804 "+"n , "+"1 "+" &#8804"+" j " +" &#8804 "+" m.<br>"+"<br>"+
    "On the basis of above definition , any subset "+"<i>"+" f "+"</i>"+"of the Cartesian product S"+"&#215 "+"T"+"is called a relation between S and T. A relation "+"<i>"+" f "+"</i>"+"is called a<br>"+
    "function if for every p " +"&#8712"+" S there is exactly one q"+"&#8712"+ " T such that (p,q)"+"&#8712"+   "<i>"+"f. " +"</i>"+"The element q is denoted by"+"<i>"+" f "+"</i>"+"(p) i.e. q="+"<i>"+" f "+"</i>"+"(p). An another <br>"+
    "interpretation of the definition of function can also be found in Bishop and Bridges (1985) as choice function.<br>"+"<br>"+
    "<font size = \"5\">"+"2.2 "+"<u>"+"Logical Definition  "+"</u>"+"</font>"+"<font size = \"4\">"+"(see, Church (1941))<br>"+"</font>"+"<P ALIGN=\"LEFT\">"+ "<font size = \"4\">"+
    "Let y = "+"<i>"+"f "+"</i>"+ " (x) "+" where "+"<i>"+" f "+"</i>"+" is mapping or correspondence. That is,a function is a rule of correspondence by which when any thing is given <br> "+
    "(as argument) another thing(the value of the function for that argument) may be obtained. In other words,we can say that a function <br>"+
    "is an operation, which may be applied on one thing (the argument) to yield another thing (the value of the function). It is not however <br>"+
    "required that the operation shall necessarily be applicable to everything whatsoever. But for each function, there is a class, or range,<br>"+
    "of possible argument,the class of things to which the operation is signifcantly applicable. And this we shall call the range of arguments,<br>"+
    "or range of independent variables,for that function. The class of all values of the functions, obtained by taking all possible argumnets,<br>"+
    "will be called the range of values, or range of the dependent variable.<br>"+"<br>"+
    "It is, of course not excluded that the range of arguments or range of value of a function should consist wholly or partly of function. The <br>"+
    "derivative, as this notions appears in the elementary differential calculus, is a familiar mathematical example of a function for which both<br>"+
    "ranges consist of functions. Or, turning to the integral calculus, if in the expression "+"<font size = \"5\">"+"<font size = \"2\">"+"<sup>"+"<marginRight =\"10px\" >"+"1"+"</marginRight>"+"</sup>"+"</font>"+"&#8747"+"</font>" +"<font size =\"2\">"+"<sub>"+"0"+"</sub>"+"</font>"+"f"+"xdx "+" we take the function "+"<i>"+" f "+"</i>"+" as indepdent variable, we are led to  <br>"+
    "a function for which the range arguments consist of functions and range of values of numbers. <br>"+"<br>"+
    "In particular, it is not excluded that one of the elements of the range of arguments of a function"+"<i>"+" f "+"</i>"+"should be the function<i>"+" f "+"</i>"+" itself. This possibility <br>"+
    "has frequently been denied and indeed, if a function is defined as a correspondence between two previously given ranges, the reason for<br>"+
    "denial is clear. Here, however, we regard the operation or rule of correspondence, which constitutes the function, as being first given, and <br>"+
    "range of arguments then determined as consisting of the things to which the operation is applicable. This is a departure from the point of <br>"+
    "view of mathematics as stated above.<br>"+"<br>"+
    "<font size = \"5\">"+"2.3 "+"<u>"+"Physical Definition<br> "+"</u>"+"</font>"+
    "Hosemann and Bagchi (1962) have pointed out that the function should be defined for a single precise value of x. The question of precision<br>"+
    "is inherent in all physical problems.  Consequently, all physical measurements or observations put a separate interval of the variable x.<br>"+
    "This means that physically observable functions define the unique value of the mathematical function not at a point x.  Obviously, these<br>"+
    "are integral values of mathematical function over a domain determined by the precision of measurements. In other words, we can say <br>"+
    "that the values determined by the observer of his/her experiment should lie in an interval and not at a point. (see also, Misra (2002),pp.155-161.)<br>"+"<br>"+
    "<font size = \"5\">"+"2.4 "+"<u>"+"Conclusive Definition<br> "+"</u>"+"</font>"+
    "As given above, Mathematicians, Logicians and Applied Physicists have pointed out deficiencies in the definitions of a function. Last two <br>"+ 
    "different disciplines have common cause and pointed out towards a new structure of a function,which may have the following properties.<br>"+
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"(i)   Its value should lie in an interval and not at a point.<br>"+
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"(ii)  The structure of such mathematical functions should define its value itself.<br>"+
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"(iii) The function f(x) and f should have the same meaning. It is to be remarked here <br>"+
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"that the Functional Programming using Haskell(Bird (1998)) has developed by considering f(x) and f have the same value.<br>"+
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"(iv) The value of such mathematical function should define about a point and not at a point.<br>"+"</html>";    



    strLabel = new JLabel (str);
    p2.add(strLabel);
    jsp = new JScrollPane(strLabel);    
    jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    f2.getContentPane().add(jsp);

    f2.setSize(600,400);
    f2.setVisible(true);
    //setBounds (600,400);

    //f2.setResizable ( false );


}

Through the particular text given in Jlabel as an html string input i want to call a new frame.

pls help me for that

thanks in advance for reply
shashikant

Take a look here:

hyperlink Jbutton

An answer on that thread states that it might be better to add the Hyperlink to a JButton rather than a JLabel, so that you can just use ActionListener for event handling. I am inclined to agree with this, the poster also provides some sample code you can work from. It's a very good post! P.S. please use code tags when submitting code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.