also erstens ich kenne die Konvention 
zweitens die Code-Schnipsel sind nur Beispiele, in dem Fall waren es statische Methodenaufrufe.
OK, back to topic
Die Methode revalidate() gibt es nicht bei einen JPanel, JFrame
ich poste mal das JFrame mit der JScrollPane+JPanel und eines der externen Zugriffe
package archVerSys.bestellsystem.client.gui;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
public class MyFrame extends JFrame
{
private String securityToken;
private String lookAndFeel;
private MyMenu myMenu;
private JPanel contentPanel;
private JScrollPane scrollPane;
public MyFrame()
{
//this.setLookAndFeel(„com.jgoodies.looks.plastic.PlasticLookAndFeel“);
this.securityToken = „“;
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle(„O F F L I N E M O D U S“);
this.setPreferredSize(new java.awt.Dimension(500, 500));
this.getContentPane().setLayout(new BorderLayout());
this.setName(„myFrame“);
this.setResizable(true);
}
public void start()
{
contentPanel = new JPanel();
contentPanel.setName(„contentPanel“);
contentPanel.setLayout( new GridBagLayout());
myMenu = new MyMenu(this);
this.setJMenuBar(myMenu);
scrollPane = new JScrollPane(contentPanel);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
this.getContentPane().add(scrollPane, BorderLayout.NORTH);
this.pack();
this.setVisible(true);
}
public String getSecurityToken()
{
return securityToken;
}
public void setSecurityToken(String securityToken)
{
this.securityToken = securityToken;
}
public String getLookAndFeel()
{
return lookAndFeel;
}
public void setLookAndFeel(String lookAndFeel)
{
this.lookAndFeel = lookAndFeel;
try
{
javax.swing.UIManager.setLookAndFeel(this.lookAndFeel);
}
catch(Exception error)
{
error.printStackTrace();
}
}
public JPanel getContentPanel()
{
return contentPanel;
}
public void setContentPanel(JPanel contentPanel)
{
this.contentPanel = contentPanel;
}
public JScrollPane getScrollPane()
{
return scrollPane;
}
public void setScrollPane(JScrollPane scrollPane)
{
this.scrollPane = scrollPane;
}
}
externer Zugriff
package archVerSys.bestellsystem.client.gui.actions;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.rmi.AccessException;
import java.rmi.RemoteException;
import java.util.Iterator;
import javax.swing.JOptionPane;
import archVerSys.bestellsystem.client.ServerConnector;
import archVerSys.bestellsystem.client.gui.MyFrame;
import archVerSys.bestellsystem.client.gui.OrderPanel;
import archVerSys.bestellsystem.server.Server;
import archVerSys.bestellsystem.server.basis.Order;
import archVerSys.bestellsystem.server.basis.OrderPosition;
/**
* this adapter receives the action of „view all orders“
* @author Daniel Nitschke
* @version 1.1, build-system: Windows XP, Eclipse WTP3, SUN Java 1.6.0
* @since 19.05.2009
*/
public class ViewAllOrder implements ActionListener
{
/**
* the reference of MyFrame
*/
private MyFrame myFrame;
/**
* the default constructor
*/
public ViewAllOrder()
{
;
}
/**
* the constructor with parameter
* @param myFrame the reference of MyFrame
*/
public ViewAllOrder(MyFrame myFrame)
{
this.myFrame = myFrame;
}
/**
* this method perform the event
* @param event the event
*/
@SuppressWarnings(„deprecation“)
public void actionPerformed(ActionEvent event)
{
if(this.myFrame == null)
{
//for alternatively processing without MyFrame
}
else
{
try
{
Server server = ServerConnector.getServerConnection();
Order[] order = server.getAllOrders(this.myFrame.getSecurityToken());
GridBagLayout thisLayout = new GridBagLayout();
GridBagConstraints constr = new GridBagConstraints();
constr.anchor = GridBagConstraints.NORTHWEST;
constr.gridx = 0;
this.myFrame.getContentPanel().removeAll();
this.myFrame.getContentPanel().setLayout(thisLayout);
for(int i = 0; i iterator = order[i].getOrderPostions();
while(iterator.hasNext())
{
orderPanel.getOrderPositionsPanel().getTableModel().addRow(iterator.next());
}
orderPanel.setPanelStyle(„view“);
constr.gridy = i;
this.myFrame.getContentPanel().add(orderPanel, constr);
}
this.myFrame.pack();
}
catch (AccessException error)
{
System.err.println(„AccessException-ERROR in ViewAllOrder.actionPerformed()“);
System.err.println(error.getCause());
System.err.println(error.getMessage());
this.myFrame.setTitle(„O F F L I N E M O D U S“);
JOptionPane.showMessageDialog(this.myFrame, „Es ist ein Fehler aufgetreten\n(“+error.getCause()+")", „E R R O R“, JOptionPane.ERROR_MESSAGE);
this.myFrame.repaint();
//error.printStackTrace();
}
catch (RemoteException error)
{
System.err.println(„RemoteException-ERROR in ViewAllOrder.actionPerformed()“);
System.err.println(error.getCause());
System.err.println(error.getMessage());
this.myFrame.setTitle(„O F F L I N E M O D U S“);
JOptionPane.showMessageDialog(this.myFrame, „Es ist ein Fehler aufgetreten\n(“+error.getCause()+")", „E R R O R“, JOptionPane.ERROR_MESSAGE);
this.myFrame.repaint();
//error.printStackTrace();
}
}
}
}