• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

How to create scrolling text?

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I would like to write a program which take any text message from user and which will scroll. Is any one tell me how to do?

Thanking You,
Yatin Shah
 
Ranch Hand
Posts: 441
Scala IntelliJ IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question is terrible, but I'll bite:
 
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Luigi Plinge wrote:Your question is terrible, but I'll bite:



I tried this out because I have never used console().readLine(String ...) before. But this codes causes a NullPointerException because there is no Console associated with my JVM. Did it compile and run on your machine Luigi? I made a few changes to get it to run.




Hunter

 
Luigi Plinge
Ranch Hand
Posts: 441
Scala IntelliJ IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just ran it from the Windows command prompt. It doesn't work in an IDE. You could use instead if for some reason you don't have a console. How were you running it?
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was running it jGrasp, but it has a console window so I don't know. Cool little snippet though.

Hunter
 
Sheriff
Posts: 22210
117
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System.console() only returns a non-null value if it's run from the actual system console - cmd.exe for Windows, bash / csh / ... for Linux, etc. Any console inside an IDE will cause a null return.
 
Yatin Shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Guys,

To give an idea.
 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When doing non-GUI projects, always go for cmd line! I personally hate IDE's. I use the command line to do any kind of project, whether it be GUI or not. I use the command line to compile, package, secure, etc all my programs. Can always be fully updated (latest JDK version = latest javac version). Don't have to worry about the tricks and hacks etc. When my programs were smaller than 300 lines, I used Microsoft's Notepad. I now use Notepad++, which ISN'T an IDE, just a syntax highlighter. I recommend this for you, Yatin Shah and everyone! Good luck on your path to Java programming. Read the Java tutorials. Look up some online. Read some books (I recommend "Head First Java"). Then, go out and code. When you are having trouble or getting errors, try to look up the solutions online. Eventually, you'll learn (I learned this about a month ago) that you can figure out most of your problems by looking up the errors in the API. If you get an error, look up the error. Look at the attached component (NullPointerException from JTextField, look up NullPointerException if you don't know what that is. Then, look at the methods, constructors, etc that you used and find your problem). This is just some tips. Good luck!

cc11rocks

EDIT : For the exceptions, you'll usually find the problem line (within your actual code) in the first 1-2 lines of error message. Sometimes, there will only be one line one line of error message with the line number and the other lines will be on an "unknown" line. This is obviously the problem line of code. Something I learned in the past week is to use generics with ALL of your collections (maps, lists, etc) if you can.
 
Luigi Plinge
Ranch Hand
Posts: 441
Scala IntelliJ IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FWIW although this snippet is for running from the command line, I still wrote it in NetBeans, as I do with all my Java. It makes coding fun because it's probably 3 times as fast and 10 times less frustating than using a text editor. Imports get inserted and removed automatically, autocomplete saves typing and mistakes, and suggests relevant methods, error highlighting means you compile first time, templates mean I type "psvm" rather than "public static void main(String[] args) {}", one keyboard shortcut an all my code is formatted nicely, click "Save" and the project compiles, no more typing out classpaths, debugging and refactoring tools... I could go on. You should give it another try John! NetBeans is not hard to learn at all.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a side note, if you want to use the console from jGRASP on Windows you can check on "Build" / "Run in MSDOS Window".
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I'll try that out. Also, thanks for jGrasp, I use it for almost all of my development.
 
Yatin Shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks you very much to all for tips and help me out. I will follow your suggestion.

 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i ran into this about 11 years ago so i cant post a link. the solution i found used double buffering. maybe if you search for: java double buffering you can find the code. double buffering makes the scrolling smooth, which is a good thing
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic