Scott Matthews

Ranch Hand
+ Follow
since Jun 28, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Scott Matthews

First, this is an issue with Windows that I am trying to find a work around for:
I have my users install my Java application using Installshield. During the installation process, I copy new font files to the \windows\fonts or \winnt\fonts area depending on whether they are using Windows 98 or WinNT/2000.
These font files are copied here just fine, but they are not seen by my application (or any other windows application) unless I go into the Control Panel and click on the Fonts folder. Then the fonts get refreshed and my application can see them.
Has anyone run across this. I am trying to not have the user go into the Control panel if I can help it.
Thanks for your time.
22 years ago
I have a java application that has an Icon on the Windows 98/NT desktop.
Icon properties has the following:
Target:
"C:\Program Files\ROC\JRE13\bin\javaw.exe" -Xbootclasspath/p:boot.jar -jar Design.Jar
Start In: "C:\Program Files\Roc\Formation\Design
When I double-click on the Icon things work great:
My application starts and I am able to select/open files which are used in my application. (For reference, the files that I use all end with a file extension of ".frm")
With my application closed, I am able to double-click on one of these ".frm" files (In "My Computer" or Windows Explorer) and my application starts and opens the ".frm" file.
So far, so good.
Here is what it cannot do:
I want to be able to have the user go to into "My Computer" (or Windows Explorer) and be able to drag a file or file(s) onto the Windows desktop icon and have it pull up my appilcation and open this file.
What I get so far is a box that says "Could not find the main class. Program will exit!".
For reference in the following, pretend I am dragging a file named "test.frm" on to the desktop icon.
What it looks like it is doing to me is the following:
It looks like it is ignoring some of the parameters on the Icon Target line and doing the following:
.....\javaw.exe test.frm
When I want it to do the following:
...\javaw.exe -Xbootclasspath/p:boot.jar -jar Design.Jar test.frm
It seems to be skipping the information after javaw.exe and trying to open the "test.frm" which because it is not a class file, it it not surprising that it cannot find a main class.
Note: This works fine in Windows 2000.
Thanks for your help.
[This message has been edited by Scott Matthews (edited December 07, 2001).]
23 years ago
I am using MySql if that matters in answering my question.
I have written my first program using MySql and can display information from an SQL query.
Question: What is the best way to determine the number of records returned by the result set.
.
.
ResultSet RS = Stmt.executeQuery(theSQLQuery);
while (RS.next()) {
System.out.println(RS.getString(1));
}
I know I can put my own "counter" in the while loop. Is there something like RS.size(). I looked in the online Java docs I have and did not see anything that was apparent.
Thanks.
Pardon my greeness. I am new to java. I understand the certified programmer and developer. Can you explain further about a Certified Component Developer.
The place I saw components was dealing with Swing components and putting them in a JFrame, etc.
Please educate me.
Yes, I understand this part of it. The code you provided is very similar to the working code I have in my stand alone application that accesses a mySql data I have.
What I want now is how to do this type of thing from a JSP page.
23 years ago
More specifics:
Honestly, I have not attempted to write any specific JSP code to connect and access the MySql database. I know this is not a good answer, but I am frustrated as to what to do using JSP pages.
Off the subject a little bit, but I have written a small stand alone java application to read a mySql database and display a few records.
The more I read on how to use a JSP page to access a database, the less clear it is. I understand the general concepts the book authors are describing, but they use their own custom tag libraries.
Should I write my own tag library to get information from a mySql database?
When I wrote the original email question, my hope was that someone would have a small example that would illustrate how to access a mySql database from a JSP page without using a tag library. Once I saw how this worked, I would then read more about developing my own tag library and attempt an example using my new custom library.

I was hoping that an example of someone having been down this road before could have written something like:
sample.jsp
------------------------
connect to the database using the MySql driver .... by the following statement:
...............
here is an example of an SQL statement to look up the field FullName field:
.........
the results of that query are stored in the following variable/vector, etc.
----------------
Summary:
I assure you I am not trying to be lazy and scurt the necessary learning pitfalls that strengthen the long term knowledge base.
I continue to read and reread to try and learn. I was hopeful someone could provide a sample JSP page with code for my small example using the field names I described previously. Or they could provide an example of their own JSP page with their field names and I could follow this as a pattern. But, maybe accessing databases needs to be from tag libraries, I don't know.
I appreciate your time. Any JSP code samples or additional direction as to what I can read would be greatly appreciated.
[This message has been edited by Scott Matthews (edited October 17, 2001).]
23 years ago
I have been learning how to use JSP pages for about 3 weeks. I am using Tomcat. I have a Html page that accepts a person's name. Then a JSP is called that puts the person's name into a java bean and displays it back to the screen. I have an html page, a jsp page, and java code for the bean. This I have working.
What I want now is that after accepting a person's name, I want the JSP page to additionally look up that person's name in a MySql database which holds the person's name and address. Then I will display either the person's address or a "not found" message.
Could someone provide a JSP page for a MySql database called MyNames that has FullName and Address and the field names to do the above example?
I have been attempting to read books on this and cannot understand the information.
Thanks for your help.
23 years ago
So far in java, I have only written applications. Now I want to try writing servlets. I have looked at some source code examples in books. I understand what they are describing in the coding examples they show.
I have tried compiling one of the programs and I am getting a lot of errors. I assume that I need additional jar/class files to make them compile.
Also, I see in the books that I need a "servlet" engine once I am able to compile the programs. The books give Tomcat as an example of a servlet engine.
What do I need to do in order to be able to:
1. Compile a java servlet file?
2. Run a java servlet file? (Can you recommend a servlet engine)

Sorry for greeness of the question.
23 years ago
I have been programming in java about 6 months. Would your book confuse me at this point or can it be read by a beginner?
Thanks
If I have many JTextFields on the same screen and want to have 1 listener for all of them:
i.e. myJTextField1.addActionListener(this);
myJTextField2.addActionListener(this);
.
.
myJTextField15.addActionListener(this);
How can I tell which JTextField caused the action event when I arrive at "actionPerformed":
public void actionPerformed(ActionEvent e) {
}
I have tried the following in this "actionPerformed":
JTextField source = (JTextField)(e.getSource());
String strTextFieldName = source.getName();
The above returns "null" for strTextFieldName
I was hoping that strTextField name would return "myJTextField1 or myJTextField2, etc.
What do I need to do?

Related question: When I have a screen of JLabels and JTextFields, is there normally different listener methods set up on for each JTextField or just 1 listener method with a bunch of "if" statements to tell which JTextField caused the action
Thanks.

------------------
23 years ago
My background: 15 years of programming experience, but not in object oriented languages. The last 6 to 8 months I have spent learning java.
I have read 3 or 4 java introductory and intermediate books and believe I have a handle on its syntax and general use.
Is there a book someone can recommend that does the following:
Takes a problem/project of some difficulty and takes you step by step from design to code.
The books format would be:
1. Project A - description
Project A - uml/boxes/line design
Project A - skeleton coding
Project A - deletailed coding
2. Project B.....

Here are some examples off the top of my head:
1. Build a project that is an application that will recreate a simple checkbook with a register and report writing capabilities.
2. Build a client/server system that will have a web page that records "membership" information and the last time they have logged into the website.
3. Build an applet that mimics the game of mindsweep.

I am looking for a book that shows how the author would "break down" a problem into different tasks and how he would code his/her java files to complete the project.
Thanks for your recommendations.
23 years ago
Is there a 2nd book on the way?
23 years ago
I am new to java. I know, obvious from the above question.
What is Websphere and how does it fit in with java?
Thanks from a newbie.
23 years ago
How do I set up an odbc data source as you described above?
I am using Windows98. I see under the Control Panel where there is an ODBC32 Data Sources Icon. I double click on this and get the following tabs: "User DSN", "System DSN", and "File DSN". What do I need to do from there? DBF files are supported here, but I am lost as to what to do?
Could you give me more specific instructions and then show in source code as to how this comes into play?
Again, I have tried to experiment myself and am not getting anywhere. I was hoping someone that had done this before could enlighten me on the "cookbook" approach they used.
Thanks for your time.
I am new to java (less than 6 months).
I have existing data in the dbaseIII format (.dbf). I would like to access this using java. This/these dbf file resides on my local PC. I do not need to go to a "server" to get the data.
Can someone be kind enough to describe the steps needed and possibly some lines of code to get me on my way. An example to use in reference is the following:
a. One database "C:\TestData\Names.dbf"
b. Fields are FirstName & LastName
I would like to write a java program that would open the
database and display the 5 records in the database to the screen.
FYI: I have tried to do this myself. I have been to the Sun On-line tutorial and also read some examples in books, but always they are going to a server in their examples. The SQL part seems straight forward, but the connection part has me scratching my head.
Thanks for your time and help.
Signed: "Spinning my wheels"