Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Brennen smith

Ranch Hand
+ Follow
since Dec 29, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brennen smith

Thank you I knew it had something to do with that .jar. Everything is working perfectly now.
8 years ago
I have created compiled and run many Java programs, but this is my first applet. I am doing a project for school basically to connect a DB to a java applet. I have the class set up and when I run through Netbeans "Run File" It works perfectly. I am able to connect to the DB... no issues at all. So now I just need it to work through an HTML window... This is where my issue starts. I have tried to read as much about applets as I can but still do not understand a lot of what I read.

When I run the applet through an HTML window I get the error: java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group

The .html file I am using is the one in the project/build folder under the default netbeans project structure.



I have confirmed that the following path is correct. (<APPLET codebase="classes" code="DBapp/appletgui.class")

Also, I am using swing-layout-1.0.4.jar I think this might be part of my problem.
8 years ago
Ok well I figured it out. I remembered that the equals() method checks for value equality, that it compares the contents of two objects. And because null is not an object it was throwing an error. I have replaced it with..


which works correctly.
Thanks again guys,
8 years ago
to make it short... I am returning 15 columns of data from a SQL query I only want to display the first 4 rows but still retain the information to the initial 15 returned. Once I set the result to my TabelModel the remaining rows are lost. Heres the method...
8 years ago
Ignore me I figured it out...



But i am encountering an issue with my if then statement



I also tried

What is the proper way to check my Object[i].
8 years ago
Thanks for the reply. Now to clarify your saying instead of
Object[i] = 0.00;
use
Object[i] = BigDecimal.ZERO; This gives me an error Incompatible types String to BigDecimal.
8 years ago
I am attempting to convert an Object[] to String[] using this code

The problem is when the Object[] contains null values I need them to copied over and make sure the populated values maintain their place in the array. All of the values that could possibly return null are BigDecimal Type longs with 2 decimal places. They could be defaulted to 0.00 If I had to. Can I add something to my For loop to allow for this, something along the lines of...

???

Thanks in advance,
8 years ago
Ok,I get it and will make it from here. I appreciate your help.
8 years ago
I am a little confused with your exact answer...

So, set my result set to a vector and pass the vector into the TableModel?



8 years ago
@Koen Yes I tried that but get an error:

Java.sql.SQLException: Cursor state not valid.
8 years ago
Ok, so I am querying a databse and returning 15 columns of data. I want to be able to display the first 5 in a JTable but need to retain access to the rest of the data. So before I create my DefaultTableModel which only contains only the 5 collumns that go in my Jtable. I was trying to save my resultset to a String[][]. I am sure there is an easier way, this was the best I could come up with.



8 years ago
I want to use a ResultSet twice. The problem is that after I loop through the result set "while (resultSet.next())" I am not a able to loop through it again. I was looking at the stored values of the ResultSet while debugging. Before I loop through positionFromFirst_ =0 and positionFromFirst_ = -1 after I run through positionFromFirst_ = 2 and positionFromFirst_ = 0. Is there a way to reset these values so that I can loop though again. I believe this is my issue...
Thanks in advance,
8 years ago
Got it. I have never casted objects that way... I am somewhat new to Java and OOP, I appreciate your help and patience. I am actually excited, I can think of other ways I can use this in existing programs.
I think I understand what you are saying. I though that was what I was doing with the code below.



I tried... but none of the Connection class methods are working anymore. I apologize for my ignorance can you give me an example of how I would cast this class.




The way my connection works now I am using a built in login window. So i never get a chance to capture the login information I saw that the AS400() class has the ability to get the user id so that is why I am trying to get access to the methods of the AS400 class. If there is an easier way using the sql connection class to get the user id of the logged in account, please let me know. I am trying to work this out on my own but nothing seems to get me any closer.

Thanks for your help.
Was actually looking at that exact tutorial. So to clarify...

Since connectdb is an instance of Connection I need to create a new Connection class, lets call it MyConnection, that extends both Connection and AS4000JDBCDriver?



Does this logic sound correct?