for (int id=1; id <= NUMTABS; id++) {
String name = "Tab " + new Integer(id);
PaintText ptt = new PaintText(id);
p.add(name, ptt);
book.append(ptt, pf);
}
pjob.setPageable(book);
JFrame f = new JFrame();
f.add(BorderLayout.CENTER, p);
f.addWindowListener(new WindowAdapter() { publicvoid windowClosing(WindowEvent e) {System.exit(0);}
});
f.pack();
f.show();
/* Non-jtreg execution will display the dialog */ if (System.getProperty("test.jdk") == null) { if (!pjob.printDialog()) { return;
}
} try {
pjob.print();
} catch (PrinterException e) { thrownew RuntimeException(e.getMessage());
} finally {
f.dispose();
}
}
public Dimension getMinimumSize() { return getPreferredSize();
}
public Dimension getPreferredSize() { returnnew Dimension(preferredSize, preferredSize);
}
publicvoid paint(Graphics g) {
/* fill with white before any transformation is applied */
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width, getSize().height);
Graphics2D g2d = (Graphics2D)g;
Font f = new Font(Font.DIALOG, Font.PLAIN, 40);
Color c = new Color(0,0,255,96);
Paint p = new GradientPaint(0f, 0f, Color.green, 10f, 10f, Color.red, true);
String s = "Sample Text To Paint"; float x = 20, y= 50;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.