public class OpenMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent ev)
{
if(ev.getSource() == a)
{
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\">"+"CORRECT DEFINITION AND<br>"+"STRUCTURE OF FUNCTION y = f(x) "+"<br>"+"</i>"+"</h>"+"<P ALIGN = \"LEFT\">"+"<font size = \"6\">"+"<u>"+"Introduction <br>"+"</u>"+"<P ALIGN=\"LEFT\">"+ "<font size = \"4\">"+
"It is a well-known fact that the Logicians,Mathematicians and Physicists have been pointing out about deficiencies in the definition<br>"+
"and structure of a function.This will lead us to the conclusion that in many physical phenomena there are failure processes <br>" +
"of Physics -Technology. In other words, Experimenters arrive at conclusions on experimental data and disconcern their reliability<br>"+
"which is related with errors and uncertainity associated with experimental results. The present work provides an account of the<br>"+
"deficiencies in the definitions and its value and limit about a point. This work leads to an important conclusion about an answer <br>"+
"to the failure process of Physics-Technology in terms of its correct measurements in the experiments.<br>"+"<br>"+"<P ALIGN =\"LEFT\">"+
"However, Distribution Theory (Schwartz (1996) ) generalizes Physicist's intuition (Dirac(1930)) about point particles which are <br>"+
"represented as"+"<font size =\"4\"> "+"&#948 -"+"<font size =\"4\"> "+ " Dirac function. Indeed, the definition and properties of "+"<font size =\"4\"> "+"&#948 -"+"<font size =\"4\"> "+"Dirac function in the sense of function are not eventually <br>"+
"true as pointed out by Mathmaticians. Moreover, Henk (2000) has pointed out to the author as to whether Distribution Theory <br>"+
"possesses such structure and properties to providing an answer to open question in logic to distinguish the value of function"+ "<i>"+"<font size =\"4\"> "+"f(x)"+"</i>" +"<br>"+
" at" +"<i>"+"<font size =\"4\"> "+"x"+ "</i>" +" and the function " +"<i>"+"<font size =\"4\"> "+" f "+"</i>" + " itself. <br>"+
"<br>"+"<P ALIGN =\"LEFT\">"+
"Moreover, it is to be remarked here that said deficiencies of the function have indeed led to the fact that the whole sciences, eventually <br>"+
"depend on function theory"+"<font size =\"4\"> "+"up till 20th"+"<font size =\"4\"> "+ " century are also based on the "+"<font size =\"4\"> "+"defects of mathematical tools."+"<font size =\"4\"> "+"For example, two developments <br>"+
"had the effect of removing certainity even from the findings of science and the meaning of physical laws. First it became clear that most <br>"+
"scientific knowledge was statistical . Secondly, the Heisenberg uncertanity principle set definite limits to the observational knoweledge one<br>"+
"could obtain from a system. The Principle, for example, defined the limit of accuracy with which one can simultaneously measure the <br>"+
"position and position and momentum of an electron . Such finding has quite naturally started scientists as well as philosphers thinking<br>"+
"very seriously about the problem of what one can know. What are the limitations of scientific knowledge?<br>"+"<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);

I want to call a frame with help of input given in html format in string str input
pls help me

I want to call  a frame with help of label input given in html format in string str = "<html>"+"gkgaskjh"+"</html>";
pls help me how we call a new frame with help of input given in html. in core java

Make your frame class as SINGLETON.
getInstance() always return the same instance

package shashikant;

import javax.swing.*;

public class MyFrame {

    private static JFrame f2;
    private static MyFrame thisClass;
    private static final String str = "<html>" + " ... " + "</html>";

    private MyFrame() {

        JLabel strLabel;
        JPanel p2;
        JScrollPane jsp;
        f2 = new JFrame("shashikant verma");
        p2 = new JPanel();
        f2.getContentPane().add(p2);
        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.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        f2.pack();
        f2.setVisible(true);
    }

    public static MyFrame getInstance() {
        if (thisClass == null) {
            thisClass = new MyFrame();
        }
        return thisClass;
    }

    public void setVisible(boolean b) {
        f2.setVisible(b);
    }
}

Implementation of OpenMenuListener

package shashikant;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class OpenMenuListener implements ActionListener {

    // a  - definition
    public void actionPerformed(ActionEvent ev) {
        if (ev.getSource().equals(a)) {
            MyFrame.getInstance().setVisible(true);
        }
    }

    //test
    public static void main(String args[]) {
        MyFrame.getInstance().setVisible(true);

    }
}
public class OpenMenuListener implements ActionListener
{
    public void actionPerformed(ActionEvent ev)
{

if(ev.getSource() == c)
{

    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\">"+"<br>"+"3. Logical structure of Schwartz Distribution<br>"+"</i>"+"</h>"+"<P ALIGN = \"LEFT\">"+"<font size = \"4\">"+"..................................."+"&#8594"+"<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);
}
}

all the code is right.Al unicode value is converting appropriate but it is not converting the value of unicode value RIGHTWARD arrow. although it is given in HTML 4.0 character entity "&#8594"---- RIGHTWARD arrows .
pls help me why it is not converting is there any syntax problem or what
waiting for reply
thanks and regard
shashikant verma

It works (view for font size = 40). Windows XP, jdk1.7.0

It works (view for font size = 40). Windows XP, jdk1.7.0

thanks for ur reply
i m trying with ur given reply
thanks and regard
shashikant verma

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.