Changing text already printed to the console

I've been programming as a hobby for years, but this question belongs nowhere else...
I've used several console-interface programs that can change text that it has already printed; for instance, "Loading item ____ of 2642". Is there any way to do that in Java?

ryanthejuggler wrote:
I've been programming as a hobby for years, but this question belongs nowhere else...
I've used several console-interface programs that can change text that it has already printed; for instance, "Loading item ____ of 2642". Is there any way to do that in Java?It depends on the capabilities of your console (think of a paper console, it can't change anything that is already printed). Try to google for "jcurses", it can handle those things for most consoles. A poor man's solution goes like this:
System.out.print("foo 1\rbar 2");If you see "bar 2" your console can print simple carriage return characters and you can use that to change lines of text.
kind regards,
Jos

Similar Messages

  • My program isn't printing to the console.....

    Hi I'm new to the forums and Java. I'm trying to get my program to print to the console but nothing prints when I run it. There isn't any errors displaying so I'm guessing there is a problem with the syntax of my constructor. Did I write the methods incorrectly to where my System.out.print isn't getting the data from the rest of my program?
    public class Stock {
         public static void main(String[] args) {
         public Stock() {
         public Stock(String symbol, String name){
         public String getSymbol(){
              return "ESI";
         public String getName(){
              return "ITT Technical Institute";
         public double getPreviousClosingPrice(){
              return 60.0;
         public double getCurrentPrice(){
              return 65.0;
         public void setSymbol(String symbol){
              System.out.print("Symbol: "+ symbol);
         public void setName(String name){
              System.out.print("Name: "+ name);
         public void setPreviousClosingPrice(double price){
              System.out.print("Previous Closing Price: "+ price);
         public void setCurrentPrice(double price){
              System.out.print("Current Price: "+ price);
         public double changePercent(double PreviousClosingPrice, double CurrentPrice){
              double ChangePercent;
              ChangePercent = (CurrentPrice - PreviousClosingPrice)/PreviousClosingPrice * 100;
              return ChangePercent;
    }

    Thanks everybody for the input. I originally had all of my methods within the main blocks, but I ended up getting three errors. I'll work on this more on Wednesday when I have some free time and post what I've corrected and changed. Again thanks.
    public class Stock {
    public static void main(String[] args) {
    public Stock() {
    public Stock(String symbol, String name){
    public String getSymbol(){
    return "ESI";
    public String getName(){
    return "ITT Technical Institute";
    public double getPreviousClosingPrice(){
    return 60.0;
    public double getCurrentPrice(){
    return 65.0;
    public void setSymbol(String symbol){
    System.out.print("Symbol: " symbol);
    public void setName(String name){
    System.out.print("Name: " name);
    public void setPreviousClosingPrice(double price){
    System.out.print("Previous Closing Price: " price);
    public void setCurrentPrice(double price){
    System.out.print("Current Price: " price);
    public double changePercent(double PreviousClosingPrice, double CurrentPrice){
    double ChangePercent;
    ChangePercent = (CurrentPrice - PreviousClosingPrice)/PreviousClosingPrice * 100;
    return ChangePercent;
    }

  • Changing text of words in the tab bar

    How do I change the text of the words in the tab bar at the top of my webpage which we click on to direct us onto another page. are the texts to do with the design template or can we change them manually without altering the design of the webpage.
    thanks

    This Apple doc may help:
    iWeb '09: Renaming a website or webpage
    ...Found by searching here:
    http://support.apple.com/kb/index?page=search

  • How to set the printdocument tool text, for print by the thermal printer?

    Hello, is that be the same as the A4 paper printer?. I used for-loop-condition for print series of the pages, but the A4 printer printed for me 1 page only, but I asked it, for print more than 50 papers, by the thermal printer, by I used for-loop within
    the printdocument tool text, but I not the now tested it by the thermal printer, is that the for-loop succeed when I use it by the thermal printer? where the A4 printer printed 1 paper only for me. where I want series of the pages where I used for-loop-condition,
    and I want that succeed by the thermal printer, and is that be true? and what the true if that was wrong?

    Hi,
    Based on your desccription, I'm afraid that it is not the correct forum since this forum is to discuss the VS IDE.
    If you want to achieve it in code, I suggest you post this issue to the specific language development forum like C#, VB or others.
    Reference:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/7b07c516-46c5-46ab-a83a-92432b1e262f/print-multiple-pages-per-sheet-in-c
    https://social.msdn.microsoft.com/forums/windows/en-us/b6c5a867-ffa6-4e46-b6de-543b645e73c8/printing-and-previewing-multiple-pages-in-c
    http://www.codeproject.com/Tips/733680/Printing-and-Previewing-multiple-pages-in-Csharp
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Why do I get "Fuzzy Text" when printing from the web?

    A short time ago I was able to print text from Internet webpages and my school website. Now the text is coming out fuzzy when I try to print. I can print Word and PDF documents OK. But not PDF documents saved from the websites.

    In Excel, right click and choose Format Chart Area. In the dialog at the left, choose Fonts. Change the font to Arial or something other than Calibri (Theme Body). Then copy/paste.

  • Text is printing to the left....

    Help please!!! I am trying to print some invites and the text isn't center like in the preview. What am I doing wrong???

    Hi flowergirl24,
    Welcome to the HP Forums!
    I understand that your printer is printing text to the left instead of the center. I am happy to help you!
    For further assistance, I will need to know the following:
    The Product/Model Number of your printer. Follow instructions in this link. Finding Your HP Product Model Number.
    If you are using a Windows or Mac Operating System, and the version number. To find the exact version, visit this link. Whatsmyos.
    If the printer is able to make copies by itself.
    If the printer is connected, Wireless, Ethernet, or USB.
    If the power cable is plugged into a surge protector, or directly to the wall outlet. Issues when Connected to an Uninterruptible Power Supply/Power Strip/Surge Protector. This applies to Inkjet printers as well.
    The type/size/weight of paper you are using.
    The name of the program you are printing from.
    Please see this post, Want Good Answers? Ask Good Questions, by @Bob_Headrick, so you can get the most out of these forums.  
    Hope to hear from you, and have a good day!
    RnRMusicMan
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to say “Thanks” for helping!

  • Capturing all the text that I output to the console

    HOw do I capture all the text I output to the console to a file. I know how to open filebuffers and all that, well I don't really know, but I have some sample code that I can follow. I am just wondering if I am suppose to just open the file buffer, then run my normal application with all the system.out.println() statements and then have that fed to a file? Right now I am using a lot of println() statements to debug, and I would like to be able to push it into a file so I can look at it later, without having that console line limitation.
    My guess is to just open up a filestream and have it open and then run my normal code and then close the filestream at the end. Can somebody let me know if that is good enough...
    let say I have a static method hat outputs a bunch of text, can I do this
    filestream open
    static method run
    filestream close
    and that's it.

    I could see why you'd want to automatically
    route output to a file, that normally would
    go to the console. There might be use for
    capturing output lines.
    If the question is to avoid having to specify
    the output on the command line, then what
    one can do is to create a ".bat" file.
    Ex.
    kstring.bat
    ======================================
    @java kstring > kstring.out
    Now in executing, you'd just ==> kstring
    Which will execute the kstring.bat,
    and since "> kstring.out " is inside
    the "bat", your output goes to the
    kstring.out, instead of the console.
    This would be another way, saves all the
    redirection in Java code. Just use the
    DOS command inside a xxx.bat file.
    Just my opinion, may not work in your
    circumstance.
    -- gte99te

  • How do I print on the backside of a 5x7 folded greeting card?

    I am trying to create a folded greeting card to print at home.  However, in creating a card and using the template, I cannot figure out how to put an image and text to print on the back of the greeting card.  The template does not allow me to add anything on the back.

    I don't think it can be done with the supplied templates and when using the "Create Greeting Card" feature.
    You can do it yourself by starting with a new image sized to the unfolded card, adding another page, and then adding your design elements to it.  You'll save it as a PSE project file, but then you'll have both sides that can be printed.
    Ken

  • L7680 not printing all the black, please help!

    I've got a HP L7680 that has original cartridges, in date etc etc but as of yesterday evening was missing bits of the black text when printing. The colour text was fine, but horizontally black bits were missing about a 1/3 and 2/3 of the way down, any ideas?? Thanks

    Heads might need to be cleaned.

  • How do you locate a bug WITHOUT the emulator and the console?

    Hi.
    I'm new here and my English is not perfect but I'll try my best to explain my problem.
    I'm trying to port J2ME games to various mobile phone devices. I've no problem fixing bugs on Nokia, Sony Ericsson, or any models that offer an emulator and a console window.
    *** The problem is: In some case, The same build runs fine on Nokia/Sony emulator, but crash/freeze on LG phones.
    (this is just an example, it's not only LG phones that have this problem though)
    I believe it is possible to locate the bug by:
    - use the 'try/catch' block and print the error message using something like
    g.drawString(e.toString(),0,0,0);
    where 'g' and 'e' is a Graphics and Exception objects.
    But I wonder if there's a way to print 'everything that should be printed on the console', on the phones's display. So we don't need to manually put try/catch block.
    ok, to sum up the question.
    Question:
    1. Is there a way to print 'everything that will normally appear on the console', on the phones's screen?
    2. If no, then I'll need to try/catch the problem.
    But how can you use try/catch and "drawString" everywhere in the code?, while the actual drawing will be done only in the "paint()" method?
    I'm thinking of using 'getGraphics().drawString' when using try/catch outside the paint() method. but what's the point if the actual drawing will be done only in paint() method anyway...
    Sorry if it's a stupid question. I just started learning Java programming 3 months ago, let alone J2ME. >_<
    Thank you. =)
    /bow

    Hi Kakyoin,
    What I found was helpfull is creating a method in the MIDlet where you can display messages. For instance:
        public void createFormScreen(Alert alert) {
            // Set up the initial screen for the MIDlet
            Form formScreen = new Form("Your MIDlet name");
            firstScreen.append("Welcome to your MIDlet");
            myChoice = new ChoiceGroup(null, ChoiceGroup.EXCLUSIVE);
            myChoice.append("Your first choice", null);
            myChoice.append("Your second choice", null);
            formScreen .append(myChoice);
            formScreen .addCommand(OKCOMMAND);
            formScreen .addCommand(EXITCOMMAND);
            formScreen .setCommandListener(this);
            theListener = this;
            if (alert == null) {
                 theDisplay.setCurrent(formScreen Screen);
            } else {
                theDisplay.setCurrent(alert, formScreen);
        }So, from your constructor call the createFormScreen method, and your initial screen will be displayed.
    When an allert situation occurs in an object, call createFormScreen in a method like:
         protected void displayMessage(String title, String msg) {
              // Display the error message
              Alert error = new Alert(title, msg, null,
                        AlertType.ERROR);
              error.setTimeout(Alert.FOREVER);
              myMIDlet.createStartScreen(error);
         }Now the error message will be displayed on the screen indefenitaly. Off course your object where the error occurred should have a reference to the MIDlet object. I hope this helps you.
    Maik

  • Problem Displaying Unicode at the console

    Hello,
    What do I need to do to print out a unicode charecter which is of some other language for example ( telugu,an indian language).
    I had found out that the unicode range for telugu is 0C00 to 0C7F.
    I had tried doing char c = '\u0C10';
              System.out.println(c);
    But I could only see that a '?' symbol is being printed to the console.
    Could some one suggest an alternate or what is wrong with what I'm doing?
    Thanks in advance.

    I can install my local language font, but would it be
    helping things out?I told you, I have Japanese installed, and it didn't help me. Joni offered you a suggestion or two. Did you try them?
    because I think the unicode chraecter set relies on
    local OS! But I'm not sure.I don't know how much it depends on the OS, but it definitely depends on the capabilities of the program running. MS Word supports unicode, but that doesn't mean all Windows programs do.
    Why does'nt Windows XP Support Unicode at command
    prompt?Because cmd.exe is a very old program and probably the folks at M$ figured the way it's used it doesn't need to support unicode.
    Why do you need unicode in your command prompt?

  • Event Listner for the console

    I dont know whether this is the right forum for this question. May be this question is stupid. I am using a third part y jar file . I have a small swing application which calls this third party utility with certain arguments. This vendor utility spits out System.out.println statements to the console indicating the progress. I want to use this console print out and then update a progress bar for the swing applicatiion. Is there any way to write a console event listener for this?
    Something gets printed on the console while the java program is running. could this event be trapped?
    Thanks

    I dont know whether this is the right forum for this
    question. May be this question is stupid. I am using
    a third part y jar file . I have a small swing
    application which calls this third party utility
    with certain arguments. This vendor utility spits out
    System.out.println statements to the console
    indicating the progress. I want to use this console
    print out and then update a progress bar for the
    swing applicatiion. Is there any way to write a
    console event listener for this?
    Something gets printed on the console while the java
    program is running. could this event be trapped?
    ThanksYou can redirect stdout to a stream that you has created. Read that stream and update the progress bar.
    Kaj

  • How to change the text already available in a video?

    Hi
    I have a video with a text on it that I would like to change. I'm using Premiere Elements. Does anyone can help me?

    gabrielb
    Thank you for the reply with additional information.
    As I mentioned before
    "..... the can and cannot do are going to depend on the placement of the existing text and the frequency of its appearance in the duration of the clip"
    Possible means include
    1. Garbage matte to hide the existing text and creation of title to placed above the video which is on the lower video track. Then you would need to keyframe the garbage matte for the duration of the video clip to keep pace with the existing text that you want to hide/replace. See Applied Effects/Applied Effects Palette/Crop Panel expanded and Toggle Animation. To get rid of black borders generated in the process, you can scale the image in the Edit area monitor to fit the monitor space. See fx Effects/Keying/and the four, eight, or sixteen point garbage matte.
    2. Cropping instead of garbage matte. See fx Effects/Transform/Crop. Keyframing of Crop effect. See Applied Effects/Applied Effects Palette/Crop Panel expanded and Toggle Animation.
    3. If the "Elements" are right, use the Effects Mask to blur the section with the text, and then create new text to fit over the blur.
    4. Other.
    A significant other would be if you had the project file for your video so that you could make the text corrections in it prior to export.
    Please do not hesitate to ask if questions or need clarification on the above.
    Thanks.
    ATR

  • CD Insert with mosaic is not printing, just the text prints....never a probem before.  Has this been changed?

    The CD insert selection of MOSAIC does not print album artwork, only the song title text.  What is wrong?  This has never been a problem before.

    Hi @simplykateg , and welcome to the HP Forums!
    I see you're having print issues.  I would like to help!
    There can definitely be compatibility issues between a 2.0 USB device and a 3.0 connection port. I'd recommend plugging into a 2.0 port.
    I'd recommend starting with a power reset.  Disconnect the power cord from the printer and the power outlet, then wait 60 seconds. After 60 seconds, plug the printer back in. Ensure you plug the printer directly to a wall outlet. Make sure to bypass any sort of surge protector or power bar.
    I'd also suggest downloading and running the HP Print and Scan Doctor. 
    Good luck and please let me know the results of your troubleshooting steps thank you for posting on the HP Forums!
    Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
    Jamieson
    I work on behalf of HP
    "Remember, I'm pulling for you, we're all in this together!" - Red Green.

  • I want to bring in text from Word (and the web) that is already hyperlinked into InDesign. How do I do it while keeping the links active?

    I want to bring in text from Word (and the web) that is already hyperlinked into InDesign. How do I do it while keeping the links active?
    Whenever I copy/paste from web or Word it removes the hyperlinks.  And when I try to do it by "Place"ing a Word document into my InDesign project it keeps the formatting with it, the rectangles around the text.
    I have the latest version of InDesign.
    Any help is appreciated. 

    Copy-and-paste may not include formatting. A regular import using Place is the best way.
    The rectangles around the hyperlinks are just to indicate they are links -- they do not print, but they do show up in your PDF.
    You can remove them by double-clicking the hyperlink in the Hyperlinks panel and select "Invisible Rectangle" as type.
    Typically, Word hyperlinks are formatted -- blue text, underline -- with a Character Style. If you want to remove or change the formatting, all you have to do is change the character style. My experience, though, is you must check all hyperlinks because for no apparent reason sometimes they appear in the document without the character style.

Maybe you are looking for