Browse Source

Remove some warnings

Change-Id: If664d17177451f28d24f9a9c1c4172245f88da61
Reviewed-on: http://gerrit.dmdirc.com/3172
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes 10 years ago
parent
commit
3e6a5e342e

+ 2
- 13
src/com/dmdirc/addons/ui_swing/ComboBoxWidthModifier.java View File

@@ -35,20 +35,14 @@ import javax.swing.event.PopupMenuListener;
35 35
  */
36 36
 public class ComboBoxWidthModifier implements PopupMenuListener {
37 37
 
38
-    /**
39
-     * {@inheritDoc}
40
-     *
41
-     * @param e Popup menu event
42
-     */
43 38
     @Override
44 39
     public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
45
-        final JComboBox box = (JComboBox) e.getSource();
40
+        final JComboBox<?> box = (JComboBox) e.getSource();
46 41
         final Object comp = box.getUI().getAccessibleChild(box, 0);
47 42
         if (!(comp instanceof JPopupMenu)) {
48 43
             return;
49 44
         }
50
-        final JComponent scrollPane = (JComponent) ((JPopupMenu) comp)
51
-                .getComponent(0);
45
+        final JComponent scrollPane = (JComponent) ((JPopupMenu) comp).getComponent(0);
52 46
         final Dimension size = new Dimension(box.getPreferredSize().width,
53 47
                 scrollPane.getPreferredSize().height);
54 48
         scrollPane.setPreferredSize(size);
@@ -65,11 +59,6 @@ public class ComboBoxWidthModifier implements PopupMenuListener {
65 59
         //Ignore
66 60
     }
67 61
 
68
-    /**
69
-     * {@inheritDoc}
70
-     *
71
-     * @param e Popup menu event
72
-     */
73 62
     @Override
74 63
     public void popupMenuCanceled(final PopupMenuEvent e) {
75 64
         //Ignore

+ 1
- 2
src/com/dmdirc/addons/ui_swing/PrefsComponentFactory.java View File

@@ -209,8 +209,7 @@ public final class PrefsComponentFactory {
209 209
      * @return A JComponent descendent for the specified setting
210 210
      */
211 211
     private JComponent getComboOption(final PreferencesSetting setting) {
212
-        final JComboBox option = new JComboBox(setting.getComboOptions()
213
-                .entrySet().toArray());
212
+        final JComboBox<Object> option = new JComboBox<>(setting.getComboOptions().entrySet().toArray());
214 213
         option.setRenderer(new MapEntryRenderer(option.getRenderer()));
215 214
         option.setEditable(false);
216 215
 

+ 1
- 1
src/com/dmdirc/addons/ui_swing/UIUtilities.java View File

@@ -499,7 +499,7 @@ public final class UIUtilities {
499 499
      *
500 500
      * @param combo Combo box to modify
501 501
      */
502
-    public static void addComboBoxWidthModifier(final JComboBox combo) {
502
+    public static void addComboBoxWidthModifier(final JComboBox<?> combo) {
503 503
         combo.addPopupMenuListener(new ComboBoxWidthModifier());
504 504
     }
505 505
 

+ 4
- 9
src/com/dmdirc/addons/ui_swing/components/FontPicker.java View File

@@ -37,13 +37,9 @@ import javax.swing.SwingUtilities;
37 37
 /**
38 38
  * System font picking component.
39 39
  */
40
-public class FontPicker extends JComboBox {
40
+public class FontPicker extends JComboBox<Object> {
41 41
 
42
-    /**
43
-     * A version number for this class. It should be changed whenever the class structure is changed
44
-     * (or anything else that would prevent serialized objects being unserialized with the new
45
-     * class).
46
-     */
42
+    /** A version number for this class. */
47 43
     private static final long serialVersionUID = -9054812588033935839L;
48 44
     /** Font family to choose from. */
49 45
     private final String fontFamily;
@@ -54,8 +50,7 @@ public class FontPicker extends JComboBox {
54 50
      * @param fontFamily Font family
55 51
      */
56 52
     public FontPicker(final String fontFamily) {
57
-        super(new DefaultComboBoxModel());
58
-        setPrototypeDisplayValue("test");
53
+        super(new DefaultComboBoxModel<>());
59 54
         this.fontFamily = fontFamily;
60 55
 
61 56
         setRenderer(new FontListCellRenderer(getRenderer()));
@@ -93,7 +88,7 @@ public class FontPicker extends JComboBox {
93 88
                 /** {@inheritDoc} */
94 89
                 @Override
95 90
                 public void run() {
96
-                    ((DefaultComboBoxModel) getModel()).addElement(new Font(
91
+                    ((DefaultComboBoxModel<Object>) getModel()).addElement(new Font(
97 92
                             font, Font.PLAIN, size));
98 93
                 }
99 94
             });

+ 2
- 9
src/com/dmdirc/addons/ui_swing/components/GenericComboBoxModel.java View File

@@ -29,19 +29,13 @@ import javax.swing.ComboBoxModel;
29 29
  *
30 30
  * @param <T> Model holds this type of object
31 31
  */
32
-public class GenericComboBoxModel<T> extends GenericListModel<T> implements
33
-        ComboBoxModel {
32
+public class GenericComboBoxModel<T> extends GenericListModel<T> implements ComboBoxModel<T> {
34 33
 
35
-    /**
36
-     * A version number for this class. It should be changed whenever the class structure is changed
37
-     * (or anything else that would prevent serialized objects being unserialized with the new
38
-     * class).
39
-     */
34
+    /** A version number for this class. */
40 35
     private static final long serialVersionUID = 2;
41 36
     /** Selected Object. */
42 37
     private T selectedObject;
43 38
 
44
-    /** {@inheritDoc} */
45 39
     @Override
46 40
     @SuppressWarnings("unchecked")
47 41
     public void setSelectedItem(final Object anItem) {
@@ -52,7 +46,6 @@ public class GenericComboBoxModel<T> extends GenericListModel<T> implements
52 46
         }
53 47
     }
54 48
 
55
-    /** {@inheritDoc} */
56 49
     @Override
57 50
     public T getSelectedItem() {
58 51
         return selectedObject;

+ 3
- 10
src/com/dmdirc/addons/ui_swing/components/GenericListModel.java View File

@@ -34,13 +34,9 @@ import javax.swing.AbstractListModel;
34 34
  *
35 35
  * @param <T> Generic type of the list
36 36
  */
37
-public class GenericListModel<T> extends AbstractListModel {
37
+public class GenericListModel<T> extends AbstractListModel<T> {
38 38
 
39
-    /**
40
-     * A version number for this class. It should be changed whenever the class structure is changed
41
-     * (or anything else that would prevent serialized objects being unserialized with the new
42
-     * class).
43
-     */
39
+    /** A version number for this class. */
44 40
     private static final long serialVersionUID = -4227892376992714545L;
45 41
     /** Data stored in list. */
46 42
     private final List<T> list;
@@ -65,7 +61,6 @@ public class GenericListModel<T> extends AbstractListModel {
65 61
         this.list = Collections.synchronizedList(new ArrayList<>(list));
66 62
     }
67 63
 
68
-    /** {@inheritDoc} */
69 64
     @Override
70 65
     public int getSize() {
71 66
         return list.size();
@@ -194,7 +189,6 @@ public class GenericListModel<T> extends AbstractListModel {
194 189
         }
195 190
     }
196 191
 
197
-    /** {@inheritDoc} */
198 192
     @Override
199 193
     public String toString() {
200 194
         return list.toString();
@@ -236,9 +230,8 @@ public class GenericListModel<T> extends AbstractListModel {
236 230
         list.addAll(index, collection);
237 231
     }
238 232
 
239
-    /** {@inheritDoc} */
240 233
     @Override
241
-    public Object getElementAt(final int index) {
234
+    public T getElementAt(final int index) {
242 235
         return get(index);
243 236
     }
244 237
 

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/renderers/FontListCellRenderer.java View File

@@ -37,7 +37,7 @@ public class FontListCellRenderer extends DMDircListCellRenderer<Object> {
37 37
      *
38 38
      * @param renderer RendereParent renderer
39 39
      */
40
-    public FontListCellRenderer(final ListCellRenderer<Object> renderer) {
40
+    public FontListCellRenderer(final ListCellRenderer<? super Object> renderer) {
41 41
         super(renderer);
42 42
     }
43 43
 

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/renderers/MapEntryRenderer.java View File

@@ -42,7 +42,7 @@ public final class MapEntryRenderer extends DMDircListCellRenderer<Object> {
42 42
      *
43 43
      * @param renderer RendereParent renderer
44 44
      */
45
-    public MapEntryRenderer(final ListCellRenderer<Object> renderer) {
45
+    public MapEntryRenderer(final ListCellRenderer<? super Object> renderer) {
46 46
         super(renderer);
47 47
     }
48 48
 

Loading…
Cancel
Save