去这看看,看看有没有用。
http://manning.spindoczine.com/sbe/files/uts2/Chapter22html/Chapter22.htm

解决方案 »

  1.   

    给我一份,好吗?
    [email protected]
      

  2.   

    Please email to me ! 
    Thank You!
    [email protected]
      

  3.   

    算我一分:[email protected]
    谢谢!
      

  4.   

    还有我 [email protected]
      

  5.   

    还有我[email protected]
    谢谢!!!
      

  6.   

    如果不麻烦的话给我一份好吗?
    [email protected]
      

  7.   

    我也想读一读。
    [email protected]
      

  8.   

    昨天没过来看,多谢大家关注!!烦请javafounder(漂流) 发到我的信箱里[email protected]
    多谢拉!收到后肯定给分!
      

  9.   

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.util.*;
    import java.io.*;import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;import com.sun.image.codec.jpeg.*;import java.awt.print.*;// Unchanged code from section 13.4public class JPEGEditor extends JFrame 
    {
      // Unchanged code from section 13.4  protected JMenuBar createMenuBar() {
        // Unchanged code from section 13.4    mItem = new JMenuItem("Print...");
        mItem.setMnemonic('p');
        ActionListener lstPrint = new ActionListener() { 
          public void actionPerformed(ActionEvent e) {
            Thread runner = new Thread() {
              public void run() { 
                if (m_panel.getBufferedImage() != null)
                  printData();
              }
            };
            runner.start();
          }
        };
        mItem.addActionListener(lstPrint);
        mFile.add(mItem);
        mFile.addSeparator();    mItem = new JMenuItem("Exit");
        mItem.setMnemonic('x');
        lst = new ActionListener() { 
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        };
        mItem.addActionListener(lst);
        mFile.add(mItem);
        menuBar.add(mFile);
        return menuBar;
      }  // Unchanged code from section 13.4  public void printData() {
        getJMenuBar().repaint();
        try {
          PrinterJob prnJob = PrinterJob.getPrinterJob();
          prnJob.setPrintable(m_panel);
          if (!prnJob.printDialog())
            return;
          setCursor( Cursor.getPredefinedCursor(
            Cursor.WAIT_CURSOR));
          prnJob.print();
          setCursor( Cursor.getPredefinedCursor(
            Cursor.DEFAULT_CURSOR));
          JOptionPane.showMessageDialog(this, 
            "Printing completed successfully", "JPEGEditor2",
            JOptionPane.INFORMATION_MESSAGE);
        }
        catch (PrinterException e) {
          e.printStackTrace();
          System.err.println("Printing error: "+e.toString());
        }
      }  public static void main(String argv[]) {
        new JPEGEditor();
      }
    }class JPEGPanel extends JPanel implements Printable
    {
      protected BufferedImage m_bi = null;  public int m_maxNumPage = 1;  // Unchanged code from section 13.4  public int print(Graphics pg, PageFormat pageFormat,
       int pageIndex) throws PrinterException {
        if (pageIndex >= m_maxNumPage || m_bi == null)
          return NO_SUCH_PAGE;    pg.translate((int)pageFormat.getImageableX(), 
          (int)pageFormat.getImageableY());
        int wPage = (int)pageFormat.getImageableWidth();
        int hPage = (int)pageFormat.getImageableHeight();    int w = m_bi.getWidth(this);
        int h = m_bi.getHeight(this);
        if (w == 0 || h == 0)
          return NO_SUCH_PAGE;
        int nCol = Math.max((int)Math.ceil((double)w/wPage), 1);
          int nRow = Math.max((int)Math.ceil((double)h/hPage), 1);
        m_maxNumPage = nCol*nRow;    int iCol = pageIndex % nCol;
        int iRow = pageIndex / nCol;
        int x = iCol*wPage;
        int y = iRow*hPage;
        int wImage = Math.min(wPage, w-x);
        int hImage = Math.min(hPage, h-y);    pg.drawImage(m_bi, 0, 0, wImage, hImage, 
          x, y, x+wImage, y+hImage, this);
        System.gc();
            
        return PAGE_EXISTS;
      }
    }
      

  10.   

    给我也来份吧。:)
    [email protected]
      

  11.   

    [email protected]
    来晚了不知道还能否给我一份谢谢
      

  12.   

    我刚看到这份帖子,给我一份吧![email protected]