Permalink
Browse files

[gui2] replace Hashtable with HashMap; simplify (#4285)

  • Loading branch information...
grimreaper authored and karianna committed Oct 9, 2018
1 parent 2eb5d1c commit 03a9dcd0a655f987022319b0ab4051f8243d9414
Showing with 9 additions and 15 deletions.
  1. +9 −15 code/src/java/pcgen/gui2/tabs/TabTitle.java
@@ -20,7 +20,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Map;
import pcgen.system.LanguageBundle;
import pcgen.util.enumeration.Tab;
@@ -33,15 +34,13 @@
public class TabTitle
{
public static final String FOREGROUND = "foreground"; //$NON-NLS-1$
public static final String BACKGROUND = "background"; //$NON-NLS-1$
public static final String ENABLED = "enabled"; //$NON-NLS-1$
static final String ENABLED = "enabled"; //$NON-NLS-1$
public static final String TITLE = "title"; //$NON-NLS-1$
public static final String ICON = "icon"; //$NON-NLS-1$
public static final String TOOLTIP = "tooltip"; //$NON-NLS-1$
static final String ICON = "icon"; //$NON-NLS-1$
static final String TOOLTIP = "tooltip"; //$NON-NLS-1$
public static final String TAB = "tab"; //$NON-NLS-1$
private final PropertyChangeSupport support;
private final Hashtable<String, Object> table;
private final Map<String, Object> propertyTable;
/**
* Create a new TabTitle instance for a specific tab.
@@ -80,27 +79,22 @@ public TabTitle(String title, Tab tab)
public TabTitle()
{
support = new PropertyChangeSupport(this);
table = new Hashtable<>();
propertyTable = new HashMap<>();
}
public void addPropertyChangeListener(PropertyChangeListener l)
{
support.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l)
{
support.removePropertyChangeListener(l);
}
public Object getValue(String prop)
{
return table.get(prop);
return propertyTable.get(prop);
}
public void putValue(String prop, Object value)
{
support.firePropertyChange(prop, table.put(prop, value), value);
support.firePropertyChange(prop, propertyTable.put(prop, value), value);
}
public void setEnabled(boolean enable)

0 comments on commit 03a9dcd

Please sign in to comment.