< prev index next >

src/com/sun/javatest/exec/NavigationPane.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 287 
 288         private Vector<URL> entries = new Vector<>();
 289         private int index;
 290     }
 291 
 292 
 293 
 294 
 295     private class Renderer extends DefaultListCellRenderer {
 296 
 297         public Renderer() {
 298             setPreferredSize(new JLabel("MinSize").getPreferredSize());
 299         }
 300 
 301         public Renderer(Container container) {
 302             setPreferredSize(new JLabel("MinSize").getPreferredSize());
 303             this.container = container;
 304             sf = new StringFitter(getFontMetrics(getFont()));
 305         }
 306 
 307         public Component getListCellRendererComponent(JList list, Object o, int index, boolean isSelected, boolean cellHasFocus) {
 308             String name = null;
 309             if (o instanceof URL) {
 310                 URL url = (URL) o;
 311 
 312                 // if not file URL
 313                 if (!url.getProtocol().equals("file")) {
 314                     name = url.toString();
 315                 }
 316                 else {
 317                     // if file URL, remove the "file:" prefix
 318                     name = extractPrefix(url.toString(), "file:");
 319                     String baseName = null;
 320                     name = new File(name).getAbsolutePath();
 321 
 322                     File baseDir = mediaPane.getBaseDirectory();
 323                     if (baseDir != null && baseDir.getParentFile() != null) {
 324                         baseName = baseDir.getParentFile().getAbsolutePath();
 325                     }
 326                     // if contains base dir, only show file name
 327                     if (baseName != null &&




 287 
 288         private Vector<URL> entries = new Vector<>();
 289         private int index;
 290     }
 291 
 292 
 293 
 294 
 295     private class Renderer extends DefaultListCellRenderer {
 296 
 297         public Renderer() {
 298             setPreferredSize(new JLabel("MinSize").getPreferredSize());
 299         }
 300 
 301         public Renderer(Container container) {
 302             setPreferredSize(new JLabel("MinSize").getPreferredSize());
 303             this.container = container;
 304             sf = new StringFitter(getFontMetrics(getFont()));
 305         }
 306 
 307         public Component getListCellRendererComponent(JList<?> list, Object o, int index, boolean isSelected, boolean cellHasFocus) {
 308             String name = null;
 309             if (o instanceof URL) {
 310                 URL url = (URL) o;
 311 
 312                 // if not file URL
 313                 if (!url.getProtocol().equals("file")) {
 314                     name = url.toString();
 315                 }
 316                 else {
 317                     // if file URL, remove the "file:" prefix
 318                     name = extractPrefix(url.toString(), "file:");
 319                     String baseName = null;
 320                     name = new File(name).getAbsolutePath();
 321 
 322                     File baseDir = mediaPane.getBaseDirectory();
 323                     if (baseDir != null && baseDir.getParentFile() != null) {
 324                         baseName = baseDir.getParentFile().getAbsolutePath();
 325                     }
 326                     // if contains base dir, only show file name
 327                     if (baseName != null &&


< prev index next >