【初心者】Java質問・相談スレッド56【大歓迎】
■ このスレッドは過去ログ倉庫に格納されています
0413410
NGNG<class PrinterActionListener>
class PrinterActionListener implements ActionListener{
public void actionPerformed(ActionEvent e){
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
PrintService service = ServiceUI.printDialog(null, 200, 200,printService, defaultService, flavor, pras);
try{
if (service != null) {
DocPrintJob job = service.createPrintJob();
DocAttributeSet das = new HashDocAttributeSet();
Doc Pdoc = new SimpleDoc(new Mycomponent(),flavor,das);
job.print(Pdoc,pras);
Thread.sleep(10000);
}}catch(Exception eee){
System.out.println(eee);
}}}
■ このスレッドは過去ログ倉庫に格納されています