1 28 import javax.swing.JButton ; 29 import javax.swing.JOptionPane ; 30 31 import net.sf.jasperreports.engine.JRException; 32 import net.sf.jasperreports.engine.JasperPrint; 33 import net.sf.jasperreports.view.JRViewer; 34 35 36 40 public class JRViewerPlus extends JRViewer 41 { 42 43 44 47 protected JButton btnPlus = new javax.swing.JButton (); 48 49 50 53 public JRViewerPlus(JasperPrint jrPrint) throws JRException 54 { 55 super(jrPrint); 56 57 tlbToolBar.remove(btnSave); 58 tlbToolBar.remove(btnReload); 59 60 btnPlus = new javax.swing.JButton (); 61 btnPlus.setToolTipText("Plus..."); 62 btnPlus.setText("Plus..."); 63 btnPlus.setPreferredSize(new java.awt.Dimension (80, 23)); 64 btnPlus.setMaximumSize(new java.awt.Dimension (80, 23)); 65 btnPlus.setMinimumSize(new java.awt.Dimension (80, 23)); 66 btnPlus.addActionListener(new java.awt.event.ActionListener () { 67 public void actionPerformed(java.awt.event.ActionEvent evt) { 68 btnPlusActionPerformed(evt); 69 } 70 }); 71 tlbToolBar.add(btnPlus, 0); 72 } 73 74 75 78 protected void setZooms() 79 { 80 this.zooms = new int[]{33, 66, 100, 133, 166, 200, 233}; 81 this.defaultZoomIndex = 2; 82 } 83 84 85 88 protected void btnPlusActionPerformed(java.awt.event.ActionEvent evt) 89 { 90 JOptionPane.showMessageDialog(this, "I just wanted to let you know that you can extend the JRViewer to customize it.\n The button you have pushed was added this way."); 91 } 92 93 94 } 95 | Popular Tags |