home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / plaf / basic / BasicDirectoryPaneUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  3.1 KB  |  54 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.BorderFactory;
  4. import com.sun.java.swing.Icon;
  5. import com.sun.java.swing.JComponent;
  6. import com.sun.java.swing.JList;
  7. import com.sun.java.swing.JScrollPane;
  8. import com.sun.java.swing.plaf.ComponentUI;
  9. import com.sun.java.swing.plaf.DirectoryPaneUI;
  10. import com.sun.java.swing.preview.JDirectoryPane;
  11. import java.awt.BorderLayout;
  12. import java.awt.Color;
  13. import java.awt.IllegalComponentStateException;
  14.  
  15. public class BasicDirectoryPaneUI extends DirectoryPaneUI {
  16.    protected JDirectoryPane directoryPane;
  17.    protected JList list;
  18.    protected JScrollPane scroller;
  19.    static Icon directoryIcon = null;
  20.    static Icon fileIcon = null;
  21.    static Icon computerIcon = null;
  22.    static Icon hardDriveIcon = null;
  23.    static Icon floppyDriveIcon = null;
  24.  
  25.    public static ComponentUI createUI(JComponent var0) {
  26.       return new BasicDirectoryPaneUI((JDirectoryPane)var0);
  27.    }
  28.  
  29.    public BasicDirectoryPaneUI(JDirectoryPane var1) {
  30.    }
  31.  
  32.    public void installUI(JComponent var1) {
  33.       this.directoryPane = (JDirectoryPane)var1;
  34.       this.directoryPane.setLayout(new BorderLayout());
  35.       this.list = new JList();
  36.       this.list.setCellRenderer(new LabelCellRenderer());
  37.       this.list.setBackground(Color.white);
  38.       this.list.setModel(this.directoryPane.getModel());
  39.       this.list.addMouseListener(new 1(this));
  40.       this.scroller = new JScrollPane(this.list);
  41.       this.scroller.setBorder(BorderFactory.createLoweredBevelBorder());
  42.       this.directoryPane.add(this.scroller, "Center");
  43.       this.list.setSelectionModel(this.directoryPane.getListSelectionModel());
  44.    }
  45.  
  46.    public void uninstallUI(JComponent var1) {
  47.       if (var1 != this.directoryPane) {
  48.          throw new IllegalComponentStateException(this + " was asked to deinstall() " + var1 + " when it only knows about " + this.directoryPane + ".");
  49.       } else {
  50.          this.directoryPane.remove(this.scroller);
  51.       }
  52.    }
  53. }
  54.