1 Reply Latest reply: May 2, 2014 3:47 AM by gimbal2 RSS

    JTabbedPane and one Button for all Tabs

    NicoDeluxe

      Hello everybody,

       

      im new here an would say HELLOOO to everyone

       

      So ive got an issue.

       

      I am creating in "class A"  tabs for a JTabbedPane. In "class B" i create the JTabbedPane and creat instances of class A and add them to the TabbedPane.

       

      in Class B i also create a button, for save actions. When i click the button, a method "save()" will be called and read from every tab the Strings out of textfields.

       

      My problem now is, that it dont work, i call the save method with the instance from the tab, but it dont getText() from the textfield.

       

      For example:

       

      //create an instance tab, parameter is the save file

      Tab myTab = new Tab(file);

       

           //other code

       

      (Tab)myTab.save(); //here i eclipse cast to Tab automatically

       

      the save-Method in class A (Tab):

       

      save() {

      sysout(texfield1.getText)

      }

       

       

      BTW how can i highlight code in this forum?