473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Swing GUI application with strings using split method

1
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 restoreStringButton 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 restoreStringButton is clicked, the string is restored to the original
Sep 29 '06 #1
0 1270

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Hank | last post by:
Please help me diagnose the following problem. I have a Swing program (running under 1.4.2_04) that uses JNI to get some hardware-level information and return that info as a csv String. The...
0
by: Ney André de Mello Zunino | last post by:
Hello. I have decided to look again at Java after a *really* long break. While browsing through the Swing tutorials , I noticed that the basic skeleton of the demo applications had something...
4
by: Sky | last post by:
Hi. Coming from PHP where all things are strings, the char is a bit hard to get used to. So far, I'm not really sure what the dif/use is between a string and a char array...except notation, and...
10
by: VM | last post by:
How can I limit the use of the PC's virtual memory? I'm running a process that basically takes a txt file and loads it to a datatable. The problem is that the file is over 400,000 lines long (77...
3
by: Daniel Weinand | last post by:
hello ng, i have a problem and a imho an insufficient method of solution. strings should be sorted by specific text pattern and dispayed in groups. the strings are stored in a db and have the...
4
by: r035198x | last post by:
Breaking up a string Instead of using the old StringTokenizer class, a simple trick is to use the String.split method. String string = "This is a string"; String tokens = string.split("...
3
by: RobcPettit | last post by:
Hi, Ive written my application and published it. Leaving the editor open, I install my newly made application and run it. Works perfect, then I open it a second time so Ive got two instances of the...
6
by: r035198x | last post by:
I have put together this article to give people starting Swing an awareness of issues that need to be considered when creating a Swing application. Most of the Swing tutorials that I have seen just...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.