Article View: borland.public.jbuilder.java.swing
Article #10076Printing from Applet.
From: Lena
Date: Tue, 16 Nov 1999 00:00
Date: Tue, 16 Nov 1999 00:00
75 lines
2606 bytes
2606 bytes
Hello All,
I have a serious problem with printing and may be it's Plug-in Bug.
For example, I write a very simple applet that drawing a string (see the
source).
If I run this applet in browser using HTML tags <APPLET> </APPLET> I can
print it. But if I run the same applet with tags <OBJECT> </OBJECT> (for
Plug-in) the browser prints out a black rectangle and I get an exception:
-------------------------------------
at sun.applet.AppletPanel.joinAppletThread(Unknown Source)
at sun.applet.AppletPanel.sendEvent(Unknown Source)
at sun.plugin.AppletViewer.onPrivateClose(Unknown Source)
at sun.plugin.AppletViewer$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
-------------------------------------
Does anyone know how to solve this problem? It's very important. Please
help.
Lena.
SOURCE
-------------------------------------
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Print_Applet extends Applet {
// Construct the applet
=====================================================
public Print_Applet() {
}
// Initialize the applet
====================================================
public void init() {
try {
setBackground(Color.white);
setForeground(new Color(128, 64, 64));
setFont(new Font("Courier", 1, 16));
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
// Paint Applet
=============================================================
public void paint(Graphics g) {
g.drawString("Loading Products Responsibilities Page", 100, 50);
g.drawString("Please wait...", 100, 100);
}
// Component initialization
=================================================
private void jbInit() throws Exception {
this.setSize(new Dimension(750,350));
}
// Get Applet information
===================================================
public String getAppletInfo() {
return "Applet Information";
}
// Get parameter info
=======================================================
public String[][] getParameterInfo() {
return null;
}
}
Technical Details
Message-ID:
<80r6mi$idl4@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,9d7b2d286a27d861,start X-Google-Attributes: gid111d45,public From: "Lena" <lena_t@rad.co.il> Subject: Printing from Applet. Date: 1999/11/16 Message-ID: <80r6mi$idl4@forums.borland.com> X-Deja-AN: 549200269 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.22 Newsgroups: borland.public.jbuilder.java.swing