0
I am developing a project in Java to simulate a proxy server with authentication that presents a single interface, in which several internal frames are arranged inside it. How to position a browser within this interface JFrame?
Look at the design model:
And the code:
\\Código do Browser
package view;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
public class SwingHTMLBrowser extends JFrame implements ActionListener, HyperlinkListener {
    public JTextField addressBar;
    public JEditorPane pane;
    SwingHTMLBrowser() {
    super("Swing HTML Browser");
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        addressBar = new JTextField();
        addressBar.addActionListener(this);
        pane = new JEditorPane();
        pane.setEditable(false);
        pane.addHyperlinkListener(this);
        add(addressBar, BorderLayout.NORTH);
        add(new JScrollPane(pane));
        setSize(new Dimension(400, 400));
    }
    public void actionPerformed(ActionEvent evt) {
        String url = addressBar.getText();
        try {
            pane.setPage(url);
        } catch (IOException t) {
            t.printStackTrace();
        }
    }
    @Override
    public void hyperlinkUpdate(HyperlinkEvent evt) {
        if (evt.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
            return;
        }
        JEditorPane srcPane = (JEditorPane)evt.getSource();
        if (evt instanceof HTMLFrameHyperlinkEvent) {
            HTMLDocument doc = (HTMLDocument)pane.getDocument();
            doc.processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)evt);
        } else {
            String url = evt.getURL().toString();
            addressBar.setText(url);
            try {
                pane.setPage(url);
            } catch (Throwable t) {
                t.printStackTrace();
                }
            }
       }
    public static void main(String args[]) {
        SwingHTMLBrowser browser = new SwingHTMLBrowser();
        browser.setVisible(true);
    }
}
						

Welcome to Stackoverflow Vagner. And what is the result with this code you have today?
– Pedro Gaspar
What do you want to do? Is it like it is in the picture? The code does not represent what is in the picture.
– user28595
The code represents the browser. If tested it opens a Jframe screen. It is this screen that I intend to get inside the interface above.
– Vagner Santos
Just create a Jpanel with all that browser interface and play in a jframe,
– user28595
This is the problem, I cannot load this interface inside Jframe, when running it opens outside. If you test you can notice. There my knowledge in java is recent, so this degree of difficulty.
– Vagner Santos
I don’t understand your doubt yet. Do you want to create an interface similar to the correct figure? If it is this is simple.
– user28595
That’s right, this is the goal. It’s an Object-Oriented Programming project.
– Vagner Santos
If you can help me, I can put the name "stackoverflow" as the main intermediary of the project and I will be very grateful.
– Vagner Santos