/*- * Copyright (C) 2006 Erik Larsson * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.catacombae.hfsexplorer.testcode; import javax.swing.filechooser.FileSystemView; import java.io.File; /** * @author <a href="http://www.catacombae.org/" target="_top">Erik Larsson</a> */ public class TestFileSystemView extends javax.swing.JFrame { private class FakeFile extends File { private boolean isDirectory; public FakeFile(boolean dir) { super("."); this.isDirectory = dir; } public boolean isDirectory() { return isDirectory; } } /** Creates new form TestFileSystemView */ public TestFileSystemView() { initComponents(); FileSystemView fsv = FileSystemView.getFileSystemView(); fileIconLabel.setIcon(fsv.getSystemIcon(new File("file.withcompletelyunknownextension"))); folderIconLabel.setIcon(fsv.getSystemIcon(new File("lib/"))); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); folderIconLabel = new javax.swing.JLabel(); fileIconLabel = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Icon for virtual folder:"); jLabel2.setText("Icon for virtual file:"); folderIconLabel.setText("jLabel3"); fileIconLabel.setText("jLabel4"); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jLabel2) .add(jLabel1)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(folderIconLabel) .add(fileIconLabel)) .addContainerGap(69, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(folderIconLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel2) .add(fileIconLabel)) .addContainerGap(29, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TestFileSystemView().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel fileIconLabel; private javax.swing.JLabel folderIconLabel; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration//GEN-END:variables }