// Main Classpublic class Main extends javax.swing.JFrame { /** Creates new form Main */ public Main() { initComponents(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Main myframe = new Main(); myframe.setVisible(true); Foo changeit = new Foo(); changeit.ChangeMainLabel("bla"); } }); }}//Foo Classpublic class Foo { /** Creates a new instance of Foo */ public Foo() { } public void ChangeMainLabel(String somestring) { // myframe.jLabel1.setText("Ole!") }