打印问题
来源: 互联网 发布时间:2015-11-11
本文导语: 怎么把表格都打印出来 | /** JPEGEditor Image of earth from http://earth.jsc.nasa.gov/ */ import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.util.*; import java.io.*; import javax.swing.*; import java...
怎么把表格都打印出来
|
/**
JPEGEditor
Image of earth from http://earth.jsc.nasa.gov/
*/
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.*;
public class JPEGEditor extends JFrame
{
public final static Dimension VERTICAL_RIGID_SIZE
= new Dimension(1,3);
public final static Dimension HORIZONTAL_RIGID_SIZE
= new Dimension(3,1);
protected File m_currentDir = new File(".");
protected File m_currentFile = null;
protected JFileChooser m_chooser;
protected JPEGPanel m_panel;
protected JSlider m_slHorzDensity;
protected JSlider m_slVertDensity;
protected JSlider m_slQuality;
protected BufferedImage m_bi1, m_bi2;
public JPEGEditor() {
super("JPEG Editor");
setSize(600, 400);
m_chooser = new JFileChooser();
SimpleFilter filter = new SimpleFilter("jpg",
"JPEG Image Files");
m_chooser.setFileFilter(filter);
m_chooser.setCurrentDirectory(m_currentDir);
m_panel = new JPEGPanel();
JScrollPane ps = new JScrollPane(m_panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
getContentPane().add(ps, BorderLayout.CENTER);
JPanel p, p1;
m_slVertDensity = new JSlider(JSlider.VERTICAL,
100, 500, 300);
m_slVertDensity.setExtent(50);
m_slVertDensity.setPaintLabels(true);
m_slVertDensity.setMajorTickSpacing(100);
m_slVertDensity.setMinorTickSpacing(50);
m_slVertDensity.setPaintTicks(true);
m_slVertDensity.putClientProperty("JSlider.isFilled", Boolean.TRUE);
p = new JPanel();
p.setBorder(new TitledBorder(new EtchedBorder(),
"Vert. dens."));
p.add(Box.createRigidArea(HORIZONTAL_RIGID_SIZE));
p.add(m_slVertDensity);
p.add(Box.createRigidArea(HORIZONTAL_RIGID_SIZE));
getContentPane().add(p, BorderLayout.EAST);
m_slHorzDensity = new JSlider(JSlider.HORIZONTAL,
100, 500, 300);
m_slHorzDensity.setExtent(50);
m_slHorzDensity.setPaintLabels(true);
m_slHorzDensity.setMajorTickSpacing(100);
m_slHorzDensity.setMinorTickSpacing(50);
m_slHorzDensity.setPaintTicks(true);
m_slHorzDensity.putClientProperty("JSlider.isFilled", Boolean.TRUE);
p = new JPanel();
p.setBorder(new TitledBorder(new EtchedBorder(),
"Horizontal density"));
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
p.add(Box.createRigidArea(VERTICAL_RIGID_SIZE));
p.add(m_slHorzDensity);
p.add(Box.createRigidArea(VERTICAL_RIGID_SIZE));
p1 = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p1.add(p);
m_slQuality = new JSlider(JSlider.HORIZONTAL,
0, 100, 100);
Hashtable labels = new Hashtable(6);
for (float q = 0; q
JPEGEditor
Image of earth from http://earth.jsc.nasa.gov/
*/
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.*;
public class JPEGEditor extends JFrame
{
public final static Dimension VERTICAL_RIGID_SIZE
= new Dimension(1,3);
public final static Dimension HORIZONTAL_RIGID_SIZE
= new Dimension(3,1);
protected File m_currentDir = new File(".");
protected File m_currentFile = null;
protected JFileChooser m_chooser;
protected JPEGPanel m_panel;
protected JSlider m_slHorzDensity;
protected JSlider m_slVertDensity;
protected JSlider m_slQuality;
protected BufferedImage m_bi1, m_bi2;
public JPEGEditor() {
super("JPEG Editor");
setSize(600, 400);
m_chooser = new JFileChooser();
SimpleFilter filter = new SimpleFilter("jpg",
"JPEG Image Files");
m_chooser.setFileFilter(filter);
m_chooser.setCurrentDirectory(m_currentDir);
m_panel = new JPEGPanel();
JScrollPane ps = new JScrollPane(m_panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
getContentPane().add(ps, BorderLayout.CENTER);
JPanel p, p1;
m_slVertDensity = new JSlider(JSlider.VERTICAL,
100, 500, 300);
m_slVertDensity.setExtent(50);
m_slVertDensity.setPaintLabels(true);
m_slVertDensity.setMajorTickSpacing(100);
m_slVertDensity.setMinorTickSpacing(50);
m_slVertDensity.setPaintTicks(true);
m_slVertDensity.putClientProperty("JSlider.isFilled", Boolean.TRUE);
p = new JPanel();
p.setBorder(new TitledBorder(new EtchedBorder(),
"Vert. dens."));
p.add(Box.createRigidArea(HORIZONTAL_RIGID_SIZE));
p.add(m_slVertDensity);
p.add(Box.createRigidArea(HORIZONTAL_RIGID_SIZE));
getContentPane().add(p, BorderLayout.EAST);
m_slHorzDensity = new JSlider(JSlider.HORIZONTAL,
100, 500, 300);
m_slHorzDensity.setExtent(50);
m_slHorzDensity.setPaintLabels(true);
m_slHorzDensity.setMajorTickSpacing(100);
m_slHorzDensity.setMinorTickSpacing(50);
m_slHorzDensity.setPaintTicks(true);
m_slHorzDensity.putClientProperty("JSlider.isFilled", Boolean.TRUE);
p = new JPanel();
p.setBorder(new TitledBorder(new EtchedBorder(),
"Horizontal density"));
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
p.add(Box.createRigidArea(VERTICAL_RIGID_SIZE));
p.add(m_slHorzDensity);
p.add(Box.createRigidArea(VERTICAL_RIGID_SIZE));
p1 = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p1.add(p);
m_slQuality = new JSlider(JSlider.HORIZONTAL,
0, 100, 100);
Hashtable labels = new Hashtable(6);
for (float q = 0; q