Commits

Rui Vieira committed 937df98

MultilineHeaderRenderer now uses the default label font (fixes #3)

  • Participants
  • Parent commits 9989a63

Comments (0)

Files changed (3)

src/main/java/org/ruivieira/orwell/components/MyListbox.java

 import javax.swing.*;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Vector;
 
 /**
  * @author Rui Vieira
         return this;
     }
 
-    public Vector<String> getSelectedValuesAsStrings() {
-        Vector<String> result = new Vector<String>();
+    public List<String> getSelectedValuesAsStrings() {
+        List<String> result = new ArrayList<String>();
         for (Object value : getSelectedValues()) {
             result.add(value.toString());
         }

src/main/java/org/ruivieira/orwell/components/tables/MultiLineFilteredHeaderRenderer.java

+package org.ruivieira.orwell.components.tables;
+
+/**
+ * Author: rvieira
+ * Date: 11/11/11
+ * Time: 14:43
+ */
+public class MultiLineFilteredHeaderRenderer extends MultiLineHeaderRenderer {
+}

src/main/java/org/ruivieira/orwell/components/tables/MultiLineHeaderRenderer.java

 
 package org.ruivieira.orwell.components.tables;
 
+import org.ruivieira.orwell.managers.FontManager;
+
 import javax.swing.*;
 import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumn;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.Vector;
 
 public class MultiLineHeaderRenderer extends JList implements TableCellRenderer {
 
                                                    boolean isSelected, boolean hasFocus, int row, int column) {
 
         // Header font
-        final Font boldFont = new Font("Tahoma", Font.PLAIN, 9);
-        setFont(boldFont);
+        final Font defaultLabelFont = FontManager.getInstance().getFont(FontManager.LABEL);
+        setFont(defaultLabelFont);
         String str = (value == null) ? "" : value.toString();
         BufferedReader br = new BufferedReader(new StringReader(str));
         String line;
-        Vector v = new Vector();
+        java.util.List<String> v = new ArrayList<String>();
         try {
             while ((line = br.readLine()) != null) {
-                v.addElement(line);
+                v.add(line);
             }
         } catch (IOException ex) {
             ex.printStackTrace();
         }
-        setListData(v);
+        setListData(v.toArray());
         return this;
     }