1 package net.logAnalyzer.utils.gui.quickbar; 2 3 import java.awt.event.ActionListener; 4 5 import javax.swing.JComponent; 6 import javax.swing.JPanel; 7 8 /*** 9 * This class implements a {@link JPanel} encapsulation which can be used in a 10 * {@link net.logAnalyzer.utils.gui.quickbar.QuickPanel}. 11 * 12 * @author KKI 13 * 14 */ 15 public abstract class QuickActionContainer extends JPanel implements 16 QuickAction { 17 private static final long serialVersionUID = 1L; 18 19 public QuickActionContainer() { 20 super(); 21 setOpaque(false); 22 addComponents(); 23 } 24 25 /*** 26 * Each QuickAction must be a {@link JComponent} or have an internal 27 * {@link JComponent} for GUI. Useful to place the QuickAction in the 28 * {@link QuickBar}. 29 * 30 * @return The QuickAction GUI. 31 * @see QuickAction#getGUI() 32 */ 33 public JComponent getGUI() { 34 return (JComponent) this; 35 } 36 37 /*** 38 * Adds components to the container. 39 * 40 */ 41 protected abstract void addComponents(); 42 43 /*** 44 * Adds an <code>ActionListener</code> to the button. 45 * 46 * @param l 47 * the <code>ActionListener</code> to be added 48 * @see QuickAction#addActionListener(ActionListener) 49 */ 50 public void addActionListener(ActionListener l) { 51 listenerList.add(ActionListener.class, l); 52 } 53 54 public String getName() { 55 return null; 56 } 57 58 }