miC.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
Color color=JColorChooser.showDialog(f, "颜色选择器皿", new Color(50,30,40));
JOptionPane.showMessageDialog(f, "我来警告你!!"+color.toString(), "警告框",JOptionPane.ERROR_MESSAGE);
}
});
miD.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
PrintJob pj=f.getToolkit().getPrintJob(f, "testPrinter", new JobAttributes(),new PageAttributes());
Graphics g=pj.getGraphics();
g.drawString("FlyingFish", 100, 100);
g.dispose();
pj.end();
}
});
java 操作颜色选择器和打印机实现打印功能【代码片段】
最新推荐文章于 2024-01-25 11:29:48 发布