Click here to Skip to main content
15,887,304 members
Home / Discussions / Java
   

Java

 
Questionproject code Pin
Member 1045083712-Dec-13 19:45
Member 1045083712-Dec-13 19:45 
AnswerRe: project code Pin
Richard MacCutchan12-Dec-13 21:25
mveRichard MacCutchan12-Dec-13 21:25 
Questionjava .. while Pin
Ehab Obiad12-Dec-13 7:55
Ehab Obiad12-Dec-13 7:55 
AnswerRe: java .. while Pin
R.K.krishna12-Dec-13 15:48
R.K.krishna12-Dec-13 15:48 
QuestionHow to draw Shapes from MySQL Database Pin
f2611-Dec-13 23:33
f2611-Dec-13 23:33 
QuestionRe: How to draw Shapes from MySQL Database Pin
Richard MacCutchan12-Dec-13 0:13
mveRichard MacCutchan12-Dec-13 0:13 
AnswerRe: How to draw Shapes from MySQL Database Pin
f2612-Dec-13 7:48
f2612-Dec-13 7:48 
AnswerRe: How to draw Shapes from MySQL Database Pin
BobJanova12-Dec-13 5:33
BobJanova12-Dec-13 5:33 
This is a three part problem. Don't mix database access code and business logic, that leads to confusing and platform-dependent code.

The three parts I see here are:
- Read the data out of the database
- Interpret the data in an appropriate form (e.g. split the string up and turn it into a double[])
- Draw shapes with the numeric arrays you retrieve.

I think it's reasonable to combine the first two, i.e. in your database reading loop (what you posted in the question) read the field, split it on space and call Double.parseDouble on each element (exception trapped of course). If you control the database format then you shouldn't be writing numbers as text, either have 6 columns if a path segment is always 6 numbers, or store it as a binary blob containing the array ... though I must admit I've stored lists of numbers like this before as well.

The database reading code should return data objects, in this case a List<double[]> or a List<PathSegment> where PathSegment encodes the six numbers. You should then use those data objects in calling drawing code.

Looking at this mess of a class though I think you want to start a bit slower and work your way through some language tutorials. You're mixing up static and instance state (why provide a constructor that only calls a static method?), not understanding the principle of separation of concerns, not following good practice re exception handling ... Writing a database-backed 3 tier system is quite difficult and if you don't have language practices worked out then you're going to keep breaking things.
QuestionGood books on JDBC and Java Swing? Pin
Member 1033880511-Dec-13 15:05
Member 1033880511-Dec-13 15:05 
AnswerRe: Good books on JDBC and Java Swing? Pin
Richard MacCutchan11-Dec-13 21:22
mveRichard MacCutchan11-Dec-13 21:22 
AnswerRe: Good books on JDBC and Java Swing? Pin
TorstenH.12-Dec-13 3:08
TorstenH.12-Dec-13 3:08 
AnswerRe: Good books on JDBC and Java Swing? Pin
M Riaz Bashir15-Dec-13 1:38
M Riaz Bashir15-Dec-13 1:38 
QuestionJava Code to Print JFrame or JPannel Form Contents Pin
Cyber129-Dec-13 21:41
Cyber129-Dec-13 21:41 
AnswerRe: Java Code to Print JFrame or JPannel Form Contents Pin
Richard MacCutchan9-Dec-13 22:30
mveRichard MacCutchan9-Dec-13 22:30 
GeneralRe: Java Code to Print JFrame or JPannel Form Contents Pin
Cyber1213-Dec-13 23:17
Cyber1213-Dec-13 23:17 
GeneralRe: Java Code to Print JFrame or JPannel Form Contents Pin
Richard MacCutchan13-Dec-13 23:30
mveRichard MacCutchan13-Dec-13 23:30 
GeneralRe: Java Code to Print JFrame or JPannel Form Contents Pin
Cyber1214-Dec-13 20:24
Cyber1214-Dec-13 20:24 
QuestionAudio Lever Meter Pin
xchris009-Dec-13 0:27
xchris009-Dec-13 0:27 
AnswerRe: Audio Lever Meter Pin
Richard MacCutchan9-Dec-13 2:10
mveRichard MacCutchan9-Dec-13 2:10 
GeneralRe: Audio Lever Meter Pin
xchris009-Dec-13 2:15
xchris009-Dec-13 2:15 
GeneralRe: Audio Lever Meter Pin
Richard MacCutchan9-Dec-13 2:20
mveRichard MacCutchan9-Dec-13 2:20 
GeneralRe: Audio Lever Meter Pin
xchris009-Dec-13 2:26
xchris009-Dec-13 2:26 
GeneralRe: Audio Lever Meter Pin
Richard MacCutchan9-Dec-13 2:47
mveRichard MacCutchan9-Dec-13 2:47 
GeneralRe: Audio Lever Meter Pin
xchris009-Dec-13 2:58
xchris009-Dec-13 2:58 
AnswerRe: Audio Lever Meter Pin
xchris0017-Dec-13 2:30
xchris0017-Dec-13 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.