Results 1 to 4 of 4
Thread: JOptionPane wont show up.
- 02-09-2012, 03:26 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 27
- Rep Power
- 0
JOptionPane wont show up.
i have a main class which is a JFrame it call as class called priceCheck()
obviously i can't have a panel or jframe for the first parameter for the JOptionPane so i heard you can have null and it should still appear but for some reason this dialog box isn't appearing. and i can't think of any reason why it isn't i have tried a System.out.println and it is getting to the classJava Code:public class priceCheck { public priceCheck(String barcode) { try { DriverManager.registerDriver(new com.mysql.jdbc.Driver()); Connection conn = DriverManager.getConnection("jdbc:mysql://samp.inf.brad.ac.uk/dcalladi", "dcalladi", "Dannys21"); ResultSet rs = conn.createStatement().executeQuery("select Name, FORMAT(Cost,2),Stock_Level where Barcode = " + barcode + ""); while (rs.next()){ JOptionPane.showMessageDialog(null, "Name : "+rs.getString(1)+" Cost : "+rs.getString(2)+" Current Stock "+rs.getString(3)+""); conn.close(); } } catch (Exception ex) { } } }
-
Re: JOptionPane wont show up.
You probably wouldn't ever consider driving a car with a blindfold on, right? Likewise, don't ignore exceptions with an empty catch block unless you simply don't want to know why your code's not working. At least print a stack trace.
- 02-09-2012, 06:26 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 27
- Rep Power
- 0
Re: JOptionPane wont show up.
Fixed my own problem got a bit of code blindness with the catch and the sql statement for got to enter into the statement the table im getting the results from silly me
-
Similar Threads
-
Applet Wont Show Supposed Output, Please Help
By bdmchamp in forum Java AppletsReplies: 2Last Post: 06-29-2011, 01:54 PM -
Applet Wont Show Supposed Output, Please Help!!!!
By bdmchamp in forum New To JavaReplies: 7Last Post: 06-26-2011, 11:43 PM -
Graphics wont show up(paintComponent)
By TheBreadCat in forum New To JavaReplies: 3Last Post: 02-13-2011, 06:00 PM -
wont show entire JLabel
By Billaguana in forum AWT / SwingReplies: 6Last Post: 02-03-2011, 10:18 PM -
How do i show all the values in one window(JOptionPane)??
By Antonioj1015 in forum Advanced JavaReplies: 1Last Post: 11-25-2009, 04:17 PM


3Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks