Problem in FontMetrics.stringWidth method

Iam trying to set the width of a table column with the value calculated using FontMetrics.stringWidth method. But the stringWidth method doesn't return the proper value. The string gets truncated while displaying in the table.
Here is my code:
Font objFont = table.getFont();
FontMetrics objtblLeftFontMetrics = table.getFontMetrics(objFont);
int len = objtblLeftFontMetrics.stringWidth(strValue);
Is there any other solution to solve this problem?
Your reply is greatly appreciated.

I would use the TableCellRenderer for the column (or header) in question. Take the
Component getTableCellRendererComponent returns and use its preferred size.

Similar Messages

  • Problem in bdc session method for tcode FS00

    Hi Experts,
    problem in bdc session method, when i run this program no output is shown.
    Even it is not calling the transaction.
    code as follows.
    *& Report  Z_GL_MASTER
    *& CATEGORY         =  BDC.
    *& DESCRIPTION      =  UPLOADING G/L MASTER RECORDS.
    *& TECHNICAL CONST  =  FRANCIS REDDY.
    *& FUNTIONAL CONST  =  FICO.
    REPORT  Z_GL_MASTER.
    *& Internal  Table
    DATA : BEGIN OF IT_UPLOAD OCCURS 0,
           SAKNR LIKE  GLACCOUNT_SCREEN_KEY-SAKNR,          " ACCOUNT NUMBER.
           BUKRS LIKE  GLACCOUNT_SCREEN_KEY-BUKRS,          " COMPANY CODE.
           KTOKS LIKE GLACCOUNT_SCREEN_COA-KTOKS,           " ACCOUNT GROUP.
           XPLACCT LIKE GLACCOUNT_SCREEN_COA-XPLACCT,       " P&L STATEMEMENT.
           GVTYP LIKE  GLACCOUNT_SCREEN_COA-GVTYP,          " P&L STATEMENT TYPE.
           XBILK LIKE GLACCOUNT_SCREEN_COA-XBILK,           " BALANCE SHEET STATEMENT
           SHORT LIKE GLACCOUNT_SCREEN_COA-TXT20_ML,        " SHORT TEXT.
           LONG LIKE GLACCOUNT_SCREEN_COA-TXT50_ML,         " LONG TEXT.
           WAERS LIKE GLACCOUNT_SCREEN_CCODE-WAERS,         " ACCOUNT CURRENCY.
           XSALH LIKE GLACCOUNT_SCREEN_CCODE-XSALH,         " ONLY BALANCES IN LOCAL CURRENCY.
           MITKZ LIKE GLACCOUNT_SCREEN_CCODE-MITKZ,         " RECONCILATION ACCOUNT FOR ACCOUNT TYPEGLACCOUNT_SCREEN_CCODE-MITKZ
           XOPVW LIKE GLACCOUNT_SCREEN_CCODE-XOPVW,         " OPEN ITEM MANAGEMENT.
           XKRES LIKE GLACCOUNT_SCREEN_CCODE-XKRES,         " LINE ITEM DISPLAY.
           ZUAWA LIKE GLACCOUNT_SCREEN_CCODE-ZUAWA,         " SORT KEY.
           FSTAG LIKE GLACCOUNT_SCREEN_CCODE-FSTAG,         " FIELD STATUS GROUP.
           XGKON LIKE GLACCOUNT_SCREEN_CCODE-XGKON,         " RELAVENT CASH FLOW.
           END OF IT_UPLOAD.
    *& Internal  Table FOR BDC DATA.
    DATA : IT_BDCDATA TYPE  BDCDATA OCCURS 0  WITH HEADER LINE.
    *& DATA DECLARATIONS.
    DATA : V_FILE LIKE RLGRAP-FILENAME.
    *&  SELECTION SCREEN.
    PARAMETER : P_FILE LIKE V_FILE.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
         PERFORM GET_FILENAME.
    START-OF-SELECTION.
          PERFORM UPLOAD_DATA.
          PERFORM BDCDATA_OPEN.
          PERFORM BDC_POPULATE.
          PERFORM BDC_CLOSE.
    *&      Form  GET_FILENAME
    form GET_FILENAME .
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         PROGRAM_NAME        = SYST-CPROG
         DYNPRO_NUMBER       = SYST-DYNNR
         FIELD_NAME          = 'P_FILE'
       IMPORTING
         FILE_NAME           = P_FILE.
    endform.                    " GET_FILENAME
    *&      Form  UPLOAD_DATA
    form UPLOAD_DATA .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      =  P_FILE
       FILETYPE                      = 'DAT'
      TABLES
        data_tab                     = IT_UPLOAD.
    endform.                    " UPLOAD_DATA
    *&      Form  BDCDATA_OPEN
       FORM FOR BDC_OPEN_GROUP.
    form BDCDATA_OPEN .
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                    = SY-MANDT
       GROUP                     = 'GLMASTER'
       HOLDDATE                  = SY-DATUM
       KEEP                      = 'X'
       USER                      = SY-UNAME.
    endform.                    " BDCDATA_OPEN
    *&      Form  BDC_POPULATE
      POPULATING BDC DATA .
    form BDC_POPULATE .
    loop at it_upload.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=ACC_CRE'.
    PERFORM BDC_SUB2 USING 'BDC_CURSOR' 'GLACCOUNT_SCREEN_KEY-SAKNR'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_KEY-SAKNR'    IT_UPLOAD-SAKNR.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_KEY-BUKRS'    IT_UPLOAD-BUKRS.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=2102_GROUP'.
    PERFORM BDC_SUB2 USING 'BDC_CURSOR' 'GLACCOUNT_SCREEN_COA-KTOKS'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-KTOKS'    IT_UPLOAD-KTOKS.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-XPLACCT'  IT_UPLOAD-XPLACCT.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=2102_BS_PL'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-GVTYP'    IT_UPLOAD-GVTYP.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-XBILK'    IT_UPLOAD-XBILK.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_CURSOR' 'GLACCOUNT_SCREEN_COA-TXT20_ML'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-TXT20_ML' IT_UPLOAD-SHORT.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_COA-TXT50_ML' IT_UPLOAD-LONG.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING  'BDC_OKCODE' '=TAB02'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-WAERS'  IT_UPLOAD-WAERS.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XSALH'  IT_UPLOAD-XSALH.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-MITKZ'  IT_UPLOAD-MITKZ.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XOPVW'  IT_UPLOAD-XOPVW.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XKRES'  IT_UPLOAD-XKRES.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-ZUAWA'  IT_UPLOAD-ZUAWA.
    PERFORM BDC_SUB1 USING 'X' 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.
    PERFORM BDC_SUB2 USING 'BDC_OKCODE' '=TAB03'.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-FSTAG' IT_UPLOAD-FSTAG.
    PERFORM BDC_SUB2 USING 'GLACCOUNT_SCREEN_CCODE-XGKON' IT_UPLOAD-XGKON.
    CALL FUNCTION 'BDC_INSERT'
      EXPORTING
        TCODE                  = 'FS00'
       TABLES
         dynprotab              = IT_BDCDATA.
    endloop.
    endform.                    " BDC_POPULATE
    *&      Form  BDC_CLOSE
    FORM FOR CLOSING BDC_GROUP
    form BDC_CLOSE .
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    endform.                    " BDC_CLOSE
    *&      Form  BDC_SUB1
       FORM FOR BDCDATA.
    form BDC_SUB1   USING  A  B  C.
    CLEAR  IT_BDCDATA.
    IT_BDCDATA-DYNBEGIN = A.
    IT_BDCDATA-PROGRAM =  B.
    IT_BDCDATA-DYNPRO =   C.
    APPEND IT_BDCDATA.
    endform.                    " BDC_SUB1
    *&      Form  BDC_SUB2
          text
    form BDC_SUB2   USING  A  B.
    CLEAR  IT_BDCDATA.
      IT_BDCDATA-FNAM = A.
      IT_BDCDATA-FVAL = B.
      APPEND IT_BDCDATA.
    endform.                    " BDC_SUB2
    Points will be  rewarded.
    Thanks in advance.
    Francis.

    Hi,
    Once the program is executed..It will a BDC session..
    THen you have to use the transaction SM35..To process the BDC session..
    Thanks,
    Naren

  • TS3297 Why I can't download a free game I get a message that there's a problem with my payment method but not what it is this is a free app I tried support and got nowhere help

    Why can't I down load a free app  I get a message that there is a problem with my payment method but I gave all information correctly , I did recently change my card no because I lost my old one .i did change the no. On my account      HOPE YOU HAVE SOME SUGGESTIONS  I DON'T SEE WHY THEY HAVE TO CHECKMY PAYMENT METHOD FOR A FREE GAME

    Contact iTunes customer support.
    We're all users like yourself and as such have no access to your account.

  • Getting problem with DOMImplementation classes method getFeature() method

    hi
    getting problem with DOMImplementation classes method getFeature() method
    Error is cannot find symbol getFeature()
    code snippet is like...
    private void saveXml(Document document, String path) throws IOException {
    DOMImplementation implementation = document.getImplementation();
    DOMImplementationLS implementationLS = (DOMImplementationLS) (implementation.getFeature("LS", "3.0"));
    LSSerializer serializer = implementationLS.createLSSerializer();
    LSOutput output = implementationLS.createLSOutput();
    FileOutputStream stream = new FileOutputStream(path);
    output.setByteStream(stream);
    serializer.write(document, output);
    stream.close();
    problem with getFeature() method

    You are probably using an implementation of DOM which does not implement DOM level-3.

  • Problem with the renameTO method in the Linux environment

    Hi
    I got a problem with the renameTO method in the Linux environment. The file is not moving.
    This method is returning false. the same code executed successfully in Windows environment.
    Can anyone give some fix to this one or an alternate solution to move the files in both windows and Linux.
    boolean success;
    File root = new File(tempPath);
                   File f = new File(root, phyFileName);
                   File dest = new File(targetPath);
    success = f.renameTo(new File(dest, actualFileName));actualFileName = 400.doc
    dest = /home/jboss-4.0.3/axsscm_1.0/axsscmDocuments/xchange/fileup/fshare/PO/1786

    JITHENDRA wrote:
    Thanks for the prompt replyNo problem.
    >
    Can u solve the below doubt.
    Will renameTo method wont work in Linux? If so why?Did you not read what I said? I suspect you are trying to rename a file so that it actually has to be moved to a different volume (partition or hard disk) so it won't work. One would have the same problem on Windows trying to rename a file on the c: drive to a name on the d: drive.
    >
    >
    Can u give a sample or good link to do the above work which works fine in all environments.?Just follow the pseudo code I gave. 15 minutes work.

  • Problems with the dispatchEvent-Methode

    Hallo,
    I have a strange problem with above mentioned methode
    I have a JTextField, and I want that only numeric inputs are
    accepted, so I used a KeyListener -Interface in the following way
    public void keyTyped(KeyEvent e)
    JTextField field =(JTextField)e.getSource();
    char c =e.getKeyChar();
    if(c>57 | c<46 |c==47 &&c >31)
    field.dispatchEvent(e);
    the other methodes keyPressed and keyReleased are implemented in the same way.
    So if I type in now in my JTextField an 'a' or whatsoever
    then the following Exception occurs:
    java.lang.StackOverflowError
    at java.awt.Toolkit.getEventQueue(Toolkit.java:1483)
    at java.awt.EventQueue.setCurrentEventAndMostRecentTime(EventQueue.java:731)
    at java.awt.Component.dispatchEventImpl(Component.java:3448)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at ueberstd.ComputeHours.keyTyped(ComputeHours.java:128)
    at java.awt.Component.processKeyEvent(Component.java:5048)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
    at java.awt.Component.processEvent(Component.java:4902)
    Mmh, and this is not the whole Exception message.
    There are missing a couple of lines.
    But may be one of you knows what my mistake is.
    Thanks advance.

    This is not the best way to validate for numerics. Check out the "Creating a Validated Text Field" section from the Swing tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html#validation

  • Please Help!!! Problems access other classes methods

    I am having a problem accessing another classes methods varibles. I have tried a number of ways but with no success. Here is my problem:
    I have the main(), from there it's calls the class GetVar(), GetVar stores info in Class HousingForVar(), and finially, I have a class TryinToTalkToHousing() that I use to access HousingForVar()'s methods. I know I can use the keyword new but if I do that then it erases over the data I put in. Please can anyone help, this has been driving me nutz all day. Thank you in advance.
    Roman03
    ***EACH CLASS IS A DIFFERENT FILE****
    public class TestMain
         public static void main( String args[] )
              GetVar getVarible = new GetVar();
              getVarible.heroF();
    import java.util.Scanner;
    public class GetVar
         public void heroF()
              String someEntered;
              Scanner input = new Scanner( System.in);
              System.out.println("Enter a string: ");
              someEntered = input.next();
              HousingForVar houseForData = new HousingForVar(someEntered);
              System.out.printf("Retieved from Class GetVar, you entered: %s\n", houseForData.getCollectVar() );
    import java.util.Scanner;
    public class HousingForVar
         private String getData;
         public HousingForVar(String enterInfo)
              getData = enterInfo;
         public void setGetVar(String enterInfo)
              getData = enterInfo;
         public String getCollectVar()
              return getData;
    import java.util.Scanner;
    public class TryinToTalkToHousing
         public void someMeth()
              String getInfoFromHousing;          
              System.out.printf("Started out at TryinToTalkToHousing Class\n Retieved from Class GetVar from %s\n",
              houseForData.getCollectVar() );
    \* I know this doesn't work, but if I make a new object of the class HousingForVar it's going to write over my input, so what do I do? I am still learning, Please help*\

    I don't use 1.5, so you'll have to convert it back, but see if you can follow the flow of this
    import java.io.*;
    class TestMain
      GetVar getVarible;
      public TestMain()
        getVarible = new GetVar();
        getVarible.heroF();
        System.out.println("******");
        new TryinToTalkToHousing(this).someMeth();
      public static void main(String[] args){new TestMain();}
    class GetVar
      HousingForVar houseForData;
      public void heroF()
        try
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          System.out.print("Enter a string: ");
          String someEntered = br.readLine();
          houseForData = new HousingForVar(someEntered);
          System.out.println("Retieved from Class GetVar, you entered: "+houseForData.getCollectVar()+"\n");
        catch(Exception e){e.printStackTrace();}
    class HousingForVar
      private String getData;
      public HousingForVar(String enterInfo)
        getData = enterInfo;
      public void setGetVar(String enterInfo)
        getData = enterInfo;
      public String getCollectVar()
        return getData;
    class TryinToTalkToHousing
      TestMain parent;
      public TryinToTalkToHousing(TestMain t){parent = t;}
      public void someMeth()
        System.out.println("Started out at TryinToTalkToHousing Class\n"+
        "Retieved from Class GetVar, you entered: "+parent.getVarible.houseForData.getCollectVar()+"\n");
    }

  • Flash Builder 4.6 code hinter problem - not showing some methods

    Hi All,
    I have a problem with FB code hinter. It does not show some methods on an object.
    To be exact I created a Date object and FB code hinter does not show .toDateString method (actually I it shows only one to string method - .ToString(), although according to docs there are more)
    When I use .toDateString method, code still compiles and work just fine, however method is not showing up in code hinter, which is really annoying..
    Anyone had this problem? If so, please, share some wisdom how to solve this thing.
    Thanks in advance.
    UPDATE:
    Here is some more info in my problem.
    I have tried to reinstall the application, but it did not help.
    So what I did was:
    * first I installed FB standard edition version 4.
    * I checked the code hinter and it worked. It showed .toDateString method.
    * I have purchased FB standard 4.5 upgrade.
    * I installed this upgrade, and boom the code hinter does not show the method...
    * Next I tried to create a project with Flex 4.1 sdk and then it worked - method was there. So the problem is with 4.6 sdk apparently...sucks...

    Hi, I have the same problem. I have a new FB 4.6 installation and it is my first FB installation. Do you have a solution already?

  • Problem with a template method in JDialog

    Hi friends,
    I'm experiencing a problem with JDialog. I have a base abstract class ChooseLocationDialog<E> to let a client choose a location for database. This is an abstract class with two abstract methods:
    protected abstract E prepareLocation();
    protected abstract JPanel prepareForm();Method prepareForm is used in the constructor of ChooseLocationDialog to get a JPanel and add it to content pane.
    Method prepareLocation is used to prepare location of a database. I have to options - local file and networking.
    There are two subclasses ChooseRemoteLocationDialog and ChooseLocalFileDialog.
    When I start a local version, ChooseLocalFileDialog with one input field for local file, everything works fine and my local client version starts execution.
    The problem arises when I start a network version of my client. Dialog appears and I can enter host and port into the input fields. But when I click Select, I get NullPointerException. During debugging I noticed that the values I entered into these fields ("localhost" for host and "10999" for port) were not set for corresponding JTextFields and when my code executes getText() method for these input fields it returns empty strings. This happens only for one of these dialogs - for the ChooseRemoteLocationDialog.
    The code for ChooseLocationDialog class:
    public abstract class ChooseLocationDialog<E> extends JDialog {
         private E databaseLocation;
         private static final long serialVersionUID = -1630416811077468527L;
         public ChooseLocationDialog() {
              setTitle("Choose database location");
              setAlwaysOnTop(true);
              setModal(true);
              Container container = getContentPane();
              JPanel mainPanel = new JPanel();
              //retrieving a form of a concrete implementation
              JPanel formPanel = prepareForm();
              mainPanel.add(formPanel, BorderLayout.CENTER);
              JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
              JButton okButton = new JButton(new SelectLocationAction());
              JButton cancelButton = new JButton(new CancelSelectAction());
              buttonPanel.add(okButton);
              buttonPanel.add(cancelButton);
              mainPanel.add(buttonPanel, BorderLayout.SOUTH);
              container.add(mainPanel);
              pack();
              Toolkit toolkit = Toolkit.getDefaultToolkit();
              Dimension screenSize = toolkit.getScreenSize();
              int x = (screenSize.width - getWidth()) / 2;
              int y = (screenSize.height - getHeight()) / 2;
              setLocation(x, y);
              addWindowListener(new WindowAdapter() {
                   @Override
                   public void windowClosing(WindowEvent e) {
                        super.windowClosing(e);
                        System.exit(0);
         public E getDatabaseLocation() {
                return databaseLocation;
         protected abstract E prepareLocation();
         protected abstract JPanel prepareForm();
          * Action for selecting location.
          * @author spyboost
         private class SelectLocationAction extends AbstractAction {
              private static final long serialVersionUID = 6242940810223013690L;
              public SelectLocationAction() {
                   putValue(Action.NAME, "Select");
              @Override
              public void actionPerformed(ActionEvent e) {
                   databaseLocation = prepareLocation();
                   setVisible(false);
         private class CancelSelectAction extends AbstractAction {
              private static final long serialVersionUID = -1025433106273231228L;
              public CancelSelectAction() {
                   putValue(Action.NAME, "Cancel");
              @Override
              public void actionPerformed(ActionEvent e) {
                   System.exit(0);
    }Code for ChooseLocalFileDialog
    public class ChooseLocalFileDialog extends ChooseLocationDialog<String> {
         private JTextField fileTextField;
         private static final long serialVersionUID = 2232230394481975840L;
         @Override
         protected JPanel prepareForm() {
              JPanel panel = new JPanel();
              panel.add(new JLabel("File"));
              fileTextField = new JTextField(15);
              panel.add(fileTextField);
              return panel;
         @Override
         protected String prepareLocation() {
              String location = fileTextField.getText();
              return location;
    }Code for ChooseRemoteLocationDialog
    public class ChooseRemoteLocationDialog extends
              ChooseLocationDialog<RemoteLocation> {
         private JTextField hostField;
         private JTextField portField;
         private static final long serialVersionUID = -2282249521568378092L;
         @Override
         protected JPanel prepareForm() {
              JPanel panel = new JPanel(new GridLayout(2, 2));
              panel.add(new JLabel("Host"));
              hostField = new JTextField(15);
              panel.add(hostField);
              panel.add(new JLabel("Port"));
              portField = new JTextField(15);
              panel.add(portField);
              return panel;
         @Override
         protected RemoteLocation prepareLocation() {
              String host = hostField.getText();
              int port = 0;
              try {
                   String portText = portField.getText();
                   port = Integer.getInteger(portText);
              } catch (NumberFormatException e) {
                   e.printStackTrace();
              RemoteLocation location = new RemoteLocation(host, port);
              return location;
    }Code for RemoteLocation:
    public class RemoteLocation {
         private String host;
         private int port;
         public RemoteLocation() {
              super();
         public RemoteLocation(String host, int port) {
              super();
              this.host = host;
              this.port = port;
         public String getHost() {
              return host;
         public void setHost(String host) {
              this.host = host;
         public int getPort() {
              return port;
         public void setPort(int port) {
              this.port = port;
    }Code snippet for dialog usage in local client implementation:
    final ChooseLocationDialog<String> dialog = new ChooseLocalFileDialog();
    dialog.setVisible(true);
    location = dialog.getDatabaseLocation();
    String filePath = location;Code snippet for dialog usage in network client implementation:
    final ChooseLocationDialog<RemoteLocation> dialog = new ChooseRemoteLocationDialog();
    dialog.setVisible(true);
    RemoteLocation location = dialog.getDatabaseLocation();Exception that I'm getting:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at suncertify.client.gui.dialog.ChooseRemoteLocationDialog.prepareLocation(ChooseRemoteLocationDialog.java:42)
         at suncertify.client.gui.dialog.ChooseRemoteLocationDialog.prepareLocation(ChooseRemoteLocationDialog.java:1)
         at suncertify.client.gui.dialog.ChooseLocationDialog$SelectLocationAction.actionPerformed(ChooseLocationDialog.java:87)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6134)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
         at java.awt.Component.processEvent(Component.java:5899)
         at java.awt.Container.processEvent(Container.java:2023)
         at java.awt.Component.dispatchEventImpl(Component.java:4501)
         at java.awt.Container.dispatchEventImpl(Container.java:2081)
         at java.awt.Component.dispatchEvent(Component.java:4331)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
         at java.awt.Container.dispatchEventImpl(Container.java:2067)
         at java.awt.Window.dispatchEventImpl(Window.java:2458)
         at java.awt.Component.dispatchEvent(Component.java:4331)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
         at java.awt.Dialog$1.run(Dialog.java:1046)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)java version "1.6.0"
    OpenJDK Runtime Environment (build 1.6.0-b09)
    OpenJDK Client VM (build 1.6.0-b09, mixed mode, sharing)
    OS: Ubuntu 8.04
    Appreciate any help.
    Thanks.
    Edited by: spyboost on Jul 24, 2008 5:38 PM

    What a silly error! I have to call Integer.parseInt instead of getInt. Integer.getInt tries to find a system property. A small misprint, but a huge amount of time to debug. I always use parseInt method and couldn't even notice that silly misprint. Sometimes it's useful to see the trees instead of whole forest :)
    It works perfectly. Sorry for disturbing.

  • Problem with seting action method to a Hyperlink object

    Hi there,
    as the subject says, I have a problem wih setting the action method of a Hyperlink object. Here is how the program is organized:
    I have an external bean which generates an ArrayList of Hyperlink objects. In the backing bean of my web page I call a method from the above mentioned external bean to generate the list of hyperlink objects. After that in the page bean I insert the hyperlink objects in GridPanel component. So far everything works fine, but the action method of the Hyperlink objects is not called and I can't understant why.
    Here is how I add the objects to the GridPanel component:
    private void populateGridPanel()
            Hyperlink hyper;
            for(int i=0; i< checkboxList.size(); i++)
                    hyper = (Hyperlink) hyperlinkList.get(i);
                    vehicleGridPanel.getChildren().add(hyper);
        }All properties of the Hyperlink objects are set in the external bean not in the page bean, here is how:
    //action method executed when the hyperlink is clicked
    MethodBinding mb = (MethodBinding) FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.hyperlink_action}", null);
    veHyperlink.setAction(mb);The populateGridPanel() method is called in the init() method of the page bean, after the initialization of all other components.
    An interesting fact is that if I manually drag-n-drop a hyperlink object to my page and programatically set its action method with the code above everything works fine. But using the same code for the dynamically generated hyperlink objects inserted in the grid panel doesn't work.
    Any kind of help is highly appreciated.
    Thanks!
    Message was edited by:
    panayot

    I got this use case to work as follows:
    1. Drag a Grid Panel and set its columns property to 1.
    2. Drag a Message Group.
    3. Use the following code in Page1:
    public void prerender() {
    populateGridPanel();
    private void populateGridPanel() {
    if (gridPanel1.getChildren().size() > 0) {return;}
    for (int i = 0; i < 3; i++) {
    Hyperlink veHyperlink = new Hyperlink();
    //action method executed when the hyperlink is clicked
    MethodBinding mb = (MethodBinding) FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{Page1.hyperlink_action}", null);
    veHyperlink.setAction(mb);
    veHyperlink.setText("dynamic hyperlink " + i);
    veHyperlink.setId("dynamicHyperlink" + i);
    gridPanel1.getChildren().add(veHyperlink);
    public void hyperlink_action() {
    info("Yup it worked at: " + new java.util.Date());
    4. Fix imports, Run, and then click on the hyperlinks.

  • Problem with Call transaction method in function module

    Dear Frndz,
               I am converting its services into webdynpro.
               I developed a rfc[function module] for travel management [TRIP] . In that rfc i used call transaction method[BDC] to upload the data. The same rfc will be called from the frontend[portal].It is working fine in development for whome se37 execution authorization was assigned. It is not working for other users.  I hope it is something relevant to authorization .If suppose can i create a authorization  object for this rfc and assign it to the profile.
            Normally  users can be given authorization to run the tcode.
    similarly i want to give the authorization to be given users to execuste this funtion module.
    huv can i do it ?? any suggestion.
    Rgds.
    siva

    Use ST01 transaction to start authorization trace, you will then see what authorizations are missing (if your assumption is right of course, i.e. if it's really an authorization problem)

  • Problem with calling onApplicationStart() method

    Hi all,
         I have a problem with calling application.cfc's methods from coldfusion template. The problem is like when i am calling "onapplicationstart" method inside a cfml template i getting the error shown below
    The onApplicationStart method was not found.
    Either there are no methods with the specified method name and argument types or the onApplicationStart method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
    My code is like below.
    Application.cfc
    <cfcomponent hint="control application" output="false">
    <cfscript>
    this.name="startest";
    this.applicationtimeout = createtimespan(0,2,0,0);
    this.sessionmanagement = True;
    this.sessionTimeout = createtimespan(0,0,5,0);
    </cfscript>
    <cffunction name="onApplicationStart" returnType="boolean">
        <cfset application.myvar = "saurav">
    <cfset application.newvar ="saurav2">
        <cfreturn true>
    </cffunction>
    </cfcomponent>
    testpage.cfm
    <cfset variables.onApplicationStart()>
    I have tried to call the above method in different way also like
    1--- <cfset onApplicationStart()>
    i got error like this
    Variable ONAPPLICATIONSTART is undefined.
    2---<cfset Application.onApplicationStart()>
    The onApplicationStart method was not found.
    Either there are no methods with the specified method name and argument types or the onApplicationStart method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity
    Please help me out.
    Thanks
    Saurav

    You can't just call methods in a CFC without a reference to that CFC. This includes methods in Application.cfc.
    What are you trying to do, exactly, anyway? You'd probably be better served by placing a call to onApplicationStart within onRequestStart in Application.cfc, if your goal is to refresh the application based on some condition:
    <cffunction name="onRequestStart">
         <cfif someCondition>
              <cfset onApplicationStart()>
         </cfif>
    </cffunction>
    Dave Watts, CTO, Fig Leaf Software
    http://www.figleaf.com/
    http://training.figleaf.com/

  • Problem in batch input method

    Hi wizards,
    please help me for the following problem:
    I have created a parent recording for MATERIAL MASTER in LSMW batch input method by selecting all of the fields that may be required for different material types.  Now I want to edit the recording and create new recordings from the parent one for specific material types.  For this, i have made a copy of the same recording with a different name in the same project.  In the copied recording, i have kept only the screen fields which i require for a particular material type and deleted the rest. I have created new structure relationships and field mapping rules for the new recording. Now when i upload the data, system is behaving normally upto the DISPLAY READ DATA stage, but gives a short dump on CONVERT DATA. On inspection i have found that during FIELD MAPPING, the _source field mapping is still showing mapping with the source structure of the parent recording for fields which have mapping rule as "Transfer" but it is picking up the new source structure for those source fields for which mapping rule is "Constant"_.
    Kindly help me solve this problem as i do not want to create a separate recording for each material type. Can creating a new subproject help in this regard?
    Thanks and regards
    Abhik

    Hi Harris,
    could you please let me know how to use the two methods you have mentioned? If you have any docs regarding the same then could you please mail it to me at [email protected]? Or else if you have any link for the same then please do send it to me.
    However, I would like to know that if separate recording is required for every material type, then why the "COPY RECORDING" and "DELETE SCREENFIELD" utilities have been provided.
    Thanks and regards
    Abhik

  • Problem of alv CHECK_CHANGED_DATA method

    hi,experts
      i have created an alv with a checkbox field. i called the GRID_01->CHECK_CHANGED_DATA method to get what the records user selected.
    the first time user select 2 records, it works fine and popup an 'E' type message to let user select only 1 record.
    the second time user select 1 record, but it still got 2 record after CHECK_CHANGED_DATA, and popup message.
    the third time user select 1 record again, and it works fine again, got 1 record and run.
    what  the problem it is?
    hunger for your advice! thanks!

    Lee,
    I wonder how you solved this.
    Please share if you don't mind.

  • % Character causing problems with the getParameterMap() method:

    Hello All,
    I've run run across something I've never seen or heard of before. Basically, we have a jsp form that returns form data into a Map object from the request.getParameterMap() method. We have code in place to pull out wrong entity characters that the user may have submitted, like *, &, !, etc... The problem is we have a field that takes a 3 digit code, like 999, but if the user puts in 99%, the percent character messes up the parameter map. The request parameters go out fine from the form, but in the doPost method of the servlet the map gets changed or it changes the request parameters and 99% becomes 99/fastname somehow where f is a jsp variable for the jsp form and lastname would be the name of the next key or % is doing something else that might explain why it's overwritting the first two characters here. Not sure. Has anyone ever seen this before or have any ideas as to how to fix it? Other entity characters don't seem to do this in the app.
    Any help or sympathy is appreciated!
    Thanks,
    James

    Well I've done more investigating and I think I've narrowed it down more. We are using JSP's and something I've never seen before, changing an http request/response object after it's been sent to the server.
    Here is some of the code:
    var url = etc...
    var httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
    httpRequest.open('POST', url, false);
    httpRequest.send();     
    //I added this code to see what happens to my 99% value.
    var xmlDocument = trim(httpRequest.responseText);
    message = document.getElementById('3digitfieldName').value;
    alert(message);
    I added some code in because I want to see when the 99% field value gets changed. When it leaves the form we can see what the value is from: Map paramMap = request.getParameterMap();
    It then goes out to the code that changes the request into the new ActiveXObject. Still at this point it's showing 99%, but when it returns back to: Map paramMap = request.getParameterMap(); the value is changed to 99/fonsignees, which is the name of the next field (parameter) of consignees. /f shows up in my debug editor, but when I print out the text it's just showing a box symbol in between 99 and onsignees. f is a variable for the form btw. What I'm thinking is that somehow, MSXML doesn't like the "%" character, but I'm not sure how to fix this?

Maybe you are looking for