1 17 18 19 20 package org.apache.fop.render.awt.viewer; 21 22 import java.awt.AWTEvent ; 24 import java.awt.BorderLayout ; 25 import java.awt.Dialog ; 26 import java.awt.FlowLayout ; 27 import java.awt.Frame ; 28 import java.awt.GridLayout ; 29 30 import javax.swing.ImageIcon ; 31 import javax.swing.JButton ; 32 import javax.swing.JLabel ; 33 import javax.swing.JPanel ; 34 import javax.swing.border.EmptyBorder ; 35 import java.awt.event.ActionListener ; 36 import java.awt.event.WindowEvent ; 37 import java.awt.event.ActionEvent ; 38 39 import org.apache.fop.Version; 41 42 49 public class PreviewDialogAboutBox extends Dialog implements ActionListener { 50 private JButton okButton; 51 52 57 public PreviewDialogAboutBox(Frame parent, Translator translator) { 58 super(parent, true); 59 enableEvents(AWTEvent.WINDOW_EVENT_MASK); 60 setTitle(translator.getString("About.Title")); 61 setResizable(false); 62 JPanel panel1 = new JPanel (); 63 JPanel panel2 = new JPanel (); 64 JPanel insetsPanel1 = new JPanel (); 65 JPanel insetsPanel2 = new JPanel (); 66 JPanel insetsPanel3 = new JPanel (); 67 okButton = new JButton (); 68 JLabel imageControl1 = new JLabel (); 69 imageControl1.setIcon(new ImageIcon (getClass().getResource("images/fop.gif"))); 70 JLabel label1 = new JLabel (translator.getString("About.Product")); 71 JLabel label2 = new JLabel (translator.getString("About.Version") 72 + " " + Version.getVersion()); 73 JLabel label3 = new JLabel (translator.getString("About.Copyright")); 74 panel1.setLayout(new BorderLayout ()); 75 panel2.setLayout(new BorderLayout ()); 76 insetsPanel1.setLayout(new FlowLayout ()); 77 insetsPanel2.setLayout(new FlowLayout ()); 78 insetsPanel2.setBorder(new EmptyBorder (10, 10, 10, 10)); 79 insetsPanel3.setLayout(new GridLayout (3, 1)); 80 insetsPanel3.setBorder(new EmptyBorder (10, 10, 10, 10)); 81 okButton.setText(translator.getString("Button.Ok")); 82 okButton.addActionListener(this); 83 insetsPanel2.add(imageControl1, null); 84 panel2.add(insetsPanel2, BorderLayout.WEST); 85 insetsPanel3.add(label1); 86 insetsPanel3.add(label2); 87 insetsPanel3.add(label3); 88 panel2.add(insetsPanel3, BorderLayout.CENTER); 89 insetsPanel1.add(okButton); 90 panel1.add(insetsPanel1, BorderLayout.SOUTH); 91 panel1.add(panel2, BorderLayout.NORTH); 92 add(panel1); 93 pack(); 94 } 95 96 99 protected void processWindowEvent(WindowEvent e) { 100 if (e.getID() == WindowEvent.WINDOW_CLOSING) { 101 cancel(); 102 } 103 super.processWindowEvent(e); 104 } 105 106 private void cancel() { 107 dispose(); 108 } 109 110 113 public void actionPerformed(ActionEvent e) { 114 if (e.getSource() == okButton) { 115 cancel(); 116 } 117 } 118 } 119 120 | Popular Tags |