Problem with Table.getSelectedColumn() method plz help its so urgent

Hi,
I need to display a input msg box while the given icode( coloumn name) is not there in database and the the input value should goto the product( 3rd column in my table) column in table. my code is bellow.
private void TablePropertyChange(java.beans.PropertyChangeEvent evt) {
// ss
i=0;
int s=1;
String icde=new String();
String Prdct=new String();
String result=new String();
// String CODE=new String();
String ICDE=new String();
String prd=new String();
int Colselected=Table.getSelectedColumn();
//column.getPreferredWidth();
try
TableColumn ICode = Table.getColumnModel().getColumn(1);
TableColumn product = Table.getColumnModel().getColumn(2);
TableColumn unit = Table.getColumnModel().getColumn(3);
TableColumn rate = Table.getColumnModel().getColumn(4);
TableColumn Amount = Table.getColumnModel().getColumn(5);
for(;i<s;++i)
//For loop starts
ICode.setPreferredWidth(76);
product.setPreferredWidth(157);
unit.setPreferredWidth(75);
rate.setPreferredWidth(85);
Amount.setPreferredWidth(95);
Table.setValueAt(i+1,i,0);
float gr=0,//Gross amt
qt=0,//Qty
rt=0,//Rate;
dcp=0,//Disc%
dcam=0,//Disc Amt
edrt=0,//EDrate
edrt1=0,
edam=0,//EDGross
taxrt=0,//TaxRate
taxam=0,//TaxAmt
netam=0;//netamt
try
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
Connection con1 = DriverManager.getConnection(url1,"suresh", "special");
Statement stmt1 = con1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
Prdct=Table.getValueAt(i,1).toString();
Statement stmti= con1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
ResultSet rsi = stmti.executeQuery("select * from prd where ICODE='"+Prdct+"'");
java.util.Vector <String> prdct = new java.util.Vector <String>();
if(rsi.next())
String prodct=rsi.getString("ITEM");
prdct.add(prodct);
Table.setValueAt(prdct,i,1);
Double RT=rsi.getDouble("saleprice");
String RTS=RT.toString();
Table.setValueAt(RTS,i,4);
// int ColValue=Colselected==1;
else if(Colselected==1)
result = (String)JOptionPane.showInputDialog(this,
"Enter the new Item", "S-appsys's INFO",JOptionPane.INFORMATION_MESSAGE);
System.out.println("asdrf "+i);
Table.setValueAt(result,i,2);
// Colselected=0;
// Table.setV
// System.out.println("asdrf "+i);
}// Table.setValueAt(result,i,2);
}catch ( java.lang.ClassNotFoundException cl)
System.out.println("Error"+cl);
catch(java.sql.SQLException sq)
System.out.println("Error"+sq);
qt=Float.parseFloat(Table.getValueAt(i, 3).toString());
rt=Float.parseFloat(Table.getValueAt(i, 4).toString());
gr=qt*rt;
Table.setValueAt(gr,i,5);
s=Table.getRowCount();
}catch(java.lang.NullPointerException e){}
my problem is i can get the msg box while i am giving value in 1st time. but if i am giving the value in second row it will show the msgbox 4 times and it will change previous rows product column value twise and then it will change current row value. i need solution for this
plzzz help me
Thanks in advance
Suresh.

Your description of the problem makes no sense to me.
The code you posted in not formatted or executable so I'm not going to waste time trying to understand it.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

Similar Messages

  • Experts plz help its very urgent

    hi expert
    plz help- me
    previously i was getting dump in this statement
    TRANSFER v_tab TO p_file.
    FYI:
    here v_tab is a table which hav som records
    and p_file contains the path of a file like c:\new\ggg.txt
    DATA: v_tab TYPE STANDARD TABLE OF t_line WITH HEADER LINE,
    TYPES: BEGIN OF t_line,
           pspid(9) TYPE c,
           tab1 TYPE x,
           post1 TYPE proj-post1,
           tab2 TYPE x,
           vernr TYPE prps-vernr,
           tab3 TYPE x,
    END OF t_line.
    DUMP I WAS GETTIN :
    For the statement
       "TRANSFER f TO ..."
    only character-type data objects are supported at the argument position
    "f".
    In this case. the operand "f" has the non-character-type "T_LINE". The
    current program is a Unicode program. In the Unicode context, the type
    'X' or structures containing not only character-type components are
    regarded as non-character-type.
    to avoid this dump i used feild symbol
    assign V_TAB to <IN> casting.
          p_file = <in>.
          unassign <IN>.
    nw there is no dump
    but problem is p_file contains the contents of v_tab not the file path .
    plz help me its very urgent
    thanx in advance

    Hey, no probs,
    after your initial declaration, do this.
    TYPES: BEGIN OF n_line,
    pspid(9) TYPE c,
    tab1(15) TYPE c,        "check the length you want
    post1 TYPE proj-post1,
    tab2(15) TYPE c,         "check the length you want
    vernr TYPE prps-vernr,
    tab3(15) TYPE c,         "check the length you want
    END OF t_line.
    DATA: n_tab TYPE STANDARD TABLE OF n_line WITH HEADER LINE.
    now after you fetch data into v_tab,
    move it to n_tab.
    using a loop at v_tab and move corresponding fields to n_tab's work area
    append to n_tab.
    once you have populated n_tab and are ready to TRANSFER.
    OPEN your file using
    open dataset <file> for output in text mode encoding default.
    now
    loop at n_tab.
    TRANSFER n_tab to p_file.
    endloop.
    CLOSE DATASET.

  • I have a problem with my macbook pro plz help!!!

    on keyborad in mac there's 3 keys.. the one for going to the next song/ the one for going to the pervious song/ the one that stop/play song
    Suddenly they stopped working.. i dont know why?
    i took a shoutscreen and then they didnt work.. also the bottoms in the headphone that i use for stopping the song doesnt work but on the iphone they work properly?
    and why i use these keys for Function ' F ' they work :S
    so please can u help me.....

    I think your going to need someone there to help you with your issue so you can show them what your problem is and they can tinker with things to get it to work again.

  • Problem with JSObject.getWindow() method - Please Help

    I have a small Apllet that has a button that calls a Javascript function in the opening window, to close the window in which it is loaded.
    The Applet window is a PopUp window from one of my application's window. First time I start my application and load that Applet the button works fine. It calls the Javascript method and the Method closes the window using the window.close() method.
    But now if I open the applet window again and click on the button to close the windows, it hangs. I put in trace statements and saw that it hangs on JSObject.getWindow() window.
    I am using JDK Plugin 1.2.2, testing in IE 6.0 with no microsoft JVM.
    Please, if somebody could give me some clue about why this would happen, I will really appreciate that. I have been stuck into this problem for last three days.

    Hello,
    I have the same problem as you have had. I am using a Flash GUI to control a Java 1.4.2_04 applet via JavaScript. The Java applet appears on 50 html pages within a web-based training. It works fine on IE 6.0 and NS 7.1 when I view only one of the applet pages. But when I turn e.g. from the 10th to the 11th page, the browser crashes due to a fatal exeption in vbscript.dll (IE) or xpconnect.dll (NS). Sometimes I can view 50 or more pages without problems, but the browser crashes far too often. (When I use the applet's own GUI to control it, I can view it on as many pages as I want without any problems).
    5 times per second Flash calls a JavaScript function, which calls a Java function, which returns a value (indicating the state of the applet), which JavaScript uses to set a Flash variable. Java never calls a JavaScript function. On IE I used VB Script to enable Flash to JavaScript communication.
    Is liveconnect buggy? Have you found a solution of the problem?

  • Problem with client side printing, please help its urgent

    hi ,
    am using struts and jasper reports on my project, now i was having problem that whenever i try to print the report , the printer dialogue box was appearing on server machine, i want it on client end, how to solve this problem, please any one know help me, it was urgent,
    my code was like this
    JasperCompileManager.compileReportToFile("c:/report/test.jrxml","c:/report/test.jasper");
    JasperPrint jasperPrint = JasperFillManager.fillReport("c:/report/test.jasper"),parameters,con);
    List l=jasperPrint.getPages();                         
    if(l.size() != 0){
      jasperPrint.setOrientation(JasperReport.ORIENTATION_PORTRAIT);
      jasperPrint.setPageHeight(877);
      jasperPrint.setPageWidth(963);
      JasperPrintManager.printPages(jasperPrint,0,l.size()-1,true);
    }thanks in advance,

    Double post.

  • Problems with PC133 memory. Plz help[txt]

    I have a P4 1.4ghz.
    65Meg PC133 Meg installed and WinME installed without problem.
    I think put in 265Meg PC 133 and reomved the 65Meg memory and Windows kept freezing at the logo screen.
    I formatted my harddisk and setup the HD with Fdisk etc and when I get to the "Checking For Installed Components" part of Window`s installtion process it just keep locking up and not even the mouse will work.
    Is it the 256mg or the mainboard ?
    I have an MSI 845 Pro mainboard which is at the link below.
    http://www.msi.com.tw/html/newsrelease/product_news/2001_0911_6529.htm

    http://www.memtest86.com

  • Problem with the replaceAll method - please help

    When the source String contains some special characters like ' ? ' , ' ) ' , or ' ( ' etc, the replaceAll function doesn't has any effect on the source String.
    for example
    String k="images/mainpage7(sm)_01.jpg";
    String h=k.replaceAll("images/mainpage7(sm)_01.jpg","JoinNowBox_01.jpg");
    System.out.println(k);
    System.out.println(h);
    output:
    images/mainpage7(sm)_01.jpg
    images/mainpage7(sm)_01.jpg
    Can anybody tell me what to do?
    Thanks in advance
    Hristos Floros - Greece

    But what if I don�t know the values of all Strings?
    String a="images/mainpage7(sm)_01.jpg";
    String b="images/mainpage7(sm)_01.jpg";
    String c="images/mainpage7(sm)_01.jpg";
    String d=a.replaceAll(b,c);
    System.out.println(a);
    System.out.println(d);

  • In my Iphone 5, Nothing on my App Store is working its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component but still it doen't fix. Not sure if its problem with apple servers. Someone help please!

    In my Iphone 5, Nothing on my App Store is working,  its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component in my desktop but still it doesn't fix the app store issue. Not sure if its problem with apple servers. Someone help please!

    settigns>itunes and app store to make sure you are signed in.. If  you are, you will see your account name..... anyhow, click your account name, sign out and sign back in
    also go to to settings>general>reset and reset network settings... if that doesnt work settings>general>reset and reset all settings!
    one of those shall work. The last step would be to restore your device (apple.com/support) HT1414

  • I have problem with my I PHONE 4S  Always its time out then i must restart my I phone please any help about this case ??

    i have problem with my I PHONE 4S  Always its time out then i must restart my I phone please any help about this case ??

    Hello Pllumb,
    It sounds like you are unable to turn on Wi-Fi because the option is grayed out in Settings. Use these steps from the following article named:
    iOS: Wi-Fi settings grayed out or dim
    http://support.apple.com/kb/ts1559
    Restart your iOS device.
    Make sure that airplane mode is off by tapping Settings > Airplane Mode.
    Reset the network settings by tapping Settings > General > Reset > Reset Network Settings.
    This will reset all network settings, including Bluetooth pairing records, Wi-Fi passwords, VPN, and APN settings.
    Make sure that your device is using the latest software. To do so, connect your device to your computer and check for updates in iTunes.
    If you still can't turn Wi-Fi on, please contact Apple for support and service options. If you can turn Wi-Fi on but are experiencing other issues with Wi-Fi, please see these steps.
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • I purchased 2 weeks before i phone 5 but there is problem with sleep and wake up button its not responding can anyone help me in this issue.

    i purchased 2 weeks before i phone 5 but there is problem with sleep and wake up button its not responding can anyone help me in this issue.

    You have a one-year hardware warranty & 90 days of free phone support. Take advantage of it, make an appointment at an Apple store or call AppleCare.

  • HT2500 Hi, I have a problem with my mac mail account. Its linked with my website and i've just transferred my domain and host plan to 123-reg.co.uk Now for some reason emails disappear from my inbox! Emails come in and then my inbox is empty.. Help!

    Hi, I have a problem with my mac mail account. Its linked with my website and i've just transferred my domain and host plan to 123-reg.co.uk Now for some reason emails disappear from my inbox! Emails come in and then my inbox is empty.. Help!

    Lord K.  Thank you. Yes I am within the 90 time period, however I travel Intertionally and I can not receive not make a call to Apple. I was just at the Genius Bar in Chicago and they said, don't worry about it.  It just floats out there, however, I can not recover my messages on a flash drive. I need to go back to my old computer which I don't have with me.  My messages were in folders for a lawsuit.  It is going to take an incredible amount of work for me to, you have no Idea.  We are talking thousands of pages!  I the defendent will have them during discovery so I am not so worried.  However, I can not bring them to him on a Flashdrive when I meet with him without an extraordinary amount of presssure on my part.  THis is not just some little email issue. This is suing EXPEDIA and Tripadviosr.com

  • Problem with tables -- need help!

    I am having problems with table formatting, when using
    Preformatted text. The tables look fine in the WYSIWYG editor, but
    have lots of extra space above and below the text when looking at
    the output files.
    I will attach the code from one of the HTML files from my
    project, so you can see what I'm talking about.
    Thanks.

    Well, if you're talking about the single-celled table with
    the line:
    <p class=Preformatted>[assembly:
    Ace.AceAssembly]</p>
    </pre>
    ... you can eliminate the <P> tags. that will give you
    one line less. Otherwise, your remaining space is the result of the
    <PRE> tag. It, like the <XMP> tag, gives it one line of
    space beneath as well.
    Your alternative beyond that would be to, when needed, wrap
    up the script in Javascript. That line, for instance, wouldn't need
    it.

  • 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.

  • Problem with table maintenance allowed

    hi,
    here my problem is table is genarated and stored under local object that time i m creating function group is zabc. afterwards i m storing my table in my development class that time it is not possible to change function group in table maintenance genarator plz help me any one knows.
    what is the exact use of table maintenance generator i m using this for ztables and i m going to screen painter i m adjesting the fields.what is the exact use of it.

    Hi,
    1) You may delete the function group assignment and re-assign another one in change mode
    2) The use of table maintenance generator is to provide users with a screen to maintain data in the table. If the data is not going to be populated by any users then there is no need for it. Transactions will automatically populate the data in the background
    3) One can access the maintenance screen by going to SM30 or can assign your own transaction code to access it
    Hope it helps.
    Raj
    Reward points if helpful

  • What could be the problem with table REGUH

    Hi exprts
    i developed a report . its wrking ok in developemt system
    but in Quality system ,
    the below query is taking more time.
    in quality even  i have taken slection criteria which is very less than devlopment selection.
    please tell me the below query is performance wise not good or
    is there any problem with table REGUH in quality system?
      IF NOT ( t_bsak_aux[] IS INITIAL ).
        SELECT laufd laufi xvorl zbukr lifnr rwbtr kunnr empfg"
               vblnr ausfd rzawe
          FROM reguh
          INTO TABLE t_reguh
          FOR ALL ENTRIES IN t_bsak_aux
          WHERE laufd <> space
            AND laufi <> space
            AND zbukr = t_bsak_aux-bukrs
            AND lifnr = t_bsak_aux-lifnr
            AND vblnr = t_bsak_aux-augbl.
    thanks in advance
    regards
    neeru

    Hi,
    Using SPACE against the keys (LAUFI, LAUFD - specifically LAUFD) will most likely return no results. LAUFD, being one of the keys and the date which the program is supposed to run (considering that this is settlement data - it has already run) - implies that this field will be populated.  Putting " = SPACE" in your where clause is saying that you want to find records from the table where those fields are not populated.  That is fine for LAUFI, considering it is the indicator for a proposal only. In my requirement, my client did not want to see proposals but only real payment runs - therefore, LAUFI = SPACE is correct. 
    The reason you are having poor performance while selecting form this table is because it is a cluster table like bseg.  This thread explains a little bit of why cluster tables are a performance nightmare when trying to select - although it is about bseg, you will get the idea:
    http://blogs.ittoolbox.com/sap/db2/archives/select-from-bsegrfblg-performance-problem-14247
    I'm trying to find an alternative to get bank account information regarding payments - I will post a reply if I am lucky to find one! 
    Good luck

Maybe you are looking for