您的位置:首页 > 编程语言 > Java开发

java 操作颜色选择器和打印机实现打印功能【代码片段】

2010-04-02 14:26 806 查看
  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