S
scottrbutler
I have created an applet using netbeans IDE. When I run the project in
the IDE it does what it is supposed to do but when I open the HTML
page, the one the IDE created, I get nothing. I see where the applet
should be but the content isn't there and there is no idication of an
error.
I don't usually program in Java but this is something that I have to do
in java so any help would be appreciated.
Here is the HTML:
<HTML>
<HEAD>
<TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>
<!--
*** GENERATED applet HTML launcher - DO NOT EDIT IN 'BUILD' FOLDER
***
If you need to modify this HTML launcher file (e.g., to add applet
parameters),
copy it to where your applet class is found in the SRC folder. If you
do this,
the IDE will use it when you run or debug the applet.
Tip: To exclude an HTML launcher from the JAR file, use exclusion
filters in
the Packaging page in the Project Properties dialog.
For more information see the online help.
-->
<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
<P>
<APPLET
codebase="file:/C:/Documents%20and%20Settings/Scott/JavaProjects/WCZone/build/classes/"
code="com/suborno/ViewEvents.class" width=350 height=200></APPLET>
</P>
<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>
And the Class:
/*
* Test.java
*
* Created on July 30, 2005, 1:25 PM
*/
package com.suborno;
import java.*;
import java.sql.*;
/**
*
* @author Scott
*/
public class ViewEvents extends java.applet.Applet {
private String numDays;
private String country;
private String stateProvince;
private String output;
/** Initializes the applet Test */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
// get params from web page for search criteria
String s;
s = getParameter("numDays");
if (s != null)
numDays = s;
s = getParameter("country");
if (s != null)
country = s;
s = getParameter("stateProvince");
if (s != null)
stateProvince = s;
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
mainWindow = new javax.swing.JEditorPane();
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jScrollPane1.setMinimumSize(new java.awt.Dimension(350, 500));
jScrollPane1.setPreferredSize(new java.awt.Dimension(350,
500));
mainWindow.setBorder(null);
mainWindow.setEditable(false);
mainWindow.setAlignmentX(10.0F);
mainWindow.setAlignmentY(10.0F);
mainWindow.setContentType("text/html");
mainWindow.setMinimumSize(new java.awt.Dimension(350, 500));
mainWindow.setPreferredSize(new java.awt.Dimension(350, 500));
jScrollPane1.setViewportView(mainWindow);
add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 570, 350));
}
// </editor-fold>
public void start() {
Connect nikkenDB = new Connect();
//java.sql.ResultSet rs = null;
String query = "SELECT * FROM vw_Events";
Statement stmt = null;
ResultSet rs = null;
StringBuilder output = new StringBuilder();
try {
stmt = nikkenDB.getConnection().createStatement();
rs = stmt.executeQuery("SELECT * FROM vw_Events ORDER BY
EventDateAsDate");
output.append("<table border='1' cellpadding='1'
cellspacing='2'>");
output.append("<tr><th>Date</th><th>Time</th><th>Event
Type</th><th>Location</th><th>Contact</th></tr>");
while(rs.next()){
output.append("<tr>");
output.append("<td>");
output.append(rs.getString("EventDate"));
output.append("</td>");
output.append("<td>");
output.append(rs.getString("EventStartTime"));
output.append("</td>");
output.append("<td align='center'>");
output.append(rs.getString("EventAbbr"));
output.append("</td>");
output.append("<td>");
output.append(rs.getString("Location"));
output.append("</td>");
output.append("<td>");
output.append("<a href='" + rs.getString("Email") +"'>" +
rs.getString("ContactName") + "</a>");
output.append("</td>");
output.append("</tr>");
}
output.append("</table>");
mainWindow.setText(output.toString());
rs.close();
rs = null;
stmt.close();
stmt = null;
}
catch(Exception e){
mainWindow.setText(e.getMessage());
e.printStackTrace();
}
finally {
nikkenDB.closeConnection();
}
}
// Variables declaration - do not modify
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JEditorPane mainWindow;
// End of variables declaration
}
the IDE it does what it is supposed to do but when I open the HTML
page, the one the IDE created, I get nothing. I see where the applet
should be but the content isn't there and there is no idication of an
error.
I don't usually program in Java but this is something that I have to do
in java so any help would be appreciated.
Here is the HTML:
<HTML>
<HEAD>
<TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>
<!--
*** GENERATED applet HTML launcher - DO NOT EDIT IN 'BUILD' FOLDER
***
If you need to modify this HTML launcher file (e.g., to add applet
parameters),
copy it to where your applet class is found in the SRC folder. If you
do this,
the IDE will use it when you run or debug the applet.
Tip: To exclude an HTML launcher from the JAR file, use exclusion
filters in
the Packaging page in the Project Properties dialog.
For more information see the online help.
-->
<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
<P>
<APPLET
codebase="file:/C:/Documents%20and%20Settings/Scott/JavaProjects/WCZone/build/classes/"
code="com/suborno/ViewEvents.class" width=350 height=200></APPLET>
</P>
<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>
And the Class:
/*
* Test.java
*
* Created on July 30, 2005, 1:25 PM
*/
package com.suborno;
import java.*;
import java.sql.*;
/**
*
* @author Scott
*/
public class ViewEvents extends java.applet.Applet {
private String numDays;
private String country;
private String stateProvince;
private String output;
/** Initializes the applet Test */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
// get params from web page for search criteria
String s;
s = getParameter("numDays");
if (s != null)
numDays = s;
s = getParameter("country");
if (s != null)
country = s;
s = getParameter("stateProvince");
if (s != null)
stateProvince = s;
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
mainWindow = new javax.swing.JEditorPane();
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jScrollPane1.setMinimumSize(new java.awt.Dimension(350, 500));
jScrollPane1.setPreferredSize(new java.awt.Dimension(350,
500));
mainWindow.setBorder(null);
mainWindow.setEditable(false);
mainWindow.setAlignmentX(10.0F);
mainWindow.setAlignmentY(10.0F);
mainWindow.setContentType("text/html");
mainWindow.setMinimumSize(new java.awt.Dimension(350, 500));
mainWindow.setPreferredSize(new java.awt.Dimension(350, 500));
jScrollPane1.setViewportView(mainWindow);
add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 570, 350));
}
// </editor-fold>
public void start() {
Connect nikkenDB = new Connect();
//java.sql.ResultSet rs = null;
String query = "SELECT * FROM vw_Events";
Statement stmt = null;
ResultSet rs = null;
StringBuilder output = new StringBuilder();
try {
stmt = nikkenDB.getConnection().createStatement();
rs = stmt.executeQuery("SELECT * FROM vw_Events ORDER BY
EventDateAsDate");
output.append("<table border='1' cellpadding='1'
cellspacing='2'>");
output.append("<tr><th>Date</th><th>Time</th><th>Event
Type</th><th>Location</th><th>Contact</th></tr>");
while(rs.next()){
output.append("<tr>");
output.append("<td>");
output.append(rs.getString("EventDate"));
output.append("</td>");
output.append("<td>");
output.append(rs.getString("EventStartTime"));
output.append("</td>");
output.append("<td align='center'>");
output.append(rs.getString("EventAbbr"));
output.append("</td>");
output.append("<td>");
output.append(rs.getString("Location"));
output.append("</td>");
output.append("<td>");
output.append("<a href='" + rs.getString("Email") +"'>" +
rs.getString("ContactName") + "</a>");
output.append("</td>");
output.append("</tr>");
}
output.append("</table>");
mainWindow.setText(output.toString());
rs.close();
rs = null;
stmt.close();
stmt = null;
}
catch(Exception e){
mainWindow.setText(e.getMessage());
e.printStackTrace();
}
finally {
nikkenDB.closeConnection();
}
}
// Variables declaration - do not modify
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JEditorPane mainWindow;
// End of variables declaration
}