Storing data in arrays and using Stirng methods

Hi There!
Could any one help me in developing a kind of "PhoneBook" in java?
Coding for the following program is required in java(jdk1.2).
The problem is to program a PhoneBook in the following way when the program executes
A list of following option will be displayed for the user to select from
a- Enter new Name/Phonenumber
b-Delete an Entry from the PhoneBook
c- Dispaly the existing Data(Names with associated
PhoneNumbers.
d-Exit the program
Based on the options selected by the user , the program will perform required task
The data will be stored in arrays of some kind.
To perfom the functions selected by the user String methods (charAT(), indexOf etx) will be used
For search function character search is allowed e.g if the user enters the name "Smith" whose phonenumber will be searched for in the PhoneBook, after enterin just "sm", all the enteries starting with sm and their associated phonenumbers will be displayed.
The records will be displayed in the following way
a Smith 111-4444
b Albert 222-6666
Please help me I will be very thank ful.

Shall we say 'its' instead???
From the format of its post...
Doesn't sound really good, but if the female are
offended...
:-)Well ... we had that once before ... she was offended .. kinda .... Don't know about Saadia ... so far she's looking for a solution I guess, once she has that .. than she'll think about "other" things! :-)
But to answer your question, you can use he/she. Is that too much extra typing? I guess, the posters also can add a (Mr./Miss) to their names ... if they care ... actually that's what I suggested this other lady to do! :-)
(Mr.) Kamran Aftab

