How to display values in textfields obtained from another class

Hi,
Why, oh why, doesn't this work:
When I select a row in my tableClass (consist of a JTable) I want to display these values (strings) in my TextFieldGUI class (consist of just JTextFields). My code looks like this:
TableClass:
public void mouseClicked(java.awt.event.MouseEvent mouseEvent) {
    textFieldGUI = new TextFieldGUI() ;//reference to my textfield class
    gui = new mainGUI() ; //reference to my GUI class
    int tabbedIndex = gui.getSelectedIndex() ;
    int col = tableModel.getColumnCount() ;
    Vector string = new Vector() ;
    String empty = "" ;
    for(int index = 0; index < col ; index++){
        if(table.getValueAt(row, index) == null)
            string.addElement(empty) ;
        else
            string.addElement(table.getValueAt(row, index).toString()) ;
    if(tabbedIndex == 0){       
        System.out.println(string) ; //works fine
        textFieldGUI.setTextFieldValues(string) ;
}TextField class:
public void setTextFieldValues(Vector s){
    Vector string = new Vector() ;
    string = s ;
    System.out.println("TextFieldVector: " + string) ; //works fine as well
    String name = "" ;
    String dob = "" ;
    String web = "" ;
    name = string.elementAt(0).toString() ;       
    dob = string.elementAt(1).toString() ;       
    web = string.elementAt(2).toString() ;
    System.out.println("NAME: " + name +
                       ", BIRTH: " + dob +
                       ", WEB: " + web) ; //values are correctly printed
    txtName.setText(name) ; //writes nothing (empty)
    txtDob.setText(dob) ; //writes nothing (empty)
    txtWeb.setText(web) ; //writes nothing (empty)
}Anyone got a hint on how I should svolve this one?
thanks
gmtongar

Hi
my problem is, for each job_id there is many users. Oh that's something completlty different...
I Strongly Recommand to_
1.*create 2 tables Jobs & users*
2.*create a relation between them* 1 to many to get for each job more than a user that's the way that Must be -- execuse me the bad design of the db pulled u into this trap -
3.then u can deal with it normally no need to a sample code but just a form with Jobs as  (Master) and Users as (detail) with a relation and with a simple query u can display each job_id is for many users.
no null values no commas r needed.
Hope this helps...
Regards,
Amatu Allah.

Similar Messages

  • How to get  value on jsp file from ActionServlets class

    Hi All,
    I am facing problem in action servlets class into Struts, I am able to get the value on jsp file from action class with the help of session scope but i want to another method for it , so how i can solve the problem.Plz help me
    Thanks......... in advance

    I got a way out to access the attribute, i feel it is
    <jsp:usebean id="myRack" class="settings.Rack"/>
    <c:foreach var="book" item="myRack.books">
    </c:foreach>
    I am not able to check if this is correct or not because myRack.books is not having any value set by me in the request scope. How do i get instance of Rack class set by another page in the current request? I can get the value if i use scriptlet but i dont want to use scriptlet.
    I am continiously trying, if I get an answer, I shall post, else pls somebody guide.

  • Accessing display object on the stage from another class

    I've googled this to no avail, I've only found how to manipulate the stage itself and not a display object on it, and I'm noob enough to not be able to figure it out from there. :/
    I have a movie clip on the main timeline with instance name displayName. I created a button that should change what frame displayName goes to (in order to...did you guess it?! diplay the Name of the button. Awesome. )
    So I am trying to write the code in a reusable fashion and have the buttons all linked to a class called GeoPuzzle. Inside GeoPuzzle I instantiate a touch event and run the code. However, the function has to be able to change displayName in the main part of the timeline and, of course, the compiler says displayName doesn't exist because I'm in a class and I'm talking about the stage.
    Here is the simplified code in the class:
    package  com.freerangeeggheads.puzzleography {
        import flash.display.MovieClip;
        import flash.events.TouchEvent;
        public class GeoPuzzle extends MovieClip {
            //declare variables
            public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
                //set parameters
                this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
            public function GeoPuzzle (): void {
            public function geoTouchBeginHandler (e:TouchEvent): void {
                   e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
                   //some other methods
                   nameDisplay.gotoAndStop(e.target.abbrev);
            public function geoTouchEndHandler (e:TouchEvent): void {
                //some other methods
               nameDisplay.gotoAndStop("USA");
    The lines in bold are my problem. Now this code doesn't actually execute as is so if you see an error in it, yeah, I have no idea what the problem is, but it DID execute before and these lines still gave me trouble so I'm trying to troubleshoot on multiple fronts.
    How can I tell displayName to change it's current frame from within display object class?
    Thanks!

    if displayName is a GeoPuzzle instance, use:
    package  com.freerangeeggheads.puzzleography {
        import flash.display.MovieClip;
        import flash.events.TouchEvent;
        public class GeoPuzzle extends MovieClip {
            //declare variables
            public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
                //set parameters
                this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
            public function GeoPuzzle (): void {
            public function geoTouchBeginHandler (e:TouchEvent): void {
                   e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
                   //some other methods
                   this.gotoAndStop(this.abbrev);
            public function geoTouchEndHandler (e:TouchEvent): void {
                //some other methods
               this.gotoAndStop("USA");

  • How to get change a GUI component from another class?

    Hi there,
    I'm currently trying to change a GUI component in my 'Application' class from my 'Dice' class.
    So the Application class sets up some GUI including a JLabel that initially displays "Change".
    The 'Dice' class contains the ActionPerformed() method for when the 'Change' button (made from Application class) is clicked.
    And it returns an 'int' between 1 and 6.
    Now I want to set this number back int he JLabel from the Application class.
    APPLICATION CLASS
    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;
    import java.awt.event.*;
    public class Application extends JFrame implements ActionListener{
         public JPanel rollDicePanel = new JPanel();
         public JLabel dice = new JLabel("Loser");
         public Container contentPane = getContentPane();
         public JButton button = new JButton("Change");
         public Dice diceClass = new Dice();
         public Application() {}
         public static void main(String[] args)
              Application application = new Application();
              application.addGUIComponents();
         public void addGUIComponents()
              contentPane.setLayout(new BorderLayout());
              rollDicePanel.add(dice);
            button.addActionListener(diceClass);
            contentPane.add(rollDicePanel, BorderLayout.SOUTH);
            contentPane.add(button,BorderLayout.NORTH);
              this.setSize(460, 655);
              this.setVisible(true);
              this.setResizable(false);
         public void changeDice()
              dice.setText("Hello");
         public void actionPerformed(ActionEvent e) {}
    }DICE
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Dice implements ActionListener
         public Dice() {}
         public void actionPerformed(ActionEvent e)
              //super.actionPerformed(e);
              String event = e.getActionCommand();
              if(event.equals("Change"))
                   System.out.println("Will be about to change the 'dice' label");
                   Application application = new Application();
                   application.dice.setText("Hello");
    }

    It's all about references, baby. The Dice object needs a way to communicate with the Application object, and so Dice needs a reference to Application. There are many ways to pass this. In my example I pass the application object directly to Dice, but a better way would use interfaces and some indirection. Look up the Observer pattern for a better way to do this that scales much better than my brute-force approach.
    import javax.swing.*;
    import java.awt.*;
    public class Application extends JFrame // *** implements ActionListener
        // *** make all of these fields private ***
        private JPanel rollDicePanel = new JPanel();
        private JLabel dice = new JLabel("Loser");
        private Container contentPane = getContentPane();
        private JButton button = new JButton("Change");
        // *** pass a reference to your application ("this")
        // *** to your Dice object:
        private Dice diceClass = new Dice(this);
        public Application()
        public static void main(String[] args)
            Application application = new Application();
            application.addGUIComponents();
        public void addGUIComponents()
            contentPane.setLayout(new BorderLayout());
            rollDicePanel.add(dice);
            button.addActionListener(diceClass);
            contentPane.add(rollDicePanel, BorderLayout.SOUTH);
            contentPane.add(button, BorderLayout.NORTH);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setPreferredSize(new Dimension(460, 655));
            pack();
            setLocationRelativeTo(null);
            setVisible(true);
            setResizable(false);
        // *** I'm not sure what this is supposed to be doing, so I commented it out.
        //public void changeDice()
            //dice.setText("Hello");
        // *** ditto.  I strongly dislike making a GUI class implement ActionListeenr
        //public void actionPerformed(ActionEvent e)
        // *** here's the public method that the Dice object calls
        public void setTextDiceLabel(String text)
            dice.setText(text);
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Dice implements ActionListener
        // *** have a variable that holds a reference to your application object
        private Application application;
        private boolean hello = true;
        public Dice(Application application)
            // *** get that reference via a constructor parameter (one way to do this)
            this.application = application;
        public void actionPerformed(ActionEvent e)
            String event = e.getActionCommand();
            if (event.equals("Change"))
                System.out.println("Will be about to change the 'dice' label");
                if (hello)
                    // *** call the application's public method
                    application.setTextDiceLabel("Hello");
                else
                    application.setTextDiceLabel("Goodbye");
                hello = !hello;
                //Application application = new Application();
                //application.dice.setText("Hello");
    }

  • Getting a variable value from another class

    Is there any way to get the value of a variable from another class? I have a file that calls another that does some checking then gives a true or false. The place the checking is done is inside an ActionListener I want to use that value in the file that calls the second. Any help would be great.

    in 'another class', implement a method,
    public boolean isCheckedOutOK( Object obj )
    do the comparison in that method (use a suitable argument)

  • How To Display Value In inputText When List Is Used

    Hello,
    I have a question regarding how to display value from List in a jsf page?
    From a Map, i could display like
    <ice:inputText  id="plantno" value="#{bean.detailedRowData['plantno']}"So if I am using a List instead of Map, how can I refer value in List so that I could display my plantno?
    <ice:inputText  id="plantno" value="#{bean.?????}"Thanks

    Create a backing bean method that fetches the value from the list for you.
    <ice:inputText  id="plantno" value="#{bean.plantNo}"/>
    public class MyFunkyBean {
      private List<String> rowdata;
      public String getPlantNo(){
        return rowdata.get(INDEX_AT_WHICH_THE_PLANTNO_IS_STORED);
    }It really isn't possible to turn the list into a regular bean/entity?

  • How to display value in memory

    How to display value in memory, except call function 'LIST_FROM_MEMORY' .
    Thanks.

    Hi
    See this
    may be useful
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens
    SAP global memory retains field value through out session.
    set parameter id 'MAT' field v_matnr.
    get parameter id 'MAT' field v_matnr.
    They are stored in table TPARA.
    ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data
    to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.
    ABAP memory is temporary and values are retained in same LUW.
    export itab to memory id 'TEST'.
    import itab from memory Id 'TEST'.
    Here itab should be declared of same type and length.
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    ABAP Memmory & SAP Memmory
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Reward points for useful Answers
    Regards
    Anji

  • How to display values and new char line (blank line)

    Hi,
    In database, one field contains values followed by new character lines (blank lines) after blank lines there is no values. Finally, I would say the field contains values and blank lines. Every thing is fine in database.
    In Crystal Reports the field is displaying only values. Need to display values and blank line.
    User is asking after values new character lines (blank line) to be shown. They enter like that in an application. The user doubt is why report is not showing what they enter in the application.
    In detail explanation, front end tool is ASP.NET and backend is SQL Server.
    User enter some values in note field, after that they hit enter button in the same field, cursor will go next line...user may hit u2018enter buttonu2019 more than 5 times. So note field contain values and some blank lines which are created by after hitting enter button.
    If user opens the application, they could see values plus blank lines in the note field.
    They are fine with the application.
    In Crystal Reports, the note field shows only values.
    User is questioning that why we could not see in report we enter.
    I checked in .Net application and SQL server database it is fine. It is displaying values and blank line.
    Please help me out how to display values followed by blank lines in Crystal Reports - the way they enter in the application.
    Thanks and Regards,
    Manjunath N. Jogin

    Hi,
    Sharonmat,
    I tried as you suggested. It is still displaying only values.
    I would like to explain again.
    it is not exactly null values.
    In .Net application it is called 'new char line'.
    it shows those many lines look like null.
    it is working fine in database.
    Why it is not working in Crystal Reports? I am wondering...
    Thanks for your suggestion.
    Debi,
    User may enter any number of blank lines or they may not enter blank lines.
    That is the reason I can not always give more height or blank text object.
    Thanks for your suggestion.
    Please suggest me some more suggestions,
    Thanks and Regards,
    Manjunath N. Jogin

  • How can I assign image file name from Main() class

    I am trying to create library class which will be accessed and used by different applications (with different image files to be assigned). So, what image file to call should be determined by and in the Main class.
    Here is the Main class
    import org.me.lib.MyJNIWindowClass;
    public class Main {
    public Main() {
    public static void main(String[] args) {
    MyJNIWindowClass mw = new MyJNIWindowClass();
    mw.s = "clock.gif";
    And here is the library class
    package org.me.lib;
    public class MyJNIWindowClass {
    public String s;
    ImageIcon image = new ImageIcon("C:/Documents and Settings/Administrator/Desktop/" + s);
    public MyJNIWindowClass() {
    JLabel jl = new JLabel(image);
    JFrame jf = new JFrame();
    jf.add(jl);
    jf.setVisible(true);
    jf.pack();
    I do understand that when I am making reference from main() method to MyJNIWindowClass() s first initialized to null and that is why clock could not be seen but how can I assign image file name from Main() class for library class without creating reference to Main() from MyJNIWindowClass()? As I said, I want this library class being accessed from different applications (means different Main() classes).
    Thank you.

    Your problem is one of timing. Consider this simple example.
    public class Example {
        public String s;
        private String message = "Hello, " + s;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example();
            ex.s = "world";
            System.out.println(ex.toString());
    }When this code is executed, the following happens in order:
    1. new Example() is executed, causing an object to constructed. In particular:
    2. field s is given value null (since no value is explicitly assigned.
    3. field message is given value "Hello, null"
    4. Back in method main, field s is now given value "world", but that
    doesn't change message.
    5. Finally, "Hello, null" is output.
    The following fixes the above example:
    public class Example {
        private String message;
        public Example(String name) {
            message = "Hello, " + name;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example("world");
            System.out.println(ex.toString());
    }

  • Calling a TextFields get method from another class as a String

    This is my first post so be kind....
    I'm trying to create a login screen with Java Studio Creator. The Login.jsp has a Text Field for both the username and password. JSC automatically created get and set methods for these.
    public class Login extends AbstractPageBean
    private TextField usernameTF = new TextField();
    public TextField getUsernameTF() {
    return usernameTF;
    public void setUsernameTF(TextField tf) {
    this.usernameTF = tf;
    private PasswordField passwordTF = new PasswordField();
    public PasswordField getPasswordTF() {
    return passwordTF;
    public void setPasswordTF(PasswordField pf) {
    this.passwordTF = pf;
    My problem is in trying to call these methods from another class and return the value as a string.
    Any help on this matter would be greatly appreciated.

    the method returns the textfield, so you just need to get its text
    import java.awt.*;
    class Testing
      public Testing()
        Login login = new Login();
        System.out.println(login.getUsernameTF().getText());//<----
      public static void main(String[] args){new Testing();}
    class Login
    private TextField usernameTF = new TextField("Joe Blow");
    public TextField getUsernameTF() {
        return usernameTF;
    }

  • How to call main method in one class from another class

    Suppose i have a code like this
    class Demo
    public static void main(String args[])
    System.out.println("We are in First class");
    class Demo1
    public static void main(String args[])
    System.out.println("We are in second class");
    In the above program how to call main method in demo calss from Demo1 class......???????

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How do I unlink my Apple ID from another persons I tunes account? I keep getting their security questions and one of my emails can't be used

    How do I unlink my Apple ID from another persons I tunes account? I keep getting their security questions and one of my emails can't be used. It keeps telling me I its linked to another account but it shouldn't anymore. Plus my security questions belong to the other person and it has no reset option

    depend on the version of itunes and if it's OS X or windows i suppose
    in itunes on ny computer in the upper right corner left of the search bar there is a circle with a black siloet  and my name beside it
    if I click on the v beside it I can a menu with logout as an option

  • How can I make an audiobook purchased from another source show up in iTunes as an audiobook and not as music?

    How can I make an audiobook purchased from another source show up in iTunes as an audiobook and not as music?
    They chapters are mp3 files. Changing the genre to "audiobook" or "audiobooks" does help.
    I am sure this question will come up a lot, since the book in question is "Harry Potter and the Deathly Hallows," purchased from Pottermore.com.

    The one thing I would add to the instructions above is that the "Media Kind" menu is on the "Option" pane in the "Get Info" Window. This procedure has allowed me not only to make imported audiobooks show up as audiobooks, but imported podcasts show up as podcasts.

  • My ipod touch has a huge collection of music that I don't want to lose or replace but my computer has now crashed beyond recovery. How can I access my itunes account from another computer or transfer my playlists to another computer from my ipod?

    My ipod touch has a huge collection of music that I don't want to lose or replace but my computer has now crashed beyond recovery. How can I access my itunes account from another computer or transfer my playlists to another computer from my ipod?

    You can transfer iTunes purchases to your "new" computer by
    iTunes Store: Transferring purchases from your iPhone, iPad, or iPod to a computer
    You can transfer other stuff by:
    Best iPod to PC
    How to transfer or sync files from iPod to PC - Windows mac iPhone iPod software reviews - Software Wiki

  • How can i transfer a parchase movie from another iPad to my iPad

    How can i transfer a parchase movie from another iPad to my iPad

    Open the iTunes app. Tap the Purchased tab. Tap Movies.

Maybe you are looking for

  • TS3899 Mail going to wrong folder

    I have contact emails in my phone that are sending to my junk mail folder instead of my inbox.  One contact is even marked as VIP.  Can you help with this?

  • Problem with opacity on my Mac

    Hi there, I have some trouble with the opacity with my Mac. Since i bought it (january 2013), when I watch a video in full screen, in Quicktime or VLC, I saw in transparency the windows that I have in background (Safari, Mail or anything it's opened)

  • Error while loading data on to the cube : Incompatible rule file.

    Hi, I am trying to load data on to essbase cube from a data file. I have a rule file on the cube already, and I am getting the following error while loading the data. Is there any problem with the rules file? SEVERE: Cannot begin data load. Essbase E

  • Can't restore Windows 7 file backup in Windows 8.1

    Hi There, This seems to be quite a stupid issue to have but here we go...  before installing Windows 8.1 onto my laptop I took a backup of my user files using the Windows 7 backup tool which created me an array of zip files, with a catlog file and a

  • Mom does not see my iChat video, but I see her, and my wife can see mine

    When I iChat with Mom, I can see her, but she cannot see my iChat video. All she sees is herself as if she is still in iChat preview mode. Audio works fine. It is like a 1-way video chat with a 2-way audio chat, only we did not request this mode. Thi