Results 1 to 3 of 3
  1. #1
    sujay is offline Member
    Join Date
    Jul 2011
    Location
    Bangalore
    Posts
    1
    Rep Power
    0

    Default How can i pass the data from one JPanel to other...?

    I have a jframe which contains 3 jpanel. I want to pass the Jtextfield value of one panel to other. Each panel is shown using JTabbedPane. I am getting null when i access the value of other text field.



    pacage Demotool;

    Class:MainFrame

    This is the actionPerformed code of first panel

    both str and scrTxt is (public static)

    public void actionPerformed(ActionEvent e)
    {
    String act=e.getActionCommand();

    if(act.equals("ADD"))
    {
    str=scrnTxt.getText();
    System.out.println("Hi :"+str);
    Demotool.DemoTool.jtp.setSelectedIndex(1);
    }
    }


    pacage Demotool;


    class name:DetailForm
    I imported the class

    import Demotool.MainFrame.*;

    using the belove code i tried to access the data:

    System.out.println("Hello:"+Demotool.MainFrame.str );


    but i am getting null string;

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,196
    Rep Power
    19

    Default

    sujay -- next time, don't hijack an old thread. Get your own --they're free!

    db

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Adding a jpanel to a customized Jpanel Class
    By trishtren in forum AWT / Swing
    Replies: 7
    Last Post: 04-05-2011, 06:52 PM
  2. Replies: 7
    Last Post: 02-11-2011, 06:38 AM
  3. Replies: 1
    Last Post: 11-09-2010, 09:28 AM
  4. how to pass data
    By rakesh_mca in forum Java Servlet
    Replies: 7
    Last Post: 10-25-2009, 01:13 PM
  5. Struts: pass data to other form
    By sgoyal in forum Advanced Java
    Replies: 1
    Last Post: 10-01-2009, 05:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •