How to create Web Browser with the help of JAVA
Hello Programming Gurus,
Today I get the Assignment from the college for creating the Web browser with the help of JAVA.
I have done Enough programming in the JAVA but I am little confused in creating the web browser, what all tools would be required so that I can save my time in codding each pane of my web site, again which method I have to make use of in my Programming.
please help.:no:
Re: How to create Web Browser with the help of JAVA
Do you mean actually write a component that acts like a browser? You will need to implement HTML and JavaScript and ... . You can look at some opensource java browser projects to get started.
Do you mean use a browser component? Well there is JDIC, Commercial browser components and JRex.
Re: How to create Web Browser with the help of JAVA
Hi, Nice to see your Reply. I want to create a Web Browser Project, Not a componenet. Can you tell me some open source browsers developed in java.
I dont want to embedd other default browsers.
After that I want to use character encoding in this project.
Thank You
Re: How to create Web Browser with the help of JAVA
The WebBrowser.setContent() function is perfect for loading your own machine-generated content, and events can be captured and processed appropriately. It would even be possible to have a hybrid application, with part of the interface being straight Processing and the rest AWT. I’m keen to try using this to create more complex on-screen layouts. HTML and CSS will always look much better than anything one could create using Swing.
Re: How to create Web Browser with the help of JAVA
please let me know what subjects i need to take to be able create a good web browser without commercial aid(pre-developed), i've learnt how to create a dynamic webpage
Re: How to create Web Browser with the help of JAVA
Quote:
Originally Posted by
himclay
please let me know what subjects i need to take to be able create a good web browser without commercial aid(pre-developed), i've learnt how to create a dynamic webpage
I have made an unfinished web browser in java that might be a good start for you, check the below code:
Code:
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class WebBrowser extends JFrame {
public JPanel
address_panel, window_panel;
public JLabel
address_label;
public JTextField
address_tf;
public JEditorPane
window_pane;
public JScrollPane
window_scroll;
public JButton
address_b;
private Go go = new Go();
public WebBrowser() throws IOException {
// Define address bar
address_label = new JLabel(" address: ", SwingConstants.CENTER);
address_tf = new JTextField("http://www.yahoo.com");
address_tf.addActionListener(go);
address_b = new JButton("Go");
address_b.addActionListener(go);
window_pane = new JEditorPane("http://www.yahoo.com");
window_pane.setContentType("text/html");
window_pane.setEditable(false);
address_panel = new JPanel(new BorderLayout());
window_panel = new JPanel(new BorderLayout());
address_panel.add(address_label, BorderLayout.WEST);
address_panel.add(address_tf, BorderLayout.CENTER);
address_panel.add(address_b, BorderLayout.EAST);
window_scroll = new JScrollPane(window_pane);
window_panel.add(window_scroll);
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
pane.add(address_panel, BorderLayout.NORTH);
pane.add(window_panel, BorderLayout.CENTER);
setTitle("web browser");
setSize(800,600);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public class Go implements ActionListener{
public void actionPerformed(ActionEvent ae){
try {
window_pane.setPage(address_tf.getText());
} catch (MalformedURLException e) { // new URL() failed
window_pane.setText("MalformedURLException: " + e);
} catch (IOException e) { // openConnection() failed
window_pane.setText("IOException: " + e);
}
}
}
public static void main(String args[]) throws IOException {
WebBrowser wb = new WebBrowser();
}
}
Re: How to create Web Browser with the help of JAVA
how create in mobile version??
and what specific jar for this?
Re: How to create Web Browser with the help of JAVA
Quote:
Originally Posted by
boymagi
how create in mobile version??
and what specific jar for this?
Mobile browsers render web pages differently from desktop browsers, so some steps are needed to make them work well on phones. This article here contains some basic technical and non-technical tips for making your web content faster and more suitable for consumption on mobile devices.