Results 1 to 2 of 2
- 08-27-2009, 12:56 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 38
- Rep Power
- 0
Driving me insane - Program not working as it should ><
Hello,
I have four classes. Select, Login, Connect. I will break the situation down as the total code of my project is about 3000 lines and I doubt you want to shift through all that :p
Basically, MainGui uses Connect for a database connection. I have something like this set up:
The problem is, when I make a new object of this class in the Select class like so:public class MainGui extends javax.swing.JFrame implements Printable {
public MainGui() {
initComponents();
}
public String url = new String();
Connect conDatabase = new Connect(url);
It doesnt work, it cant connect to the database. The reason is, when I create a new Object of MainGui (MainGui m = new MainGui()) it loads the current configuration of MainGui before I can edit the url.private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
MainGui m = new MainGui();
m.url = "jdbc:mysql://91.266.176.244:3306/example_database"
m.setVisible(true);
}
Is it possible to set the m.url = "addy" before initalising the object?
- 08-27-2009, 01:20 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
Applet to HTML Driving me bonkers
By proud2bhaole in forum Java AppletsReplies: 6Last Post: 04-14-2010, 02:08 PM -
Working on a menu program...using exceptions
By Nightwarrior in forum New To JavaReplies: 0Last Post: 04-16-2009, 04:40 AM -
Program working fine on netbeans but not when run with jar file
By nvlachos in forum Advanced JavaReplies: 2Last Post: 03-16-2009, 07:52 PM -
Loop driving me loopy!!!!!
By soc86 in forum New To JavaReplies: 8Last Post: 01-16-2009, 01:00 AM -
My program is not working
By MICHAELABICK in forum New To JavaReplies: 6Last Post: 12-22-2008, 11:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks