swing - Java - draw lines reading points in a txt file -


How am I trying to understand Java and special swing work, so I used to draw free hand lines on a JPNL Made an application. Then with apple button I can remember some information (when the user started drawing and ending the line, which creates the line etc.).

I save the information like this:

edit I removed the waste stuff and just put a space between different notifications.

  line 04: 54: 34: 365 04: 54: 35: 167 [Java. .Point [X = 249, y = 114], java.awt.Point [X = 249, y = 114], java.awt.Point [X = 207, y = 87], java.awt.Point [X = 207, y = 87]]   

This is an example of a line; Can you suggest me how to parse the file to pull lines back on JPNL? I think it should go after the word "for every line," and should take data and attract it. Is this the right way to do it? I have already managed to read / write the file, so the problem is in carrying that part of the line and giving it as the input of the drawing function.

Read the way I read the file (.txt): list & lt; String & gt; Line = files.readlines (pathgate (file.gatepath ()), charset name ("UTF-8");

Thanks!

I will do something similar to the unbuyon sune, but with each drawn "line", even so That's made up of several points on each line in your text file, even if you do not want to do this, it will be easy to print numbers and not the entire object.

After creating two lines, a text file may appear:

  249 114 207 87 230 110 115 240 90 210 112 245   < p> Now you can already read all the rows you like, and then space each row (or string for each line) values ​​= line.split ("");  
  // Note: We are adding 2 to i in each loop, because the second value (int i = 0; i & lt; values.length; i + = 2) {// Now just mark // value [ i] = x, value [i + 1] = y}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -