I am designing a web browser..It Is displaying the web pages but now the problem is....it is not parsing the page properly (i.e when i browse for "Google" page with my web browser,it is displaying but with a blue background and not aligned properly too)....can anyone help me by saying how to parse(cascading style sheet) in HTML with java swing,,A part of code is displayed below
class Page extends JPanel implements Action Listener
{
JPanel head;
JTextField addrbar;
JEditorPane webpage;
JScrollPane scr;
JLabel statusbar;
JButton homebtn,refreshbtn,gobtn,hisbtn,bookbtn,shbtn;
public Page()
{
setLayout(new BorderLayout());
head=new JPanel();
head.setLayout(new FlowLayout());
homebtn=new JButton("Home");
homebtn.addActionListener(this);
head.add(homebtn);
addrbar=new JTextField(100);
addrbar.addActionListener(this);
head.add(addrbar);
gobtn=new JButton("Go");
gobtn.addActionListener(this);
head.add(gobtn);
hisbtn=new JButton("History");
System.out.println("action");
hisbtn.addActionListener(this);
head.add(hisbtn);
bookbtn=new JButton(new ImageIcon("Z://Browser/Source/Resources/Images/bkk.jpg"));
bookbtn.addActionListener(this);
head.add(bookbtn);
shbtn=new JButton("Show Bookmarks");
shbtn.addActionListener(this);
head.add(shbtn);
refreshbtn=new JButton("Refresh");
head.add(refreshbtn);
statusbar=new JLabel();
try{
URL url = new URL("http://www.google.com");
PrintWriter ps=new PrintWriter(new FileWriter("Z://Browser/Source/history.txt",true));
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy_HH:mm:ss");
Date date1 = new Date();
// ps.print(url +"_"+date.getDate()+"_"+(date.getMonth()+1)+"#");
ps.print(url +"_"+dateFormat.format(date1)+"#");
ps.close();
addrbar.setText(url.toString());
webpage=new JEditorPane(url);
webpage.setEditable(false);
webpage.addHyperlinkListener(new SimpleLinkListener(webpage,addrbar,statusbar));
scr=new JScrollPane(webpage, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
add(head,BorderLayout.NORTH);
add(scr,BorderLayout.CENTER);
add(statusbar,BorderLayout.SOUTH);
System.out.println(getSize());
}
catch(Exception e){}
}
}