There are 4 ways to create your own panel :
Use JPanelPanel
Let's consider we want to create a new panel to visualize a new format:
package myviewer; import java.awt.BorderLayout; import javax.swing.*; public class MyTextViewer extends JPanel { public MyTextViewer() { this(null); } public MyTextViewer(String args) { JTextArea textArea = new JTextArea(args); textArea.setEditable(false); setLayout(new BorderLayout()); add(new JScrollPane(textArea), BorderLayout.CENTER); } }Then you only need to compile it, add the class in the lib directory and create a new panel JPanelPanel with the arguments "myviewer.MyTextViewer PI=3.1415"
extends ViewPanel
The example shows how the BshPanel is created
// JPanelPanel extends ViewPanel public class BshPanel extends JPanelPanel { public BshPanel(Model model) { super(model, "bsh.util.JConsole"); } public void initUI() { super.initUI(); Interpreter interpreter = new Interpreter((JConsole)getMainComponent()); new Thread(interpreter).start(); } }