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

Java

 
AnswerRe: IntelliJ IDEA, Think like a computer scientist. import a java file Pin
Richard MacCutchan15-Dec-13 4:43
mveRichard MacCutchan15-Dec-13 4:43 
GeneralRe: IntelliJ IDEA, Think like a computer scientist. import a java file Pin
David C# Hobbyist.15-Dec-13 10:56
professionalDavid C# Hobbyist.15-Dec-13 10:56 
GeneralRe: IntelliJ IDEA, Think like a computer scientist. import a java file Pin
Richard MacCutchan15-Dec-13 21:11
mveRichard MacCutchan15-Dec-13 21:11 
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 
The points are stored in MySQL database in data-type of MEDIUM-TEXT, these examples of the points (coordinates)stored in this form(Starting two points are moveTo and each line is a curve)
458.41016 425.70843 427.74316 392.55343 403.93516 370.91243
399.48516 366.83843 398.54916 368.02743 397.41516 372.27043
394.75116 382.25643 392.96616 392.69543 391.09516 402.03043
390.35916 405.62343 389.79116 406.92443 392.62616 409.52743
406.00316 421.83343 442.19716 458.07143 444.89016 482.76843
431.76716 528.31343 393.39116 574.56743 350.22516 594.56743
316.63916 610.12643 278.88716 614.34043 242.18316 610.35243
232.12112,609.27843 228.38012 619.29143 238.47016 621.92243
274.01216 631.28543 320.32416 637.73643 356.57416 628.91043
420.03416 613.46343 456.48216 533.71643 457.61616 470.82943
all the above points have same Object-ID.
So, my question is How can i create GeneralPath objects to draw the shapes, I know there's a method curveTo() used to Add a curved segment, defined by three new points, to the path by drawing a Bézier curve, and How can i use all these points(coordinates) to draw curve on JFrame also i have so many others i need to combine all of them together based on Object-ID's ?
The program is :
Java
import java.sql.*;

public class selectStmt {
	private static final String DB_DRIVER = "com.mysql.jdbc.Driver";
	private static final String DB_CONNECTION = "jdbc:mysql://127.0.0.1:3306/abo";
	private static final String DB_USER = "username";
	private static final String DB_PASSWORD = "pswd";
	
	public selectStmt(){
		try {
			 
			selectRecordsFromTable();
 
		} catch (SQLException e) {
 
			System.out.println(e.getMessage());
 
		}
 
	}
 
	private static void selectRecordsFromTable() throws SQLException {
 
		Connection dbConnection = null;
		PreparedStatement preparedStatement = null;
 
		String selectSQL = "SELECT * FROM abo.pathitems where ObjectID=1";
 
		try {
			dbConnection = getDBConnection();
			preparedStatement = dbConnection.prepareStatement(selectSQL);
			//preparedStatement.setInt(1, 100);
			
			// execute select SQL stetement
			ResultSet rs = preparedStatement.executeQuery();
 
			while (rs.next()) {
                            
				/*  how can i use GeneralPath class here and its functions such as moveTo() and curveTo() to pass all points properly */
			}
 
		} catch (SQLException e) {
 
			System.out.println(e.getMessage());
 
		} finally {
 
			if (preparedStatement != null) {
				preparedStatement.close();
			}
 
			if (dbConnection != null) {
				dbConnection.close();
			}
 
		}
 
	}
 
	private static Connection getDBConnection() {
 
		Connection dbConnection = null;
 
		try {
 
			Class.forName(DB_DRIVER);
 
		} catch (ClassNotFoundException e) {
 
			System.out.println(e.getMessage());
 
		}
 
		try {
 
			dbConnection = DriverManager.getConnection(
                             DB_CONNECTION, DB_USER,DB_PASSWORD);
			return dbConnection;
 
		} catch (SQLException e) {
 
			System.out.println(e.getMessage());
 
		}
 
		return dbConnection;
	}

}

Thanks
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 
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 

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.