Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Transform file into java applet using Graphics

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb Transform file into java applet using Graphics

    Ok, I want to know if this is possible. I have the following text file (actually it's pgm, but viewed as text):
    question.jpg

    It's a file made of zeros and " "(spaces), and the zeros form the word "exemplu".

    Is there a way I can transform these zeros intro an image contained by an applet (using the Graphics class)?

    I want to find out stuff about the word represented by the zeros (like the dimension of each letter and the direction of the handwriting) - so I figured out that if I could transform it into a Graphics drawing inside an applet, I could use getX() and getY() for each point (I would represent each 0 with a Point2D) to give me some statistics.

    So, is it possible to transform it?


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Transform file into java applet using Graphics

    You have pretty much described how to do it, minus specifics, though I don't think you need an image.
    Think of the file as also having the grid and using getX() and getY() where Y is the line number and X is the character position on that line

  3. The Following User Says Thank You to jps For This Useful Post:

    radulescuiulia (July 2nd, 2013)

  4. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Transform file into java applet using Graphics

    I have another question: how can I figure out when a letter ends? for example I want to calculate the dimension of "e", then the dimension of "x", etc, but I can't figure out how to separate them.
    I've represented the file with a matrix, where x = rows and y = columns.

  5. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Transform file into java applet using Graphics

    One would think a common task like determining when you reach the end of the file would be built in to what ever system you are using to read the text files. Read the documentation for your "file reader" to see how it is used.
    Or post what you are using for a more detailed reply...
    Last edited by jps; July 2nd, 2013 at 02:54 PM. Reason: reword for clarity

Similar Threads

  1. Incremental graphics painting in applet
    By Hobokenrich in forum AWT / Java Swing
    Replies: 0
    Last Post: May 13th, 2013, 04:05 PM
  2. [SOLVED] Java File to Applet
    By Ace Java 9000 in forum Java Theory & Questions
    Replies: 8
    Last Post: September 25th, 2012, 09:53 PM
  3. How to retain Graphics after resizing java applet
    By maz3r in forum Java Theory & Questions
    Replies: 13
    Last Post: August 25th, 2012, 11:44 AM
  4. Replies: 10
    Last Post: January 12th, 2011, 04:48 AM
  5. how to transform an html file to a web site in java
    By nasi in forum Java Theory & Questions
    Replies: 9
    Last Post: March 28th, 2010, 11:06 PM

Tags for this Thread