Results 1 to 13 of 13
  1. #1
    RanLineR Guest

    Default Can someone give a sample for JOption with 2 strings?

    need some examples to experiment on.thanks by the way

  2. #2
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    What do you mean by 2 strings, you want to have 2 input boxes in the same JOptionPane?
    Sincerely, Joshua Green
    Please REP if I help :)

  3. #3
    RanLineR Guest

    Default

    hmm i mean

    like this

    int = a, b result= 0;
    double = c result =0;
    then
    String str1,str2;

    is that right?

  4. #4
    RanLineR Guest

    Default

    hmm i mean

    like this

    int = a, b result= 0;
    double = c result =0;
    then
    String str1,str2;

    is that right?

  5. #5
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    First of all you are declaring variables wrong. To declare integers you must declare them like this:

    Java Code:
    int a, b, result = 0;

    This will create 3 variables. 'a' and 'b' which have no values assigned and 'result' which is given the value of 0. Do this also with your double variables. The strings you have correct, but I'm wondering why you asked about JOption?

    I'm sorry if I'm not fully understanding your question. What are you trying to do exactly? What is the program?
    Sincerely, Joshua Green
    Please REP if I help :)

  6. #6
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    The values work fine for me, are you having trouble doing the calculations for output?
    Sincerely, Joshua Green
    Please REP if I help :)

  7. #7
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    Take a look through this: Examples of java.lang.Math Methods

    It has examples of the Math Functions and it has everything you need to complete your program.
    Sincerely, Joshua Green
    Please REP if I help :)

  8. #8
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    No problem, and good luck!
    Sincerely, Joshua Green
    Please REP if I help :)

  9. #9
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    One new thread for every little question?
    Example of JOption

    What's the next? let me quess
    Can someone give a sample for JOption with 3 strings?

    db

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,776
    Blog Entries
    7
    Rep Power
    21

    Default

    The OP should read the API documentation for that class; it's all in there. The OP has polluted this forum more than enough with repetative questions about this class without showing any effort (nor creativity) to solve the 'problems' (mind the quotes). I'd say back to the API documentation.

    kind regards,

    Jos

  11. #11
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    What do you need to do with the strings? Compare them to each other?
    Sincerely, Joshua Green
    Please REP if I help :)

  12. #12
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    I know, but what if the first string is not equivalent to the second string? Should it output something like... "String1 is not equal to String2"? Or are there no specific directions?
    Sincerely, Joshua Green
    Please REP if I help :)

  13. #13
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    So doing something like this would be okay then? You just would use the strings like any other variable.

    Java Code:
    System.out.print(str1 + " is Equivalent to " + str2);
    Sincerely, Joshua Green
    Please REP if I help :)

Similar Threads

  1. Example of JOption
    By RanLineR in forum New To Java
    Replies: 4
    Last Post: 10-20-2010, 01:27 PM
  2. JOption pop up window is behind all other windows
    By biggmann in forum New To Java
    Replies: 3
    Last Post: 10-15-2010, 09:24 PM
  3. JOption Msgbox title help?
    By ZaabZ in forum New To Java
    Replies: 7
    Last Post: 08-26-2010, 10:12 PM
  4. Replies: 1
    Last Post: 12-02-2009, 04:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •