• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't get applet to display

 
kelly rice
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm extremely new at this. can't get applet to display outside of development environment(JBuilder 2.01). here's my .java code:
//Description: Your description
package sortboxes;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
import com.sun.java.swing.*;
import java.util.*;
import com.sun.java.swing.event.*;
//import com.sun.java.swing.UIManager;
public class sortboxes extends Applet {
XYLayout xYLayout1 = new XYLayout();
boolean isStandalone = false;
ButtonControl buttonControl1 = new ButtonControl();
ButtonControl buttonControl2 = new ButtonControl();
TextControl textControl1 = new TextControl();
TextControl textControl2 = new TextControl();
List list1;
private transient Vector listDataListeners;
private transient Vector itemListeners;
List list2 = new List();
//Construct the applet
public sortboxes() {
}
//Initialize the applet
public void init() {
String infoString1 = (getParameter("info1"));
String infoString2 = (getParameter("info2"));
String infoString3 = (getParameter("info3"));
String infoString4 = (getParameter("info4"));
String infoString5 = (getParameter("info5"));

String info1 = infoString1;
String info2 = infoString2;
String info3 = infoString3;
String info4 = infoString4;
String info5 = infoString5;
list1 = new List(15, false);
list1.add(info1);
list1.add(info2);
list1.add(info3);
list1.add(info4);
list1.add(info5);
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setBackground(Color.lightGray);
xYLayout1.setWidth(497);
xYLayout1.setHeight(300);
buttonControl1.setFont(new Font("Helvetica", 1, 12));
buttonControl1.setLabel(">>");
buttonControl1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
buttonControl1_actionPerformed(e);
}
});
buttonControl2.setFont(new Font("Helvetica", 1, 12));
buttonControl2.setLabel("<<");
buttonControl2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
buttonControl2_actionPerformed(e);
}
});
textControl1.setForeground(new Color(0, 0, 131));
textControl1.setFont(new Font("Helvetica", 1, 12));
textControl1.setText("SORT BY");
textControl2.setText("SORT ORDER");
list2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
list2_actionPerformed(e);
}
});
list1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
list1_actionPerformed(e);
}
});
textControl2.setForeground(new Color(0, 0, 131));
textControl2.setFont(new Font("Helvetica", 1, 12));
this.setLayout(xYLayout1);
this.add(buttonControl1, new XYConstraints(227, 96, 26, 28));
this.add(buttonControl2, new XYConstraints(228, 151, 26, 28));
this.add(textControl1, new XYConstraints(77, 24, 70, 21));
this.add(textControl2, new XYConstraints(348, 26, 93, 21));
this.add(list1, new XYConstraints(48, 63, 171, 146));
this.add(list2, new XYConstraints(272, 63, 171, 146));
}
//Start the applet
public void start() {
}
//Stop the applet
public void stop() {
}
//Destroy the applet
public void destroy() {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info

//public String[][] getParameterInfo() {
//return infoString;
void list1_actionPerformed(ActionEvent e) {
String selection1;
selection1 = list1.getSelectedItem();
list1.remove(selection1);
list2.add(selection1);
}
void list2_actionPerformed(ActionEvent e) {
String selection1;
selection1 = list2.getSelectedItem();
list2.remove(selection1);
list1.add(selection1);
}
void buttonControl1_actionPerformed(ActionEvent e) {
String selection1;
selection1 = list1.getSelectedItem();
list1.remove(selection1);
list2.add(selection1);
}
void buttonControl2_actionPerformed(ActionEvent e) {
String selection1;
selection1 = list2.getSelectedItem();
list2.remove(selection1);
list1.add(selection1);
}
}
//}
ok. so, i've put my class file and a .jar, and a .zip file all in one folder. i've tried using deployment wizard to make these files. i'm having no luck. currently, i get this message at the bottom of the browser window that says:
Load: sortboxes.sortboxes can't be instantiated
i chose applet when first making the project. i tried making it choosing class. wasn't able to get it to work that way...now i'm totally confused. i've tried messing w/the ARCHIVE, CODEBASE and CODE attributes, but i've had no luck. i keep looking for answers, and no luck. thanks for any help. please email if you have any questions. and if you can try to answer in easy terms that would be helpful.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kelly,
Your problem is that your class is importing and using these two packages:

These are sets of classes that were created by Borland and thus are not part of the common Java environment. To get your class to run as an application outside of JBuilder you would have to add these packages to your CLASSPATH, to get your class to run as an applet you would have these packages on the server with your classes and if they are in a JAR file, add that JAR file to your ARCHIVE attribute.
Be wary of using non-standard packages (i.e. packages that do not start with java. ) When you distribute your classes, you will need to distribute the non-standard classes along with the classes you created.
Did you write all of the code yourself, or did you have JBuilder create some of it? I would think that JBuilder did some kind of automatic code generation or GUI building to use a non-standard class provided by Borland... just another reason not to use JBuilder to write code... ( Sorry, just a personal peeve. My company is using that wonder-of-bloated-code JBuilder...)
HTH,
-Nate
P.S. - You are also using some Swing components... most browsers have an old version of the JRE and are not able to run applets that use Swing components unless it is using the Java Plugin from Sun.
[This message has been edited by Nathan Pruett (edited February 28, 2001).]
 
kelly rice
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply. i actually just figured this out an hour or so ago. i'm trying to work w/layout, and it's been really frustrating. i've switched my controls to awt. just having trouble getting controls to show up. i'm just hoping that after i change all this over; i'll be able to view the applet outside of jbuider(*fingers crossed*). i'm not a big fan of jbuilder either. why import crap into your project that you can't even use in real life? to answer your question: some of that code was me and some of it was jbuilder. i'm familiar w/programming...just not in java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic