Salve a tutti,
partendo dal presupposto che sono agli esordi con Java-_-, sto cercando di implementare un'interfaccia grafica utilizzando i tab in modo che in ogni pagina mi vengano visualizzate cose diverse(nel primo JButton e JLabel, nel secondo principalmente JLabel, nel terzo testo). Invece di creare un'unico file che sarebbe anche "scomodo" da vedersi data la lunghezza vorrei creare 4 file java: 3 per le pagine e uno principale dal quale richiamo le altre(quindi avrò nei 3 file le 3 pagine già belle pronte e solo da aggiungere all'interfaccia finale).

io sono partito utilizzando come base questo codice, ma quando lo vado a dividere poi nn riesco a richiamare dal file principale le 3 classi che compongono le 3 pagine:

import java.awt.*;
import javax.swing.*;

class TabbedPaneExample
extends JFrame
{
private JTabbedPane tabbedPane;
private JPanel panel1;
private JPanel panel2;
private JPanel panel3;

public TabbedPaneExample()
{
// NOTE: to reduce the amount of code in this example, it uses
// panels with a NULL layout. This is NOT suitable for
// production code since it may not display correctly for
// a look-and-feel.

setTitle( "Tabbed Pane Application" );
setSize( 300, 200 );
setBackground( Color.gray );

JPanel topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );

// Create the tab pages
createPage1();
createPage2();
createPage3();

// Create a tabbed pane
tabbedPane = new JTabbedPane();
tabbedPane.addTab( "Page 1", panel1 );
tabbedPane.addTab( "Page 2", panel2 );
tabbedPane.addTab( "Page 3", panel3 );
topPanel.add( tabbedPane, BorderLayout.CENTER );
}

public void createPage1()
{
panel1 = new JPanel();
panel1.setLayout( null );

JLabel label1 = new JLabel( "Username:" );
label1.setBounds( 10, 15, 150, 20 );
panel1.add( label1 );

JTextField field = new JTextField();
field.setBounds( 10, 35, 150, 20 );
panel1.add( field );

JLabel label2 = new JLabel( "Password:" );
label2.setBounds( 10, 60, 150, 20 );
panel1.add( label2 );

JPasswordField fieldPass = new JPasswordField();
fieldPass.setBounds( 10, 80, 150, 20 );
panel1.add( fieldPass );
}

public void createPage2()
{
panel2 = new JPanel();
panel2.setLayout( new BorderLayout() );

panel2.add( new JButton( "North" ), BorderLayout.NORTH );
panel2.add( new JButton( "South" ), BorderLayout.SOUTH );
panel2.add( new JButton( "East" ), BorderLayout.EAST );
panel2.add( new JButton( "West" ), BorderLayout.WEST );
panel2.add( new JButton( "Center" ), BorderLayout.CENTER );
}

public void createPage3()
{
panel3 = new JPanel();
panel3.setLayout( new GridLayout( 3, 2 ) );

panel3.add( new JLabel( "Field 1:" ) );
panel3.add( new TextArea() );
panel3.add( new JLabel( "Field 2:" ) );
panel3.add( new TextArea() );
panel3.add( new JLabel( "Field 3:" ) );
panel3.add( new TextArea() );
}

// Main method to get things started
public static void main( String args[] )
{
// Create an instance of the test application
TabbedPaneExample mainFrame = new TabbedPaneExample();
mainFrame.setVisible( true );
}

}

Avete qualche suggerimento?
p.s. spero di essermi spiegato bene...