Swing GUI application with strings using split method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kdub
    New Member
    • Sep 2006
    • 1

    #1

    Swing GUI application with strings using split method

    Hi all,
    I've wrote my code to where I have my string "I live for Java, no really" showing along with my 2 buttons labeled "Cut String" and "Restore String", but I'm having trouble with the functionality part of it. Meaning getting it to separate when I click "Cut String" and come back together when I click "Restore String" based on the requirements below. HELP! HELP! Any suggestions?


    1. Add 2 buttons called cutStringButton and restoreStringBu tton in the window panel.
    2. Draw an arbitrary string at location 100,100. The string has only 1 comma.
    (For example “Welcome to Dallas, enjoy your stay”)
    3. When cutStringButton is clicked, the string above is cut to 2 parts, separated by the comma. (Comma is not included in the separated strings). The first part is printed at location (100,100), and the second part is printed at location (100,120).
    (Hint, you should use indexOf() find the location of the comma.)
    4. When restoreStringBu tton is clicked, the string is restored to the original
Working...