1 18 19 package org.apache.batik.util.gui.resource; 20 21 import java.util.Iterator ; 22 import java.util.List ; 23 import java.util.MissingResourceException ; 24 import java.util.ResourceBundle ; 25 26 import javax.swing.JButton ; 27 import javax.swing.JToolBar ; 28 29 45 public class ToolBarFactory extends ResourceManager { 46 private final static String SEPARATOR = "-"; 49 50 53 private ActionMap actions; 54 55 58 private ButtonFactory buttonFactory; 59 60 66 public ToolBarFactory(ResourceBundle rb, ActionMap am) { 67 super(rb); 68 actions = am; 69 buttonFactory = new ButtonFactory(rb, am); 70 } 71 72 82 public JToolBar createJToolBar(String name) 83 throws MissingResourceException , 84 ResourceFormatException, 85 MissingListenerException { 86 JToolBar result = new JToolBar (); 87 List buttons = getStringList(name); 88 Iterator it = buttons.iterator(); 89 90 while (it.hasNext()) { 91 String s = (String )it.next(); 92 if (s.equals(SEPARATOR)) { 93 result.add(new JToolbarSeparator()); 94 } else { 95 result.add(createJButton(s)); 96 } 97 } 98 return result; 99 } 100 101 111 public JButton createJButton(String name) 112 throws MissingResourceException , 113 ResourceFormatException, 114 MissingListenerException { 115 return buttonFactory.createJToolbarButton(name); 116 } 117 } 118 | Popular Tags |