Similar Messages

  • Having problem with storing data in array

    Hi,
    I'm having problem on storing data in array. My problem is that each time it loops, the array just keep overwrite instead save to the next index. Like at 0 the value is 123, and 1 is 234. But i having that all data capture all overwrite at 0 till the last data it still show at 0. How do i correct this problem?
    Solved!
    Go to Solution.

    How to use array to do comparison? Like Array 1 go thru array 2 to get data Loss out and build an array. Like Array 1 ,1000,1024,1048,etc before 1520 fall in between Array 2 range 1000-1500. So Freq 1000,1024,1048 etc will get Loss value as 1 and 1520 fall in between 1500-2000 will output Loss 2. and so on till the end of the list. How should do this? Need help on this.
    Array 1                                                Array 2
    Freq                                              ​     Freq   Loss
    1000                                              ​    1000      1
    1024                                              ​    1500      2
    1048                                              ​    2000      3
    1100                                              ​     :
    1200                                              ​     :
    :                                                 ​        18000
    1520
    18000

  • The table for storing data for infocube and ODS

    Hi all:
        could you please tell me how to find the table for storing data for infocube and ODS?
    thank you very much!

    Hi Jingying Sony,
    To find tables for any infoprvider go to SE11.
    In database table field enter the following
    Cube -
    Has fact table and dimension table
    For customized cube - ie cube names not starting with ' 0 '
    Uncompressed Fact table - /BIC/F<infocubename>
    Compressed fact table - /BIC/E<infocubename>
    Dimension table - /BIC/D<infocubename>
    For standard cube - ie cube names  starting with ' 0 '
    Uncompressed Fact table - /BI0/F<infocubename>
    Compressed fact table - /BI0/E<infocubename>
    Dimension table - /BI0/D<infocubename>
    Click on display.
    For DSO,
    For standard DSO active table- /BI0/A<DSO name>00.
    You use 40 for new table.
    Click on display.
    For customized DSO use- /BIC/A<DSO name>00.
    An easier way is in the database table field, write the name of the cube/DSO preceeded and followed by ' * ' sign. Then press F4 . It shall give you the names of the available table for that info provider.
    Double click on the name and choose display.
    Hope this helps,
    Best regards,
    Sunmit.

  • Problem storing date in MS Access using JSP

    Hi all,
    Can anyone please help me storing date in MS Access using Java i am getting errors. I think it is probably because MS Access take "date/month". I am entering a string with date and month example
    1st October as "0110". I don't know how to enter a date in MS Access.
    Here is my code.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@page import="java.io.*"%>
    <%@page import="java.sql.*"%>
    <HTML>
    <HEAD>
    <TITLE>  </TITLE>
    </HEAD>
    <BODY>
    <%
       String emplno = request.getParameter("emplno");
       String date = request.getParameter("date");
       String proposal = request.getParameter("proposals");
       String network1 = request.getParameter("network");
       String suppassociates = request.getParameter("suppasso");
       String intmngt = request.getParameter("intmgt");
       String client[] = request.getParameterValues("client");
       String client1= request.getParameter("client1");
       String clientunit[] = request.getParameterValues("clientunit");
       String clientunit1=request.getParameter("clientunit1");
       int staffid = Integer.parseInt(emplno);
       double proposalunit=Double.parseDouble(proposal);
       double suppliersunit=Double.parseDouble(suppassociates);
       double networkunit=Double.parseDouble(network1);
       double internalmgtunit=Double.parseDouble(intmngt);
       Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
       Connection con = DriverManager.getConnection("jdbc:odbc:finalmp" );
       String activities= "INSERT INTO StaffActivities (StaffID,Date,ProposalUnit,NetworkingUnit,SuppliersAssociatesUnit,InternalMGTUnit) VALUES (?,?,?,?,?,?)";
       PreparedStatement pstmt = con.prepareStatement(activities);
       pstmt.setInt(1,staffid);
       pstmt.setString(2,date);
       pstmt.setDouble(3,proposalunit);
       pstmt.setDouble(4,suppliersunit);
       pstmt.setDouble(5,networkunit);
       pstmt.setDouble(6,internammgtunit);
       pstmt.executeUpdate();
       //String emplno="hello";
       //String entered_date="hello";
       //int access_date=0;
       //int user_date=0;
       if(pstmt!=null)
         pstmt.close();
       if(con!=null)
         con.close();
    %>  
    </BODY>
    </HTML>

    i hope this can help you
    public static String convertToISOFormat(Date dateTime) {
            // ISO Format: 'YYYY-MM-DD HH:MM:SS'
            String returnValue = fillLeft(String.valueOf(dateTime.getYear()+1900), 4,
                    '0')
                    + "-"
                    + fillLeft(String.valueOf(dateTime.getMonth()+1), 2, '0')
                    + "-"
                    + fillLeft(String.valueOf(dateTime.getDate()), 2, '0')
                    + " "
                    + fillLeft(String.valueOf(dateTime.getHours()), 2, '0')
                    + ":"
                    + fillLeft(String.valueOf(dateTime.getMinutes()), 2, '0')
                    + ":" + fillLeft(String.valueOf(dateTime.getSeconds()), 2, '0');
            return returnValue;
        }

  • Error extracting data from essbase cube using MDX method

    Hi,
    We have some problems extracting data from essbase cube using MDX method, we believe that the problem is the MDX query, this is the problem and query:
    ERROR:
    [DwgCmdExecutionThread]: Cannot perform cube view operation. Analytic Server Error(1260046): Unknown Member SELECTNON used in query
    com.hyperion.odi.essbase.ODIEssbaseException: Cannot perform cube view operation. Analytic Server Error(1260046): Unknown Member SELECTNON used in query
         at com.hyperion.odi.essbase.wrapper.EssbaseMdxDataIterator.init(Unknown Source)
    MDX:
    SELECT
    NON EMPTY {[YearTotal].[Jan]} ON COLUMNS,
    NON EMPTY {[Total Movimientos].[Presupuesto Base]} ON AXIS(1),
    NON EMPTY {[Año].[FY11]} ON AXIS(2),
    NON EMPTY {[Escenario].[Presupuesto_1]} ON AXIS(3),
    NON EMPTY {[Version].[Trabajo]} ON AXIS(4),
    NON EMPTY {[Moneda].[Moneda Input]} ON AXIS(5),
    NON EMPTY {[Centros de Costo].[1101]} ON AXIS(6),
    NON EMPTY {Descendants([Resultado Operacional],4)} ON AXIS(7)
    FROM [DSR02].[ROP]
    We try extract data using a sample cube and work fine, this is the mdx query:
    SELECT
    {[Actual],[Budget]} ON COLUMNS,
    {[Sales]} ON ROWS,
    NON EMPTY {[Product].levels(0).members} ON PAGES,
    NON EMPTY {[East].levels(0).members} ON AXIS(3),
    NON EMPTY {[Year].levels(0).members} ON AXIS(4)
    FROM Sample.Basic
    The model reversed ([DSR02].[ROP]) have the same structure than query need, the query and the model are fine, definitely we can´t see the problem, someone can help us?
    Regards

    You will be able to test the MDX query in EAS, it is usually best to test the query first before trying to use it in ODI.
    Is there any reason you are using MDX to extract the data, have you tried reportscript as I usually find it more efficient to extract the data.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Inserting Records in an Array and using a constructor with it

    I badly need help on this! Please please please! I have been studying java for a short time only.
    Anyway, here goes: My project requires the following:
    Employee inputs the no. of video in the shelf. They have four classifications: Drama, Comedy, Action, and Thriller. Each video classification has different rates. The employee creates a video record containing the following information: 1. video ID number, 2. video classification, and 3. Price.
    The employee should display the classifications of videos available and the price. Only the available video tapes would be displayed according to the customer's chosen classification. When the customer chooses the video he wants to rent, the program will register and attach the name of the customer to the video number.
    I only need to use arrays, and NOT database to record the information.

    is it ok i i declare the drama_rate outside the video class?
    i have a list of variables on my videoupdate classYes. It's probably best to declare it static & then you can access it directly:
    public static float drama_rate = 100.0;
    rate = <the class name>.drama_rate;
    so, i should also include a customer no. both in the video and customer class.I would. You may want to list a bunch of videos and who currently has them. This way you don't have to search the customers AND the videos to do this.
    thanks =) i don't know either why we had to validate/invalidate,\
    but our applet doesnt refresh when >it is supposed to, so
    we just used this method. It wouldnt slow down the application, would it?Could you just revalidate()?
    the use of arrays. i havent finished with the program yet.
    i have the design already, i just couldnt put it in code.
    im not familiar with the use of multidimensional arrays-
    can i use this for the video and customer records i will need to store?Not sure what you're using arrays for, but here's an example of something I might do. Maybe it will be useful to you.
    Have you looked at HashMaps? You could use "Customer" as the key and then use an ArrayList of checked out Videos as the value:
    HashMap customers = new HashMap();
    ArrayList videos = new ArrayList();
    //Add the checked out videos to the list
    videos.add(video);
    <etc>
    // Add this customer and the list of videos he has checked out.
    customers.put(customer,videos);
    [\code]

  • Javascript enabling and using JS methods on TextEdit component

    Hello Friends:
    I am working to display data using TableView component.
    In each row, one of the cell contains a group of radio
    buttons and an other cell contains TextEdit component.
    For an event on the group of radio buttons, the TextEdit
    should flip editable to non-editable and vice-versa.
    I am using the TextEdit attribute method,
    <b>setJsObjectNeeded(true)</b>
    to expose the JavaScript methods of the component.
    I am using the following bits of code for accessing the
    TextEdit JavaScript functionality.
    var funcName = htmlb_formid+"_getHtmlbElementId";
    func = window[funcName];
    var text_edit_comp = eval(func(id_of_textedit));
    <b>text_edit_comp.setEnabled()</b>;
    Whole thing works as planned, but it is not possible to
    disable or enable the TextEdit component using the
    JavaScript, as shown above.
    In the portal documentation, the JavaScript object
    methods were mentioned only for certain components, NOT
    including TextEdit !!
    If I replace TextEdit with InputField, it works perfectly
    as like needed.
    How to hack it to work for TextEdit ?
    Thank you very much for your kind answers.
    Prasad Nutalapati

    I did use the suggestion. No use.
    When I say,
    var textedit = eval(func("<id-of-the-textedit-from-java"));
    I am getting the object reference.
    When I say,
    <b>var id = textedit.id;
    var elem = document.getElementById(id);</b>
    I am getting the HTML name/id and object of the text edit.
    Now when I use JS methods and properties,
    alert("type="+elem.type);
    alert("name="+elem.name);
    I get them back correctly.
    Then when I say,
    <b>alert("disable ?"+ document.forms[0].elements[elem.name].disabled;</b>
    I am getting answer as 'false' which is not correct. It
    is initially disabled, when I defined with Java.
    And subsequently, when I say,
    <b>document.forms[0].elements[elem.name].disabled = false;</b>
    It didn't affect it at all.
    If I try to use the JS methods provided by Portal, like..
    <b>textedit.setEnabled();</b>
    It is giving an JS error saying that the object doesn't
    have that method.

  • Hello! How to make new folders on I pad 2 .download data from net and use it offline also .

    I do not known how to make folders in I pad 2 and use them offline2.i am using this I pad 2 for the first time. I have used windows for years and is quite comfortable with windows

    Just drag one app on top of another. Here's an article about it:
    http://www.macworld.com/article/160291/2011/06/create_organize_ios_folders.html

  • Storing data in Array or StringBuffer and then comparing it to a string

    I want to store some data in a list or an Array (but apparently an Array only holds 10 items?) and then I want to be able to check if myString is equal to any of the posts in the array/list.
    Or if I use a StringBuffer I want to check to see if myString is part of the StringBuffer?
    How do I do this?
    / Elin

    I want to store some data in a list or an Array (but
    apparently an Array only holds 10 items?)Uh, no. Arrays can (theoretically) contain Integer.MAX_VALUE elements.
    and then I want to be able to check if myString is equal to any
    of the posts in the array/list.Don't confuse String's equals() method with the equality operator '=='. The == operator checks that two references refer to the same object. If you want to compare the contents of Strings (whether two strings contain the same character sequence), use equals(), e.g. if (str1.equals(str2))...
    Example:String s1 = "foo";
    String s2 = new String("foo");
    System.out.println("s1 == s2: " + (s1 == s2)); // false
    System.out.println("s1.equals(s2): " + (s1.equals(s2))); // trueFor more information, check out Comparison operators: equals() versus ==
    Or if I use a StringBuffer I want to check to see if
    myString is part of the StringBuffer?See above discussion on .equals().
    How do I do this?
    Here are some other resources to help you get started with Java.
    The Java&#153; Tutorial - A practical guide for programmers
    Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program
    New to Java Center
    How To Think Like A Computer Scientist
    Introduction to Computer Science using Java
    The Java Developers Almanac 1.4
    JavaRanch: a friendly place for Java greenhorns
    jGuru
    Bruce Eckel's Thinking in Java
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java

  • Limiting arrays and using lindex in regexp commands

    Hello there,
    Here's my second and extremely crap question/post with regards to EEM/TCL.  I've been doing some googling and haven't really been able to find an answer to these questions.  Probably more due to my lack of skill with the search bar than the information just not being out there.  Hope you'll forgive me though.
    1.     My first question is this.  Say I want to get some output from a command.  I'd like to see all the interfaces in the "show ip vrf interface command" for example.  Not knowing how many interfaces there might be, there could be 10 or there could be 200, what's the best way of limiting a loop function after I have issued the following commands?
    set _vrf_int [exec show ip vrf interface]
    set _array_vrf_int [split $_vrf_int "\n"]
    set $i 0
    while {$i < 200} {
      regexp {([A-Z]+[a-z]+[0-9]+).*} [lindex $_array_vrf_int $i] _complete_string _int
      inc $i 1
    Not 100% sure the syntax is correct, sorry.  If I only have 10 interfaces then there isn't going to be a need to issue this loop 200 times for "$_array_vrf_int".  It also wouldn't be great if I went over 200 interfaces.  Is there a way I can limit this loop based on the number of lines that were captured after the split function?
    2.    The value of the regexp above is output to the var $_int.  Is there a way I can output the regexp to an array? a'la:-
    regexp {([A-Z]+[a-z]+[0-9]+).*} [lindex $_array_vrf_int $i] _complete_string [lindex $_int $i]
    Syntax there definitely isn't correct but I guess there might be a way to do this.  Any thoughts?
    3.     I've been doing some comparisons on some output to see if an access-list is present on an interface.  I can get a regexp to pull back the name of the access-list on a particular interface but if no access-list exists can I do an if statement on nothing?
    set _acl_name 0
    regexp {.*ip access-group (.*) in} $_running_int _complete_string _acl_name
    if {$_acl_name != 0} {puts "there is a access-list on $_int"} else {puts "there's no acl on $_int :-("}
    In the output above I'm setting the value of "$_acl_name" to zero so that I can compare it in the if statement.  This seems like a crap newbie way to do it though.  Is there some kind of wildcard I can put in place of the "0" to match an empty variable. a'la {null}.
    4.     Sorry last question.  Can I also reset the variable to {null} using a similar wildcard.  Again I can reset the variable to 0 but it just seems like I don't understand the syntax well enough and there is probably a better method.
    5.     I've read several tutorials that cover alot of the basics.  Is there a good reference anyone can suggest so I don't waste any more of your time with these silly questions?  I'm afraid the scripts I've studied on this forum are still way over my head.
    Many thanks in advance
    Alex

    Hi Joseph,
    Thanks again for all your help.  Sorry it's taken a while to respond.  If I'm honest, you'd cooked me with your response and I wanted to give your reply some decent time to digest and gain some level of understanding.  It's been a few years since I was 17, learning pascal and I'm finding the whole tcl scripting particularly hard to get my head around.  After the third level of if/for/foreach with nested split commands etc my brain seems to lose the plot.  Never the less I shall persist.
    Using the information you've kindly provided I've since got a nice tclsh only script that will look through a routers vrf interfaces, pick out the ones that have a particular vrf, check each one for an inbound access-list, confirm the access-list meets certain criterial based on a switch/regexp function and finally report on lines that shouldn't be there or are missing all together.  The "unset" command wasn't useful in this scenario unfortunately.  It seems to explicitly delete the variable together and so I can't check if it's empty or not.  I've instead resorted to setting the list variable I was using to 0 for all entries before with the switch function that if matched sets an individual entry to 1 before they are checked at the end to ensure they were all matched. I'm sure it's not the most elegant script in the world and due to the extensive use of the "exec" command, I couldn't actually use it.  Still I'm getting there, abiet very slowly.  The hours that I've spent playing with tcl are certainly racking up now.  I just hope my knowledge is too.
    Thanks for the suggestion on the book.  I checked and it is indeed the one I purchased 2 years ago when my interest in eem was first captured.  It's unfortunately very thick and slightly scary!  It also doesn't have any examples of combining switch/regexp functions together, which is a bit annoying considering that's the first thing I've tried to use it for.  Hopefully I'll find it very useful as my understanding gets alittle greater though.
    Anyway, thank you again for your extremely helpful responses.  Until the next stupid question!
    Kind regards
    Alex

  • Problem after storing data in Storage and trying to read it

    Hi all,
    I have a problem with reading the data from a Storage file I created. The code folows:
    public var storage: Storage;
    public var prop: Property;
    public var props: Property[];
    var initialized: Boolean = false;
    public function initiliazeDatabase(): Boolean {
    storage = Storage {
    source: "test.db"
    var resource: Resource = storage.resource;
    var inputStream: InputStream = resource.openInputStream();
    readData(inputStream);
    println("Initilatization done!!!");
    println("size: {sizeof props}");
    return initialized;
    function initStorage() {
    println("Initializing Storage…");
    var out = storage.resource.openOutputStream(true);
    var dummyRoot = "<prop></prop>\n";
    out.write(dummyRoot.getBytes());
    out.close();
    initialized = true;
    function parseCallback(e: Event) {
    if (e.type == PullParser.START_ELEMENT) {
    if (e.qname.name == "prop" and e.level == 0) {
    prop = Property { };
    } else if (e.type == PullParser.END_ELEMENT) {
    if (e.qname.name == "prop" and e.level == 0) {
    insert prop into props;
    } else if (e.type == PullParser.TEXT) {
    if (e.qname.name == "name" and e.level == 1) {
    prop.name = e.text;
    if (e.qname.name == "value" and e.level == 1) {
    prop.value = e.text;
    public function addProp(name: String, value: String): Void {
    prop = Property {
    name: name;
    value: value;
    insert prop into props;
    public function storeData(): Void {
    var out = storage.resource.openOutputStream(false);
    for (prop in props) {
    out.write(prop.toXml().getBytes());
    out.close();
    public function readData(inn: InputStream): Void {
    var parser = PullParser {
    input: inn;
    onEvent: parseCallback;
    try {
    parser.parse();
    initialized = true;
    } catch (npe: NullPointerException) {
    initStorage();
    Now, for the first time, the app works as it should, the Storage is initialized (if it does not exist) and the required fields are stored in it when I need to.
    However, the next time I start the application I get the following error:
    Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javafx.runtime.provider.GUIRuntimeProvider$1.run(GUIRuntimeProvider.java:65)
    at com.sun.javafx.tk.swing.SwingToolkit$StartupRoutine.run(SwingToolkit.fx:582)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: com.sun.javafx.data.pull.impl.StreamException: [20,1] Syntax Error in prop
    at com.sun.javafx.data.pull.ukit.xml.ParserStAX.panic(ParserStAX.java:1516)
    at com.sun.javafx.data.pull.ukit.xml.ParserStAX.next(ParserStAX.java:400)
    at javafx.data.pull.PullParser.next(PullParser.fx:319)
    at javafx.data.pull.PullParser.parse(PullParser.fx:258)
    at com.gpsbuddy.utils.DatabaseUtils.readData(DatabaseUtils.fx:86)
    at com.gpsbuddy.utils.DatabaseUtils.readData(DatabaseUtils.fx:86)
    at com.gpsbuddy.utils.DatabaseUtils.initiliazeDatabase(DatabaseUtils.fx:30)
    at com.gpsbuddy.utils.DatabaseUtils.initiliazeDatabase(DatabaseUtils.fx:30)
    at com.gpsbuddy.main.Main.<clinit>(Main.fx:21)
    at com.gpsbuddy.main.Main.<clinit>(Main.fx:21)
    I did check the muffin file and it has no errors in it...
    Thanks in andvance...

    Well, as it appears, the second part of the exception was right.. :P... I do have problem with the XML file.. for some reason I cannot have two <prop> tags in one document?
    For example, if I have <prop></prop>, the program start ok... but when a new prop is added, for example, <prop></prop><prop></prop>, I get the error from the previous post?
    Does anybody know anything about this? Could this be an error in the parser, or I am missing something?
    Edited by: jonycus1 on Feb 25, 2010 3:10 PM

  • Master data upload via LSMW using IDoc method

    Dear all,
    I know this has been a topic of many discussions but I would like to ask you is to share your thoughts and possibly experience with the following scenario:
    Interface between non-SAP system and SAP system has to be built whereby master data gets created in the non-SAP system and has to be uploaded into SAP. This is a process that needs to be performed on a constant basis and hence my question: is there a way that the MD upload takes place in the background via LSMW with IDoc? Or any other way, for instance, with a flat file, etc.?
    Thank you very much for your input!
    Regards,
    Miro

    Miro - It depends upon many factors
    1. Number of source systems
    2. Volumn of recorsds ( Data to be loaded)
    3. Transformation needed or not needed from S to D ( source to destination), We may consider it as
        business rules/mapping
    Based on above you may segrigate the objects related to data, eventually you can shoose approach of loading in SAP,
    As if straigt forward load for some 20k-30K records ( Just a file load on regular basis), one to one mapping then go for LSMW, if some complex transformation logic needed then go SAP data services implementation. best part here is if you multiple sources that can be handeled here.
    Accordingly you can proceed ...
    Hope it helps.
    Best !
    Deep

  • Pass a variable name to a subroutine and use a method on it...

    How do I pass a variable name to a subroutine and then call a method on it?
    I have several swing text fields in a JForm. When someone enters a string in any of these fields, I want to check whether it is a number and, if now, clear that individual field and display a popup warning.
    So, I want to do something like....
    String stringcheck(String str, sometype variablename) {
            try {
                Integer.parseInt(str);
            } catch (NumberFormatException e) {
                JOptionPane.showMessageDialog(jPanel2, "These fields must be integer numbers.");
                variablename.setText("");
    }

    prometheuzz wrote:
    tsith wrote:
    prometheuzz wrote:
    NickSchurch wrote:
    thanks prometheuzz. I'm returning a string cos there are some other parts to the subroutine.Ah, now I understand.
    Well, good to hear you found a solution to it.You know, you really should have seen that from post 1.
    No offense, but seriously - does he have to draw you a picture?!
    I probably wouldn't understand the picture either: I'm not much of an art critic. Unless the OP is [Bob Ross|http://www.bobross.com/], his paintings, I understand.
    "I'm returning a string 'cos there's a happy tree over there, and I think I'll put a happy rock right here"

  • Importing new package and use its methods...?

    Hi,
    i have curl package. I need to include its methods in my pgm. So how can I use that package.? Since i am new to java from Php.so can any one help me......?
    Thanks in Advance...........

    Look what Google found:
    http://www.jarticles.com/package/package_eng.html
    Also make sure that the library is in your classpath.
    You also might want to learn the java basics first, before doing anything else.

  • Fetching data using the method query

    Hi experts
    Using the class /scmtms/if_lcp and using the method query, how to fetch the data from the business objects.
    my requirement is i need to fetch the data from the BO /SCMTMS/FRIEGHTORDER and  /SCMTMS/SHIPMENTREQUEST.
    If any one can send the sample code for this, it will be very usefull for me.
    Thanks in advance
    sai
    Edited by: sai sai on Jun 17, 2009 5:21 PM

    report  z_fo_read.
    data:
      lr_fro        type ref to /scmtms/if_lcp,
      lr_lcp_transaction type ref to /scmtms/if_lcp_transaction.
    * step 1
    lr_lcp_transaction = /scmtms/cl_lcp_factory_adapter=>get_lcp_transaction_handler( ).
    * Schritt 2:
    lr_fro = lr_lcp_transaction->/scmtms/if_lcp_facade~get_lcp( in_bo_name = /scmtms/if_freightorder=>co_bo_name ).
    constants: co_do_prefix_root_tpcharges type string value 'TRANSPORTCHARGES.ROOT'.
    * Schritt 3:
    data:
      ls_params        type /scmtms/s_srq_rt_a_block value is initial,
      ls_root_data     type /scmtms/if_freightorder=>ty_root,
      ls_selection     type /scmtms/s_selection_parameter,
      lt_out_messages  type /scmtms/if_srvmgr_types=>ty_messages,
      lt_out_node_ids  type /scmtms/t_bo_node_id,
      lt_root_data     type /scmtms/if_freightorder=>tt_root,
      lt_items_data    type /scmtms/if_freightorder=>tt_transportchargesinfo,
      ls_items_data    type /scmtms/if_freightorder=>ty_transportchargesinfo,
      lt_selections    type /scmtms/t_selection_parameters,
      lv_action_name   type string,
    *     Notification structure
      ls_change_notifications type /scmtms/if_srvmgr_types=>ty_change_notifications.
    * A) Root-ID des SRQ holen, der ge-/entsperrt werden soll:
    ls_selection-attribute_name = /scmtms/if_freightorder=>co_attr-root-for_id. " ID.
    ls_selection-sign   = 'I'.
    ls_selection-option = 'EQ'.
    ls_selection-low    = '00000000000000000000000000000000800'.
    *ls_selection-high   = '00000000000000000000000000000000427'.
    append ls_selection to lt_selections.
    call method lr_fro->query
      exporting
        in_bo_node_name         = /scmtms/if_freightorder=>co_bo_node-root
        in_query_name           = /scmtms/if_freightorder=>co_query-root-root
        in_selection_parameters = lt_selections
      importing
        out_node_ids    = lt_out_node_ids
        out_messages    = lt_out_messages.
    * B) Daten holen:
    call method lr_fro->retrieve
      exporting
        in_bo_node_name        = /scmtms/if_freightorder=>co_bo_node-root
        in_node_ids            = lt_out_node_ids
      importing
        out_data               = lt_root_data
        out_messages           = lt_out_messages.
    read table lt_root_data into ls_root_data index 1.
    The above code is a snippet, extract useful information for you.

Maybe you are looking for