Putting 2 strings together
Dear Colleagues
I have a short piece of coding I would hope for some advice on.
public class ReadTest {
public static String readString() throws java.io.IOException {
java.io.BufferedReader in =
new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
return in.readLine();
public static void main(String args[]) {
try {
System.out.println("Enter a string: ");
String inputValue = ReadTest.readString();
System.out.println("You entered: " + inputValue);
} catch (java.io.IOException e) {
System.out.println("An error occurred!");
I have compiled this and was invited on the DOS screen to:"Enter a string". But where do I enter the string?
Then I need to modify the program a little to read two strings and to ensure that the first string ends with the second string. Do I then take it that once I have grasped the fundamentals of joing 2 strings together, that that is the normal rule?
Hopefully, I will begin to understand the code with some help here.
Best wishes
Quetzal1
println isnot for user input try the following
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
class KeyView extends JFrame implements KeyListener {
JTextField keyText = new JTextField(80);
JLabel keyLabel = new JLabel("Press any key in the text field.");
KeyView() {
super("KeyView");
setSize(350, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
keyText.addKeyListener(this);
Container pane = getContentPane();
BorderLayout bord = new BorderLayout();
pane.add(keyLabel, BorderLayout.NORTH);
pane.add(keyText, BorderLayout.CENTER);
setContentPane(pane);
setVisible(true);
public void keyTyped(KeyEvent input) {
char key = input.getKeyChar();
keyLabel.setText("You pressed " + key);
public void keyPressed(KeyEvent txt) {
// do nothing
public void keyReleased(KeyEvent txt) {
// do nothing
public static void main(String[] arguments) {
KeyView frame = new KeyView();
Similar Messages
-
NEED HELP PUTTING MULTIPLE PAGES TOGETHER IN 1 PDF
HOW DO I PUT 10 PAGES TOGETHER TO OPEN IN 1 PDF?
Thanks Janelle - I do not have that ability with the Epson RX580. Epson just answered my tech support question with this answer:
I am sorry you are experiencing difficulties with your EPSON Stylus Photo RX580. Unfortunately this feature is not available with Mac OS X. You will need a third-party software that will help you with this, such as Poster Print for Mac or Tiler. Please note though that Epson does not support these applications.
So I guess my question becomes what software can I use to print my images on multiple pages. As I do large photo transfers I need to be able to do this with my mac in an efficient way and not try to cut portions of image into seperate print jobs that would be too time consuming. HAve you had any experience with other software. If not I guess the next question what printer would you recommend that would do this with my MAC. I have included a pic of one of my larger transfers on a cupboard. To do this I needed the image to be tiled on 8 different sheet of 8.5x11 so this is a feature I need through either software or a printer that is easy to use and easily accessible. Thanks Krista
I am inl -
okay so i recorded a song but each part comes out as like take 1, i have 10 takes. how can i put them all together as one take, to make one song all in one take not small pieces of a song. like i hit record and sang the entire song but when i hit play it was in pieces not just one song like it was in ten takes. is there any way i can blend it all into one take, to make one clear song?
You're not very clear in stating your problem. Maybe it's terminology: "takes" in recording lingo (and in GB lingo) are different version of exactly the same part in a song, so you only want one of them in the end. Please tell us exactly what you did and what it is that you don't like.
-
I had photos from MobileMe organized into different events. When iPhoto made a MobileMe event (when MobileMe ended), it took all of those photos out of the other events and put them all together in the new "from MobileMe" event. Is there any way to reverse this?
Only to load your backup from before downloading the MM photos
LN -
How to put a String into a byte array
How can i put a String into a byte array byte[]. So that i can send it to the serial port for output to an LCD display. Cheers David
javadocs for String
getBytes
public byte[] getBytes()
Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
Returns:
The resultant byte arraySince:
JDK1.1 -
How to put a string from one Frame to another Frame?
Dear all,
How can I put a String from one Frame to another Frame?
When the application started, the Frame 'WindowX' will be displayed. After you press the 'openButton', a whole new Frame (inputFrame) will be shown. In this Frame )(inputFrame) you can write a String in a TextField. After pressing the okButton, this String will be sent to the first Frame 'WindowX'.
But does anyone know how to realize the sending part?
I've tested this code on Win98 SE and JDK1.2.2.
Hope someone can help me. Thanks in advance.
import java.awt.*;
import java.awt.event.*;
public class WindowX extends Frame implements ActionListener, WindowListener
private Button openButton;
private TextField resultField;
public static void main(String [] args)
WindowX wx = new WindowX();
wx.setSize(300,100);
wx.setVisible(true);
public WindowX()
setLayout(new FlowLayout());
openButton=new Button("open");
add(openButton);
openButton.addActionListener(this);
resultField=new TextField(10);
add(resultField);
resultField.addActionListener(this);
addWindowListener(this);
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==openButton)
inputFrame ip=new inputFrame();
ip.setSize(200,80);
ip.show();
public void place(String theString) //this doesn't work
resultField.setText(theString);
public void windowClosing(WindowEvent event)
System.exit(0);
public void windowIconi......
class inputFrame extends Frame implements ActionListener,WindowListener
String theString = "";
Button okButton;
TextField inputField;
WindowX myWX=new WindowX(); //??
public inputFrame()
setLayout(new FlowLayout());
inputField=new TextField(10);
add(inputField);
inputField.addActionListener(this);
okButton=new Button("OK");
add(okButton);
okButton.addActionListener(this);
addWindowListener(this);
public static void main(String[] args)
Frame f = new Frame();
f.show();
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==okButton)
theString=inputField.getText();
myWX.place(theString); //??
dispose();
public void windowClosing(WindowEvent e) {
dispose();
public void windowIconi......
}Thanks for your reply!
But I got an other problem:
I can't refer to the object (wx) made from the main Frame 'WindowX', because it's initialized in 'public static void main(String [] args)'...
Hope you can help me again... Thanks!
import java.awt.*;
import java.awt.event.*;
public class WindowX extends Frame implements ActionListener, WindowListener
private Button openButton;
private TextField resultField;
public static void main(String [] args)
WindowX wx = new WindowX(); //!!
wx.setSize(300,100);
wx.setVisible(true);
public WindowX()
setLayout(new FlowLayout());
openButton=new Button("open");
add(openButton);
openButton.addActionListener(this);
resultField=new TextField(10);
add(resultField);
resultField.addActionListener(this);
addWindowListener(this);
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==openButton)
inputFrame ip=new inputFrame(wx);
ip.setSize(200,80);
ip.show();
public void place(String theString)
resultField.setText(theString);
public void windowClosing(WindowEvent event)
System.exit(0);
public void windowIconi....
class inputFrame extends Frame implements ActionListener,WindowListener
String theString = "";
Button okButton;
TextField inputField;
WindowX parent;
public inputFrame(WindowX parent)
setLayout(new FlowLayout());
this.parent=parent;
inputField=new TextField(10);
add(inputField);
inputField.addActionListener(this);
okButton=new Button("OK");
add(okButton);
okButton.addActionListener(this);
addWindowListener(this);
public static void main(String[] args)
Frame f = new Frame();
f.show();
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==okButton)
theString=inputField.getText();
parent.place(theString);
dispose();
public void windowClosing(WindowEvent e) {
dispose();
public void windowIconi..........
} -
I need to edit out parts of a song to cut it down to two minutes for my daughter's talent show. I went to info/start time and it will cut down one part but only one part. I need to put three parts together. I tried adding duplicates of the song to the list but if If I change the start time on one it will change it on all of them.
In your library, right-click the song you want to edit.
select "get info".
go to "options" and select the start and stop times for your first section of the song.
click "OK".
Find the shortened version of the song in your library. It may take a minute for it to show up. right click it again and select "create (????) version". (the ???? is different for different formats).
The library will spit out a new, second version of the song which you can rename. I suggest you use the original title and add a 1 to the end.
Now you can go back to the other version and repeat the process with a different start/stop time.
Once you are done editing, you can burn all of your versions to a disk, just make sure your interval time is zero so there are no gaps between edits.
To keep the orginal song on your library, just go back to the original and put the start/stop times back to the original settings. -
an error occurred uploading my iPhoto Book order. It puts the book together and starts to send but at the very last moment comes up with an error message. but checking the book in iPhoto there are no problems to be found.
This user talked to Apple Support personnel and confirms what Larry is suggesting:
crowland1066
Re: book upload fails
Nov 30, 2013 3:02 PM (in response to pablo123)
Just got off the phone with apple support. If the photo book completes the assembly process but fails during the upload process the problem is in their overloaded servers.They just started a free shipping promotion for the holidays which has increased the traffic dramatically. I bought a calendar a week ago and it went right through. I'm going to try again during less peak times.
Happy Holidays -
I Took apart a mac mini 2007 and i cant put it back together and a part holding the cmos battery broke offplease i need serius help
Yikes, see if anything here helps...
http://www.ifixit.com/Teardown/Mac-mini-Model-A1283-Teardown/659/1
And on yhe battery clip, do you suppose Super Glue would work? -
Some of my albums on itunes ave split, how do i put them back together?
some of my albums on itunes have split, how do I put them back together?
- Are the apps missing or are the icons white?
- If missing have yu tried using the Spotlight search and trying to find them?
- Have you tried downloading them on your iPad and then syncing?
- Have you tried deleting them on the computer and then syncing? That might also delete them from the iPad so you can redownal them
- Have you tried reetting the iPad?
Reset iPad: Press and hold the On/Off Sleep/Wake button and the Home
button at the same time for at least ten seconds, until the Apple logo appears. -
Question about putting video clips together
I am trying to put clips together in Premier Elements 12 using Windows 7 Professional. I keep getting an error message: "This thype of file is not supported or the required codec is not installed."
I admit that the clips are mostly jpeg and Flip video. I have installed the Flipshare software on the computer. What can I do to put these clips together? I saw an answer that mentioned exporting the BBB.prel Timeline to an appropriate file saved to the computer hard drive and then import that file into AAA.prel, using AAA.prel's Add Media/Files and Folder/Project Assets from where you drag the import to the Expert workspace Timeline to join the AAA.prel content already there.
But I don't know how to export, and what is an "appropriate file"?
Thanks.
Message was edited by: monkmaramonkmara
We need more information in order to resolve your issue.
Are you saying that you cannot import even .jpeg photos into your Premiere Elements 12 Windows project...and your Flip video as well?
a. Were these jpeg processed in Photoshop? Do you know if they have the CMYK color profile? What are their pixel dimensions (width and height in pixels)?
b. What is the brand/model/settings of the camera producing the Flip video?
With the above information we can get at the media and program compatibility issue(s) that might be triggering the message "This type of file is not supported or the required codec is not installed."
You say that you have installed "Flipshare software" to your computer. What do you intend to do with it? If you are thinking to use it to convert the problem files into another format that Premiere Elements will accept, we still need to know the properties of what you are working with and set Premiere Elements accordingly.
The concept of using content from one Premiere Elements project file into another Premiere Elements project file does not apply to the situation that you describe for your issue.
You need to describe what you have for media and then we can proceed from there.
The brand/model/settings for the camera that produced the Flip video is a good start.
MediaInfo and gspot are programs to get at the properties of your video. But the brand/model/settings information may be all that we need.
http://sourceforge.net/projects/mediainfo/
http://www.headbands.com/gspot/
Please review and consider and then we can decide what next.
Thank you.
ATR -
I put video clips together and added music off of iTunes
but it will not attach when I put it on youtube or vimeo.
what is wrong. It plays as I made it on iMovieThank you all for your replies. Here is what i ended up doing. I cannot afford any 3rd party software so i went to itunes and manually entered all my playlists. As I had indicated my purchased music was on my new computer just not the playlists and I could not sync my ipod. After I rebuilt all my playlists I tried to restore my ipod to factory defaults/new. All of the steps called for in apple support and elsewhere were not available to me. I connected my ipod, went to my computer, right clicked my ipod, and formatted. That wiped my ipod so when I connected to itunes it then gave me a restore option. I did the restore and all is good in the empire again. I can now buy new music and sync my ipod so I am a happy camper.
Thanks to all. -
Can I string together multiple iPad videos to make a DVD?
Can I string together multiple iPad videos to make a DVD ?
Not on the ipad itself.
You need a computer with the appropriate software. -
TreeMap.put(Date, String) throws ClassCastException
Hello World!
i have a problem with TreeMap,
when i try to put a Key-Object and an Object-Object
i get ClassCastException. WHY??
Code:
Date date = GregorianCalendar.getTime();
TreeMap tm = new TreeMap();
tm.put(date, new String("My String"));
By puting into the tree i get the damn exception.
Any ideas?
thank,
SergejHello World!
i have a problem with TreeMap,
when i try to put a Key-Object and an Object-Object
i get ClassCastException. WHY??
Code:
Date date = GregorianCalendar.getTime();
TreeMap tm = new TreeMap();
tm.put(date, new String("My String"));
By puting into the tree i get the damn exception.
Any ideas?
thank,
SergejHi, doing the
new String("My String")
is not really a good idea.
One rather useless string instance is created.
just put the string literal put (..., "My String");
Just had to make this comment, no offence.
Regards,
Stepan -
Does iphoto's ibook not ship internationally? I am currently in Hong Kong and have just put a book together that I would like to buy. ibook not letting me put in international address and shipping info seems to suggest US only. I find this hard to believe. The Apple Store in Hong Kong is the size of Manhattan. Well almost!
Don't forget (from Payment & Pricing - Apple Store (HongKong)):
Credit cards accepted
Apple is unable to accept credit, debit, or check associated with a billing address outside of Hong Kong.
Not only do you need to select the Hong Kong Print Store but use a credit card with a Hong Kong billing address.
Happy Holidays
Maybe you are looking for
-
Video no longer works on iPad. My videos, you tube, Netflix, news casts, nothing works.
-
I have tried to watch programmes on ITV player, which I have successfully done in the past, but now it tells me it cannot find the video and that I need to turn off ad blocking on my computer. I went into options, but could not find anything about ad
-
Using bracket wildcards in collections
I'm setting up a collection based on an IP range of 10.18.16.x through 10.18.21.x and am having a time figuring out the proper usage for bracket wildcards. Below is my criteria: SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPAddress like "10.18.1[6-9].
-
U44M1P7 error fix without re-installing? Help please...
I just bought a new iMac and migrated all my stuff from the old machine. I've spent hours re-entering passwords etc. to get my 3d party plugins going. Now, after trying to simply upgrade Photoshop I get this error and I'm told to uninstall then re-in
-
Are there colors that will not go transparent with .gif
I am creating a .gif file with one color transparent. It is a dark yellow. For some reason, it will not go transparent when saving for web. When I select it and click transparent, another color will go transparent. I have fideled with all of the .gif