1 18 package org.apache.batik.apps.svgbrowser; 19 20 import java.awt.BorderLayout ; 21 import java.awt.Component ; 22 import java.awt.FlowLayout ; 23 import java.awt.LayoutManager ; 24 import java.awt.event.ActionEvent ; 25 import java.util.Locale ; 26 import java.util.ResourceBundle ; 27 28 import javax.swing.AbstractAction ; 29 import javax.swing.JButton ; 30 import javax.swing.JDialog ; 31 import javax.swing.JOptionPane ; 32 import javax.swing.JPanel ; 33 34 import org.apache.batik.util.gui.resource.ResourceManager; 35 36 42 public class OptionPanel extends JPanel { 43 44 47 public final static String RESOURCES = 48 "org.apache.batik.apps.svgbrowser.resources.GUI"; 49 50 53 protected static ResourceBundle bundle; 54 55 58 protected static ResourceManager resources; 59 60 static { 61 bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault()); 62 resources = new ResourceManager(bundle); 63 } 64 65 68 public OptionPanel(LayoutManager layout) { 69 super(layout); 70 } 71 72 75 public static class Dialog extends JDialog { 76 77 80 protected JButton ok; 81 82 85 protected JPanel panel; 86 87 public Dialog(Component parent, String title, JPanel panel) { 88 super(JOptionPane.getFrameForComponent(parent), title); 89 setModal(true); 90 this.panel = panel; 91 getContentPane().add(panel, BorderLayout.CENTER); 92 getContentPane().add(createButtonPanel(), BorderLayout.SOUTH); 93 } 94 95 98 protected JPanel createButtonPanel() { 99 JPanel panel = new JPanel (new FlowLayout ()); 100 ok = new JButton (resources.getString("OKButton.text")); 101 ok.addActionListener(new OKButtonAction()); 102 panel.add(ok); 103 return panel; 104 } 105 106 109 protected class OKButtonAction extends AbstractAction { 110 111 public void actionPerformed(ActionEvent evt) { 112 dispose(); 113 } 114 } 115 } 116 } 117 118 | Popular Tags |