• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Opening applet in IE Browser

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run my applet in appletviewer, it looks fine. When I run it in IE browser, it opens the box I created but not the entry text field. I get a tiny box in the left hand corner about 1/4 inches square with a tiny red square, green circle and blue triangle. When I run this on my instructor's machine and my machine at work, it works fine. All the machines have the same version of IE which is 5. I have a Dell 450 mhz machine. Does anyone have any ideas what I need to set differently? I have java JIT compiler enabled in my options.
 
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jo,
I don't normally use IE, so I'm not quite sure what the problem might be. If you are using Swing for your applet, is it possible that Swing has been enabled (for example, via the plug-in) on your instructor's machine and machine at work but not the one at home?
If you want to post your code, I would be happy to take a look at it.
Stephanie
 
Jo A Kiesow
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephanie, I don't think it is the code because it runs OK on other machines. I think it must be a setting on my machine. Maybe I should be posting this question elsewhere but I couldn't see an appropriate place.
Jo

Originally posted by Stephanie Grasson:
Jo,
I don't normally use IE, so I'm not quite sure what the problem might be. If you are using Swing for your applet, is it possible that Swing has been enabled (for example, via the plug-in) on your instructor's machine and machine at work but not the one at home?
If you want to post your code, I would be happy to take a look at it.
Stephanie


 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jo,
I think there may have been a misunderstanding. I was not implying that there was any problem with your code. I doubt there would be because, like you said, it runs fine on other machines. What I meant was, if the code used Swing (i.e., if your base class was JApplet instead of Applet), you might have to Swing-enable your browser to handle this. Swing is not automatically enabled for all browsers. There are different methods of doing so. One way is to download and install the plug-in from Sun.
One thing might help us determine what the problem is. When you open IE, before you attempt to load the page with your applet, open the Java console (by selecting "Java Console" from the View menu). Then load your applet. Do any errors or warnings appear? This could help us determine what the specific problem is.
Stephanie
 
Jo A Kiesow
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephanie,
Here is my java code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
public class Calculate extends Applet implements ActionListener
{
//create label for hours input field
Label hoursWorked = new Label("Enter hours worked");
//create input fields
TextField hours = new TextField("",3);
//create label for rate of pay input field
Label hourRate = new Label("Enter hourly rate of pay");
//create input fields
TextField rate = new TextField("",7);
//create label for calculated gross pay
Label grossPay = new Label("Gross Pay");
//create input fields
TextField gross = new TextField("",7);
//create label for calculated net pay
Label netPay = new Label("Net Pay");
//create input fields
TextField net = new TextField("",7);
//Create a button
Button pay = new Button("Click to calculate pay");
//Create the font
Font myNewFont = new Font("Courier",Font.BOLD,12);
//format for answer
DecimalFormat df = new DecimalFormat("$###,###,##0.00");



public void init()
{
hoursWorked.setFont(myNewFont);
add(hoursWorked);
add(hours);
hourRate.setFont(myNewFont);
add(hourRate);
add(rate);
grossPay.setFont(myNewFont);
add(grossPay);
gross.setEditable(false);
add(gross);
netPay.setFont(myNewFont);
add(netPay);
net.setEditable(false);
add(net);
pay.setFont(myNewFont);
add(pay);
pay.addActionListener(this);
//add focus listener
hours.addFocusListener(new MyFocusAdapter());
hours.requestFocus();

}
public void actionPerformed(ActionEvent thisEvent)
{



//figure gross pay
double hrs;
double rt;
double ansGross;
String ansString;
String ansString2;


hrs = Double.parseDouble((hours.getText()));
rt = Double.parseDouble((rate.getText()));
ansGross = hrs * rt;

//figure net income
double[] income = {0, 100.00, 300.00, 600.00};
double[] withHold = {.10,.15,.21,.28};

double wh;
boolean found = false;
double ansNet;
int sub = 3;

while(sub >0 && ansGross<income[sub])
--sub;

wh = withHold[sub];
found = true;
ansNet = (ansGross - (ansGross * wh));

ansString = df.format(ansGross);
gross.setText("" + ansString);
ansString2 = df.format(ansNet);
net.setText("" + ansString2);

invalidate();
validate();
}

class MyFocusAdapter extends FocusAdapter
{
public void focusGained(FocusEvent thisEvent)
{
hours.setText("");
rate.setText("");
gross.setText("");
net.setText("");
}
}
}
Here is my html code:

<HTML>
<APPLET CODE = "Calculate.class" WIDTH = 450 HEIGHT = 200>
</APPLET>
</HTML>
 
Jo A Kiesow
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephanie,
I also looked under the view menu in IE. There is no Java Console.
Jo
 
Ranch Hand
Posts: 147
Android Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jo,
You need to set an option in IE to see the JavaConsole menu item under "View".
To do this, go to TOOLS, INTERNET OPTIONS, click the ADVANCED tab, scroll down to MICROSOFT VM, and check the "Java Console enabled (requires restart)" checkbox. After restarting you browser, you should be able to see the option under VIEW.
 
Jo A Kiesow
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Glen.
I now have Java console available in my view. I ran my applet and did not get any error messages. However, when I went to the web page with my applet that did not work, I right clicked on the little box with the square, circle and triangle. I went to properties and got a picture of a sheet of paper with a turned down edge with a green/blue earth on the top. The message said this was not available. Does anyone know what this is?
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So that's it then. The browser can't find the applet on the server. Did you copy all the applet class files as well as the HTML if you moved it from one server to another? If all the files are there, you may need to post your HTML page, or at least the applet tag, for us to have a look at.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic