2
How can I add a Jtabbedpane of one class to a jPanel of another class? Possible?
In the 'Confempresa' class I created a container and added Jtabbedpane which is called 'jTabConfEmpresa'.
public class ConfEmpresa extends javax.swing.JFrame {
public static Container ct;
public ConfEmpresa() throws SQLException {
ct.add(jTabConfEmpresa);
}
Now in the class 'Settings' I want to show this 'jTabConfEmpresa' through a one button action:
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
jPanelPrincipal.add(ConfEmpresa.ct.getComponent(0));
jPanelPrincipal.setVisible(true);
}
When I press the button to show this Jtabbedpane gives the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Could you elaborate more on your question? In the same Jframe or when you go from one jframe to another? and post some code also helps...
– jsantos1991
I have a jTabbedPane created in a 'Confempresa' class frame. Now I would like to click a button already created in the frame of the class 'Configurations' to show me the jTabbedPane of the class 'Confempresa', in a jPanel of the class 'Configuracoes'. I was explicit? jPanelPrincipal.add(Confempresa.jTabConfEmpresa);
– Hugo Machado
Hugo, please prefer [Edit] the question to add details and format code properly. Check the [Ask] guide to reverse these negative votes.
– brasofilo
I’ve already edited the question, see if it’s more explicit what I want. I’m sorry but I’m new to these errands.
– Hugo Machado