I'm making a browser just to practice my Java skills, is there a way to make my address bar which is a JTextField, larger instead of the swing's default value and also curvier. Here's my code.
//imports of the GUI
//import java.awt.*;
//import java.awt.event.*;
//import javax.swing.*;
//import javax.swing.event.*;
//import javax.swing.text.*;
//import javax.swing.GroupLayout.*;
//extends is to use the GUI class
public class ReadFile extends JFrame {
private JTextField addressBar; //to have the address bar
private JEditorPane display; //display the html information
//constructor
//Set the frame icon to an image loaded from a file.
public ReadFile() {
super("SPHERE"); //name of the browser
addressBar = new JTextField("enter an URL", 50); //inside the URL
addressBar.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){
loadCrap(event.getActionCommand());
}
}
);
add(addressBar, BorderLayout.NORTH);
display = new JEditorPane();
display.setEditable(false);
display.addHyperlinkListener(
new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent event){
if(event.getEventType()==HyperlinkEvent.EventType.ACTIVATED){
loadCrap(event.getURL().toString());
}
}
}
);
add(new JScrollPane(display), BorderLayout.CENTER);
setSize(600,200);
setVisible(true);
}
//load crap to display on the screen
private void loadCrap(String userText){
try{display.setPage(userText);
addressBar.setText(userText);}catch(Exception e){System.out.println("crap!")}
}
}
I want to make a really usable browser, like I want the html and its' CSS pages to show, what else do I have to learn to make this work.