Capturing the text of a textfield to be used in another class

Hi Java Gurus. I have two classes called Login and Profile. In the Login class, a user will enter a username and password which is verified against a table stored in an oracle database. This works fine.
My problem is that when the user enters his/her username, I want to capture the username of the user so that I can make a reference to it from the Profile class.
You may wonder why I am doing this from the Profile class. Well, I want the user's profile to be uploaded after login and in order for me to do this, I am using the username in my SELECT statement from my Profile class to upload the profile of a specific user.
Thanks a lot in advance!

Hi guys! Maybe none of you who have already viewed my problem understood what i meant, so i'll try to explain using some code snippets.
Login class;
public class Login extends JDialog implements ActionListener{
JLabel nameLabel;
JLabel passLabel;
JTextField name;
JTextField pass;
JButton okButton;
JButton cancelButton;
JPanel buttonPanel;
public Login(){
nameLabel = new JLabel("Username:");
passLabel = new JLabel("Password:");
name = new JTextField(10);
pass = new JTextField(10);
okButton = new JButton("Ok");
cancelButton = new JButton("Cancel");
buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
setSize(new Dimension(100,200));
setLayout(new GridLayout(1,5));
add(nameLabel);
//Add remaining components here and display dialog
public void connect(){
//connect to database here
public void ActonPerformed(ActionEvent evt){
//do events here
}Profile class;
public class Profile extends JPanel{
JLabel fnameLabel,lnameLabel,dobLabel;
JTextField fnameText,lnameText,dobText;
Login login;
public Profile(){
//initialize variables here
public void connect(){
//connect to database here
public void getProfile() {
String uname = login.name.getText();
          String fname = "";
          String lname = "";
          String dob = "";
          Statement stmt = null;
          connect();
          try {
          stmt = conn.createStatement();
          ResultSet result = stmt.executeQuery("SELECT Firstname,Lastname,DOB FROM Profile WHERE User_id ='"+uname+'" ");
               if (result.next()) {
                    fname = result.getString("Firstname");
                    lname = result.getString("Lastname");
                    dob = result.getString("DOB");
                                        if ((fname.length() != 0) && (lname.length() != 0)) {
                         fnameText.setText(fname);          lnameText.setText(lname);               dobText.setText(dob);                    validate();
     repaint();
          } catch (Exception ex) {
               System.out.println(ex);
               //JOptionPane.showMessageDialog(null, "Please enter your username\n
               // and password", "Logon error", JOptionPane.INFORMATION_MESSAGE);
}So please i need your help.....

Similar Messages

  • Capture the TEXT of textview

    Hi Experts,
    In my WebDynpro application I have a text view I am creating it dynamically and passing the text while creating, I wnat to delete the textview once press the delete button.. I have the text view ID so how can I capture the text of Text view with using Text view ID . Please suggest me how do I cpture the Text of text view using the ID of that
    Thanks,
    Anil

    Hello Anil,
    Using the method CL_WD_TEXT_VIEW->GET_TEXT you can get the text that you have set dynamically.
    for your requirement do the following
    1. from the IF_WD_VIEW object, call the GET_ELEMENT method get the text view element object
    2. then call the get_text method of the text view element to get the text that was set by you.
    BR, Saravanan

  • Cannot drop the table because it does not exist in the system catalog. Transaction context in use by another session

    Hi Every one,
    An error has occurred during report processing. (rsProcessingAborted)
    Get Online Help
    Query execution failed for data set 'NonFinTran'. (rsErrorExecutingCommand)
    Get Online Help
    Cannot drop the table '#NonFinTran', because it does not exist in the system catalog. Cannot drop the table '#MultipleNonFinTran',
    because it does not exist in the system catalog. Transaction context in use by another session.
    NOTE: NonFinTran &
    MultipleNonFinTran are
    the Temp table in my storedPoc.
    Please any help me to solve this issue. 
    Thanks & Regards,
    Anil Kumar
    Anil Kumar

    Hi Harsh,
     Below is my Stored Proc
    SELECT @ServerName=datasource from master.dbo.sysservers WHERE catalog='Voyager'    
     SELECT @ServerName3=datasource from master.dbo.sysservers WHERE catalog='AuditLog'    
     SELECT @ServerName2=datasource from master.dbo.sysservers WHERE catalog='Portal'    
     IF @ServerName IS NOT NULL SET @ServerName='[' + @ServerName + '].' ELSE SET @ServerName=''    
     IF @ServerName3 IS NOT NULL SET @ServerName3='[' + @ServerName3 + '].' ELSE SET @ServerName3=''    
     IF @ServerName2 IS NOT NULL SET @ServerName2='[' + @ServerName2 + '].' ELSE SET @ServerName2=''    
     IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#NonFinTran%')     
      DROP TABLE #NonFinTran    
     IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#MultipleNonFinTran%')     
      DROP TABLE #MultipleNonFinTran    
     CREATE TABLE #NonFinTran (FirstName VARCHAR(40), TaxId VARCHAR(40), TrxID VARCHAR(40), Status VARCHAR(255), Field1 VARCHAR(255), Field2 VARCHAR(255),    
       Field3 VARCHAR(255), Field4 VARCHAR(255), Field5 VARCHAR(255), Field6 VARCHAR(255), DateTime DATETIME,     
       BranchID CHAR(3), BankID CHAR(1), FromAccountID VARCHAR(255), FromAccountType VARCHAR(255))    
     CREATE TABLE #MultipleNonFinTran (FirstName VARCHAR(40), TaxId VARCHAR(40), TrxID VARCHAR(40), Status VARCHAR(255), Field1 VARCHAR(255), Field2 VARCHAR(255),    
       Field3 VARCHAR(255), Field4 VARCHAR(255), Field5 VARCHAR(255), Field6 VARCHAR(255), DateTime DATETIME,     
       BranchID CHAR(3), BankID CHAR(1), FromAccountID VARCHAR(255), FromAccountType VARCHAR(255))     
    INSERT #NonFinTran    
     EXEC('SELECT FirstName, TaxID,     
      TrxID, Status, TrxField1, TrxField2, TrxField3, TrxField4, TrxField5, TrxField6, DateTime, '''', '''', '''', ''''    
     FROM ' + @ServerName3 + 'AuditLog.dbo.CCAuditLogEntryView AS Audit, ' + @ServerName + 'Voyager.dbo.CCUser AS CCUser    
     WHERE CCUser.UserID = Audit.UserID     
      AND Audit.Succeeded = 1     
      AND Audit.TrxID IN (''ChangeBillPayDefaultAccountEdit'',''ChangeExpiryUserPassword'',''ChangePasswordEdit'',    
       ''ChangeUserPassword'',''ManageAddressMaint'',''ManageContactMaint'',''ManageSecretQuestionAnswerEdit'',    
       ''ManageTransLimitMaint'',''OtherBankAccountMaintAdd'',''OtherBankAccountMaintDelete'',''OtherBankAccountMaintEdit'',    
       ''WithinAmBankAccountMaintAdd'',''WithinAmBankAccountMaintDelete'',''WithinAmBankAccountMaintEdit'',    
       ''SetAccountMaskPreferenceAudit'',''ChangeLoginIdAudit'')     
      AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @StartDate + '''), 103), Audit.DateTime) >= 0     
      AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @EndDate + '''), 103), Audit.DateTime) <= 0 ')    
     INSERT #MultipleNonFinTran    
     EXEC('SELECT DISTINCT FirstName, TaxID,     
      TrxID, Status, TrxField1, TrxField2, TrxField3, TrxField4, TrxField5, TrxField6, Audit.DateTime as AuditDateTime,    
    (SELECT DISTINCT SUBSTRING(A.BranchCode,3,3)  FROM ' + @ServerName + 'AuditLog.dbo.CCAuditLogEntryView X INNER JOIN ' + @ServerName + 'Voyager.dbo.CCuser U
    ON X.UserId = U.UserId INNER JOIN ' + @ServerName + 'Voyager.dbo.AMHZ_CustomerProfile P ON P.EnrolId = U.TAXID 
    INNER JOIN ' + @ServerName + 'Voyager.dbo.AMHZ_AccountListing A ON A.CIFNO = P.CIFNO
    WHERE X.UserId = Audit.UserId AND A.AccountNo = SUBSTRING(Audit.TrxField1,11,16) AND P.CIFNO = A.CIFNO
    AND (SUBSTRING(A.BranchCode,3,3) <> NULL OR SUBSTRING(A.BranchCode,3,3) <> '''')
    AND CHARINDEX(''AccountID='', Audit.TrxField1, 1) > 0),
      SUBSTRING(TrxField1,14,1), CASE WHEN CHARINDEX(''AccountID='', TrxField1, 1) > 0 THEN     
      SUBSTRING(TrxField1,11,16) ELSE '''' END, CASE WHEN CHARINDEX(''AccountType='', TrxField2, 1) > 0 THEN SUBSTRING(TrxField2,13,3) ELSE '''' END    
     FROM ' + @ServerName3 + 'AuditLog.dbo.CCAuditLogEntryView AS Audit, ' + @ServerName + 'Voyager.dbo.CCUser AS CCUser    
     WHERE CCUser.UserID = Audit.UserID     
      AND Audit.Succeeded = 1     
      AND Audit.TrxID IN (''SetAccountAttributesAudit'',''SetAccountFriendlyNameAudit'',    
      ''AccountProfileMaintULDelete'',''AccountProfileMaintLHAAdd'',''AccountProfileMaintLSCAdd'')
      AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @StartDate + '''), 103), Audit.DateTime) >= 0     
      AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @EndDate + '''), 103), Audit.DateTime) <= 0 ')  
      SET @stmt = '    
     SELECT * FROM    
     SELECT BranchName,
     CASE WHEN SUBSTRING(FromAccountID,1,6) IN (''519901'',''559409'')  THEN ''DC''  
    ELSE       
     CASE FromAccountType WHEN ''01'' THEN ''SA '' WHEN ''02'' THEN ''CA '' WHEN ''03'' THEN ''FD ''     
        WHEN ''SA'' THEN ''SA '' WHEN ''CA'' THEN ''CA '' WHEN ''FD'' THEN ''FD '' ELSE FromAccountType + '' ''    
     END 
     END +     
    case when Len(FromAccountID) =16 Then  
       CASE FromAccountType WHEN ''VC'' THEN   
       SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,4)      
    WHEN ''MC'' THEN SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,4)  END  
         when Len(FromAccountID) =15 Then 
    CASE FromAccountType WHEN ''VC'' THEN   
       SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,3)      
    WHEN ''MC'' THEN SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,3)  END  
         ELSE FromAccountID   
    ENd  
     AS FromAcctNo,    
     CASE TrxId  
     WHEN ''AccountProfileMaintLHAAdd'' THEN ''Link Account/Card''    
     WHEN ''AccountProfileMaintLSCAdd'' THEN ''Link Account/Card''    
     WHEN ''APMFamilyFirstAdd'' THEN ''Link Family First Account''    
     WHEN ''AccountProfileMaintULDelete'' THEN ''Unlink Account/Card''    
     WHEN ''BalInqFD'' THEN CASE  WHEN Field3 IN (''APMLink=SUCCESS'') THEN ''APMLink Success'' ELSE ''Fixed Deposit Balance Inquiry'' END  
     WHEN ''BalInqCASA'' THEN CASE  WHEN Field3 IN (''APMLink=SUCCESS'') THEN ''APMLink Success'' ELSE
         CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Balance Inquiry'' 
        ELSE ''Current Account Balance Inquiry'' 
       END 
      END    
     WHEN ''StopCheck'' THEN ''Stop Cheque Request''    
     WHEN ''CheckReorder'' THEN ''Order Your Cheque''    
     WHEN ''CheckInquiry'' THEN ''Cheque Inquiry''    
     WHEN ''TransHistFD'' THEN ''Fixed Deposit Transaction History''    
     WHEN ''TransHistCASA'' THEN    
      CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Transaction History'' ELSE ''Current Account Transaction History'' END    
     WHEN ''StmtInqCC'' THEN    
      CASE WHEN FromAccountType IN (''DR'',''03'') THEN ''Debit Card Statement Inquiry'' ELSE ''Credit Card Statement Inquiry'' END    
     WHEN ''StmtInqDA'' THEN    
      CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Statement Inquiry'' ELSE ''Current Account Statement Inquiry'' END    
     WHEN ''StmtReq'' THEN ''Printed Statement Request''    
     WHEN ''StmtInqIAMSTAR'' THEN ''E-AMSTAR Statement Inquiry''    
     WHEN ''Repayment/Transfer Inquiry'' THEN ''Repayment/Transfer Inquiry''    
     WHEN ''Account Inquiry'' THEN ''Account Inquiry''    
     WHEN ''Payment Inquiry'' THEN ''Payment Inquiry''    
     END AS TransType,    
     FirstName AS CustomerName,    
     TaxId, CONVERT(VARCHAR, DateTime, 103) AS Date, CONVERT(VARCHAR, DateTime, 108) AS Time    
     FROM #NonFinTran, ' + @ServerName3 + 'Portal.dbo.TB_Branch AS TB_Branch    
     WHERE     
     BranchId = TB_Branch.BranchCode     
     AND (TB_Branch.InstCode IN (''00001'', ''00003'',''001'',''002''))    
     AND (FromAccountType IN (''SA'', ''CA'', ''FD'', ''01'', ''02'', ''03'')))'    
    EXEC (@stmt)
    IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#NonFinTran%')     
     DROP TABLE #NonFinTran    
     IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#MultipleNonFinTran%')     
      DROP TABLE #MultipleNonFinTran    
    Anil Kumar

  • Have been unable to empty trash for the last 24hours, says it is being used by another task, how do I clear it. Thanks for any help.

    Have been unable to empty trash for the last 24hours, says it is being used by another task, how do I clear it. Thanks for any help.

    Generally when you get the resource in use error logging out or rebooting will take care of it. When a file just absolutely refuses to delete try restarting in Safe Mode (hold the left shift key after the computer restarts) and then empty the trash.

  • Why the Text disappears when I rotate it using Free Transform Tool?

    Hi,
    My Text is visible before rotating it to verticle position using Free Transform Tool. But when once it is rotated to verticle position the text disappears from the Stage. And it is not an animated Text as well? What is the problem?
    Thanks.

    If the textfield is manually placed on the stage, you should be able to select the textfield and click the button for Embedding that is in the Properties panel.

  • Outside of zoom, is there a way to make the text under icons larger for elderly use of iPad?

    We gave my mom an ipad mini, but the text under the icons is barely readable for the elderly.  The accessibility options increase the size of contacts, email, etc, and the zoom gives an option to increase, but that is not user friendly for the elderly - 3 finger tap on/off??? Really????  For a senior with arthritis?
    Does anyone know a way to increase the size of the text of the icons on the ipad? 
    Thanks for any insights.

    Try After Effects, it's perfect for keying stroke and all text characteristics.
    Here's an example

  • How to change the text color of a label by using RGB values without changing the background colour?

    xCode interface builder:
    When I try to change the color property of a label's text by using the RGB values, the background color also changes to the same value automatically.
    in other words:
    While setting the RGB values for text colour of labels, the background colour also changes unless we use the sliders.
    How to make sure that only the color of text changes and not the background?

    You can simply do this.
        [labelname setTextColor:[UIColor colorWithRed:38/255.0f green:171/255.0f blue:226/255.0f alpha:1.0f]];

  • I'm trying to set the value of a textfield to a instance of another textfield in a repeating subform

    Hello all,
    I am trying set the value of a textfield in a repeating subform/table row to another textfield in a repeating subform with the corrosponding instance number.
    The user enters a list of Key Activities in the first part: -- KeyActivityRow is the repeating subform --
    xfa.resolveNode("form1.#subform.KeyActivities.Row1.Table2.KeyActivityRow.Cell2")
    -- KeyActivityRow is the repeating subform --
    Which then Populates the corresponding occurence of:  --
    xfa.resolveNode("form1.#subform.ActivityTable.HeaderRow.Table1.HeaderRow.Cell1")
    -- ActivityTable is the repeating subform --
    Kevin

    In the calculate event of form1.#subform.ActivityTable.HeaderRow.Table1.HeaderR ow.Cell1 enter this script in Language:JavaScript :
    this.rawValue=xfa.resolveNode("form1.#subform.KeyActivities.Row1.Table2.KeyActivityRow["+A ctivityTable.index+"].Cell2").rawValue
    Kyle

  • How to find the text id & object name to be used with read_text  ?

    Hi All
    how to determine the text id & object name associated with PO to be used with FM read_text  ?
    Regards
    Jaman

    Hi,
    For PO there will be Header Texts and Item texts.
    For header texts just Take the PO number as TDNAME.
    for Item texts Conactenate the PO number and Item Number and use as TDNAME.
    in ME23N Go to any text.Double click on it
    It will take you to text editor.
    GOTO-> header
    it will display the TEXT  ID,TEXTNAME,LANG  and TEXT OBJECT etc
    Similarly for every  text you will find and use;
    Regards,
    Anji

  • I just bot a new ipodnano and synched my playlists from my itunes library.  However, I am unable to disconnect as it says the the ipodnano contains files that are in use by "another application".  What is it talking about and how do I disconnect?

    How do I disconnect./eject my new ipodnano after I had synched my playlists (from itunes library on my computer).
    Itunes message - CANNOT BE EJECTED BECAUSE IT CONTAINS FILES THAT ARE IN USE BY ANOTHER APPLICATION:.
    This is after my synch was succesfull and it says I can disconnect now - but it won't let me.
    Keith

    For the immediately problem, you can shut down the computer and disconnect the iPod.
    There may be a process (program) running on your computer in the background that continuously monitors mounted volumes for things like maintenance, data corruption, and malware.  The iPod's storage is a mounted volume.  If you know of any such program, such as an "anti-virus" utility, and it has settings that allow you to exclude certain volumes, you can set it to ignore the iPod "disk" when connected.
    Also, if you are using automatic syncing (not the manual method) to load the iPod, and you have Enable disk use turned ON, turn it OFF.  With Enable disk use turned OFF, iTunes only mounts the iPods disk when syncing, then immediately unmounts the disk.  Thus, other processes you have running on your PC (not iTunes) will have less of a chance to make the disk "in use" and cause this problem.  You won't even have to eject the iPod before disconnecting.

  • Can i use the same datasource which is already been used for another appln?

    Hi All,
    There is a datasource from r/3 copa which is already been used in another application. Is it possible for me to use the same data source to my Appln?
    If so then pls guide me on that?
    Thanks
    pooja

    Yes you can use it..
    It depends actually on your requirement..
    If you are already pulling that data into a DSO, then directly use that DSO in your applicaiton by doing a look up or by getting data from it...This will avoid duplication of data...
    But if your requirement is not suffice with the DSO you already have then create your own custom and pull the data from the same datasource into it...

  • The scanner is not available while in use by another application?

    i have canon lide 100..whn i scan..its shows mgs the scaner is not available while use in another aplication..plz help me

    Hi carenson,
    To isolate the issue you describe, please follow these instructions to put your computer in a Selective Startup:
     1.  Press the Windows key on the keyboard and then press R.
     2.  In the Open box of the Run window, type msconfig and and then click OK.
     3.  In the General tab of the System Configuration Utility window, click on the Selective Startup radio button.
     4.  Remove the check in the Load Startup Items box.
     5.  Click the Services tab.
     6.  At the bottom of the Services tab, click Hide all Microsoft Services box.  The window will refresh.
     7.  Under Service column, uncheck each box that is left in this tab.
     8.  Click Apply and then Close.
     9.  Click Restart.
    10.  Proceed to use your scanner to see if the issue you described has been corrected.
    11.  After using your scanner, repeat steps 1 and 2, click Normal Startup and then restart your computer.
    Are you able to use the scanner while in selective startup?
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Capture the text in ALV grid output

    Hi Friends,
    I have created a alv grid report, in that i have to edit one field by using EDIT, i am editign that field.
    Since i am working on interactive alv ( if user keeps the cursor on that row and he presses the push button) i want to capture that entered text in interactive alv.
    Can any one help me
    Regards,
    DVNS

    Hi,
    Please refer to SAP standard demo program BCALV_TEST_GRID_EDITABLE.
    Thanks,
    Sriram Ponna.

  • How to read the TEXT TABLES (Or) .CSV in HSQLDB using JAVA

    Hi,
    I want to use the HSQLDB instead of mdb in our application. I am using the HSQLDB Engine Standalone mode, and given a file name "TEMP" in URL along with the "jdbc:hsqldb:file:". Then a I created a TEXT TABLE, that table was created as a .CSV file in the Disk. But I am unable to read that CSV, I tried that file in the database URL. But its not working. Can anubody give me the suggestions.
    Thankyou,
    Regards,
    Vinay.

    Hi Rajeshreddy.k,
    To add multiple users to one group, I wouldn't use a .csv file since the only value you need from a list is the users to be added.
    To start create a list of users that should be added to the group, import this list in a variable called $users, the group distinguishedName in a variable called $Group and simply call the ActiveDirectory cmdlet Add-GroupMember.
    $Users = Get-Content -Path 'C:\ListOfUsernames.txt'
    $Group = 'CN=MyGroup,OU=MyOrg,DC=domain,DC=lcl'
    Add-ADGroupMember -Identity $Group -Members $Users

  • Why is the text message telling me I have used all the data in my plan when I still appear to have 3gb left?

    I keep getting a message that I have "used 100% of the data in my prorated plan."  However, when I check I still have over 3 GB left in my regular plan, but the full promotional 1GB is used up.  I hope that the promotional data is not just a way to give me an overage charge.  

    The txt indicates that you have prorated data - suggesting that you made some type of change mid-cycle - resulting in you only have a percentage of your data available for the remainder of your bill cycle. For example, if you make a change 3 wks into your 4 wk cycle you then have 25% of your data available for the remaining 1 wk. If that 25% is 500MB and you USE 501+MB during that 1 wk - you have then used 100% of the prorated (25%) data.

Maybe you are looking for

  • (PPro CS4/Windows) AVCHD to DVCPRO HD Converter

    I just recently won a Sony HDR-PJ270, which shoots AVCHD 1080 60i (30 frames per second, 60 fields)/60p (60 progressive frames per minute --- twice the frame rate of NTSC).  The camera also records in MP4 --- but from what I can figure out it only do

  • How to send Zip files as attachments !! Very urgent, Please help!

    I am sending PDF files as attachments using java mail (it works fine). But now my requirement is to zip the PDFs and send them as attachments instead of actual PDF's. But i don't know how to achieve that. does java mail API support zip attachment fac

  • Questions regarding vendor evaluation

    Hello, We are currently trying to use the vendor evaluation functionnalities in MM. Do you know if it is possible to get the evaluation details ? For example, for quantity reliability, we would like to have a report giving the PO where the delivered

  • Excel chart with OLE

    Dear experts, I am using OLE to automate data into Excel chart. My problem now is i would like to change the font size in chart area at X and Y axis. What method and property should i use in order to change the size of the font in chart area? Thanks

  • How can I retrive current user information in Content Server's presetation template?

    We need to determine current user is the item's created user or not, so we want to know how to do this? we can use <pcs:if expr="'Luke' == createdBy">....,but the 'Luke' is static string, so, how can I retirve current user name in Content Server's pr