# question ? ..

Enrique Martinez (enrimart@bsantander.com.mx)
Mon, 21 Sep 1998 13:21:44 -0600

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Richard Bland: "C2 Compliance"
- Previous message: Kailash 2: "Security issue"

I work in M=E9xico Santander bank`s systems, and we have to give a
financial module Intranet with controls printing as soon as poosible.
our module

is about HTML, JAVA and JavaScrpit.

My question is: An applet can print since a communicator Netscape 4.03?

Because i load the next applet and the java console display a message :

# Applet exception: error: java.lang.NoSuchMethodError:
java.awt.Toolkit: method getPrintJob
(Ljava/awt/Frame;Ljava/lang/String;Ljava/util/Properties;)Ljava/awt/Print=
Job;

not found
java.lang.NoSuchMethodError: java.awt.Toolkit: method getPrintJob
(Ljava/awt/Frame;Ljava/lang/String;Ljava/util/Properties;)Ljava/awt/Print=
Job;

not found

APPLET :

import java.awt.*;
import java.awt.Toolkit;

import java.awt.Canvas;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.event.*;
import java.applet.Applet;
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class App extends Applet implements Runnable {
Button b;
GraphPanel panel;
PrintingTest pt;

public synchronized void run() { }
public void init() {

pt =3D new PrintingTest();
pt.show();
setLayout(new BorderLayout());

panel =3D new GraphPanel(this);
add("Center", panel);

b =3D new Button("click");
add("South", b);

}

public synchronized boolean action(Event event, Object what) {
if (event.target instanceof Button) {
System.out.println("ENTRA A ACTION");
}
return true;
}
}

class GraphPanel extends Panel implements Runnable {
App graph;

GraphPanel(App graph) {
this.graph =3D graph;
}

public void run() {

}
public void paint(Graphics g) {

g.setColor(Color.yellow);
g.fillRect(0, 0,200, 80);

g.setColor(Color.blue);
g.drawLine(0, 0, 200, 80);

g.setColor(Color.red);
g.drawLine(0, 80, 200, 0);
}

public void start() { }
public void stop() { }
}

class PrintingTest extends Frame {

PrintCanvas canvas;

public PrintingTest() {
super("Printing Test");
canvas =3D new PrintCanvas();
add("Center", canvas);

Button b =3D new Button("Print");
// b.setActionCommand("print");
// b.addActionListener(this);
add("South", b);

pack();
}

public synchronized boolean action(Event event, Object what) {
if (event.target instanceof Button) {
System.out.println("ENTRA A ACTION frame");

PrintJob pjob =3D getToolkit().getPrintJob(this, "Printing Test",
null);
if (pjob !=3D null) {
Graphics pg =3D pjob.getGraphics();

if (pg !=3D null) {
canvas.printAll(pg);
pg.dispose(); // flush page
}
pjob.end();

}
}
return true;
}

}

class PrintCanvas extends Canvas {

public Dimension getPreferredSize() {
return new Dimension(100, 100);
}

public void paint(Graphics g) {

g.setColor(Color.yellow);
g.fillRect(0, 0,200, 80);

g.setColor(Color.blue);
g.drawLine(0, 0, 200, 80);

g.setColor(Color.red);
g.drawLine(0, 80, 200, 0);
}
}

I have installed JDK1.1.5 Windows 95
my CLASSPATH is : set CLASSPATH=3DC:\jdk1.1.5\lib\classes.zip;

I have problems about Interface java.awt.event.ActionListener, because
when i set b.setActionCommand("print"); java console display similar
error message.

I have problems about demos JDK115 ver 1.1. the Netscape communicator
4.03 can`t load applets. java console display for example:

# Applet exception: error: java.lang.NoSuchMethodError:
java.awt.Component: method getSize ()Ljava/awt/Dimension; not found
java.lang.NoSuchMethodError: java.awt.Component: method getSize
()Ljava/awt/Dimension; not found

What have i do, in order to load applets ver 1.1?
What have i do, in order to print a Graphic on the applet.in JDK1.1.5?
Has a troubble Communicator Netscape 4.03 or it need a configuration?
Only an application can call methods Print PrintJob?
JDK1.2 beta 4 let an applet calls methods Print PrinterJob?
Have you some example Applet that printing pages of some job?

my e-mail : enrimart@bsantander.com.mx

Thanks

- Next message: Richard Bland: "C2 Compliance"
- Previous message: Kailash 2: "Security issue"