±Û¾´ÀÌ :Á¶½ÅÁ¦ 1998³â 7¿ù 25ÀÏ 23:50:51
In Reply to: ¾ÖÇø´ ÇÁ¸°Æ®ÇÏ´Â ¹æ¹ýÀº ¾î¶»°Ô ÇÏ¸é µÇÁÒ ? posted by ÃÖÁ¾Ã¶ on 1998³â 7¿ù 25ÀÏ 22:36:31:
import java.awt.*;
import java.awt.event.* ;
public class PP extends java.applet.Applet implements ActionListener {
Label status = new Label("Print ME !!");
Button prbtn = new Button("PRINT APPLET") ;
Frame _frame;
public void init() {
// setLayout(new FlowLayout(FlowLayout.CENTER,10,10)) ;
// test
Panel p = new Panel();
p.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
_frame = new Frame("Print test");
_frame.add(p);
_frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
_frame.setVisible(false);
}
});
p.add(status);
p.add(prbtn);
/*
add(status) ;
add(prbtn) ;
*/
prbtn.addActionListener(this) ;
_frame.setSize(400, 300);
_frame.show();
} // init
public Insets getInsets() { return new Insets(10,10,10,10); }
public void start() { }
public void stop() { }
public void actionPerformed (ActionEvent e) {
if (e.getSource() instanceof Button) {
PrintJob job = getToolkit().getPrintJob(_frame, "Print Test",null) ;
//(Properties)null) ;
if (job != null) {
Graphics pg = job.getGraphics() ;
if (pg != null) {
printAll(pg) ;
pg.dispose() ;
}
job.end() ;
}
} // instanceof Button
} // actionPerformed
} // top