⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basicfilechooserui.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        {	  filechooser.getFileSystemView().createNewFolder(filechooser	                                                  .getCurrentDirectory());        }      catch (IOException ioe)        {	  return;        }      filechooser.rescanCurrentDirectory();      filechooser.repaint();    }  }  /**   * A listener for selection events in the file list.   *    * @see BasicFileChooserUI#createListSelectionListener(JFileChooser)   */  protected class SelectionListener implements ListSelectionListener  {    /**     * Creates a new <code>SelectionListener</code> object.     */    protected SelectionListener()    {      // Nothing to do here.    }    /**     * DOCUMENT ME!     *     * @param e DOCUMENT ME!     */    public void valueChanged(ListSelectionEvent e)    {      Object f = filelist.getSelectedValue();      if (f == null)	return;      File file = filechooser.getFileSystemView().createFileObject(f.toString());      if (! filechooser.isTraversable(file))	filechooser.setSelectedFile(file);      else	filechooser.setSelectedFile(null);    }  }  /**   * DOCUMENT ME!   *    * @see BasicFileChooserUI#getUpdateAction()   */  protected class UpdateAction extends AbstractAction  {    /**     * Creates a new UpdateAction object.     */    protected UpdateAction()    {      // Nothing to do here.    }    /**     * NOT YET IMPLEMENTED.     *     * @param e  the action event.     */    public void actionPerformed(ActionEvent e)    {      // FIXME: implement this    }  }  /** The localised mnemonic for the cancel button. */  protected int cancelButtonMnemonic;  /** The localised text for the cancel button. */  protected String cancelButtonText;  /** The localised tool tip text for the cancel button. */  protected String cancelButtonToolTipText;  /** An icon representing a computer. */  protected Icon computerIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {        // FIXME: is this not implemented, or is the icon intentionally blank?      }    };  /** An icon for the "details view" button. */  protected Icon detailsViewIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	g.setColor(Color.GRAY);	g.drawRect(1, 1, 15, 20);	g.drawLine(17, 6, 23, 6);	g.drawLine(17, 12, 23, 12);	g.drawLine(17, 18, 23, 18);	g.setColor(saved);	g.translate(-x, -y);      }    };  /** An icon representing a directory. */  protected Icon directoryIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	Point ap = new Point(3, 7);	Point bp = new Point(3, 21);	Point cp = new Point(21, 21);	Point dp = new Point(21, 12);	Point ep = new Point(16, 12);	Point fp = new Point(13, 7);	Polygon dir = new Polygon(new int[] { ap.x, bp.x, cp.x, dp.x, ep.x, fp.x },	                          new int[] { ap.y, bp.y, cp.y, dp.y, ep.y, fp.y },	                          6);	g.setColor(new Color(153, 204, 255));	g.fillPolygon(dir);	g.setColor(Color.BLACK);	g.drawPolygon(dir);	g.translate(-x, -y);	g.setColor(saved);      }    };  /** The localised Mnemonic for the open button. */  protected int directoryOpenButtonMnemonic;  /** The localised text for the open button. */  protected String directoryOpenButtonText;  /** The localised tool tip text for the open button. */  protected String directoryOpenButtonToolTipText;  /** An icon representing a file. */  protected Icon fileIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	Point a = new Point(5, 4);	Point b = new Point(5, 20);	Point d = new Point(19, 20);	Point e = new Point(19, 7);	Point f = new Point(16, 4);	Polygon p = new Polygon(new int[] { a.x, b.x, d.x, e.x, f.x, },	                        new int[] { a.y, b.y, d.y, e.y, f.y }, 5);	g.setColor(Color.WHITE);	g.fillPolygon(p);	g.setColor(Color.BLACK);	g.drawPolygon(p);	g.drawLine(16, 4, 14, 6);	g.drawLine(14, 6, 19, 7);	g.setColor(saved);	g.translate(-x, -y);      }    };  /** An icon representing a floppy drive. */  protected Icon floppyDriveIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {        // FIXME: is this not implemented, or is the icon intentionally blank?      }    };  /** An icon representing a hard drive. */  protected Icon hardDriveIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {        // FIXME: is this not implemented, or is the icon intentionally blank?      }    };  /** The localised mnemonic for the "help" button. */  protected int helpButtonMnemonic;  /** The localised text for the "help" button. */  protected String helpButtonText;  /** The localised tool tip text for the help button. */  protected String helpButtonToolTipText;  /** An icon representing the user's home folder. */  protected Icon homeFolderIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component c, Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	Point a = new Point(12, 3);	Point b = new Point(4, 10);	Point d = new Point(20, 10);	Polygon p = new Polygon(new int[] { a.x, b.x, d.x },	                        new int[] { a.y, b.y, d.y }, 3);	g.setColor(new Color(104, 51, 0));	g.fillPolygon(p);	g.setColor(Color.BLACK);	g.drawPolygon(p);	g.setColor(Color.WHITE);	g.fillRect(8, 10, 8, 10);	g.setColor(Color.BLACK);	g.drawRect(8, 10, 8, 10);	g.setColor(saved);	g.translate(-x, -y);      }    };  /** An icon for the "list view" button. */  protected Icon listViewIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      // Not needed. Only simplifies things until we get real icons.      private void paintPartial(Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	g.setColor(Color.GRAY);	g.drawRect(1, 1, 7, 10);	g.drawLine(8, 6, 11, 6);	g.setColor(saved);	g.translate(-x, -y);      }      public void paintIcon(Component c, Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	paintPartial(g, 0, 0);	paintPartial(g, 12, 0);	paintPartial(g, 0, 12);	paintPartial(g, 12, 12);	g.setColor(saved);	g.translate(-x, -y);      }    };  /** An icon for the "new folder" button. */  protected Icon newFolderIcon = directoryIcon;  /** The localised mnemonic for the "open" button. */  protected int openButtonMnemonic;  /** The localised text for the "open" button. */  protected String openButtonText;  /** The localised tool tip text for the "open" button. */  protected String openButtonToolTipText;  /** The localised mnemonic for the "save" button. */  protected int saveButtonMnemonic;  /** The localised text for the "save" button. */  protected String saveButtonText;  /** The localised tool tip text for the save button. */  protected String saveButtonToolTipText;  /** The localised mnemonic for the "update" button. */  protected int updateButtonMnemonic;  /** The localised text for the "update" button. */  protected String updateButtonText;  /** The localised tool tip text for the "update" button. */  protected String updateButtonToolTipText;  /** An icon for the "up folder" button. */  protected Icon upFolderIcon = new Icon()    {      public int getIconHeight()      {	return ICON_SIZE;      }      public int getIconWidth()      {	return ICON_SIZE;      }      public void paintIcon(Component comp, Graphics g, int x, int y)      {	Color saved = g.getColor();	g.translate(x, y);	Point a = new Point(3, 7);	Point b = new Point(3, 21);	Point c = new Point(21, 21);	Point d = new Point(21, 12);	Point e = new Point(16, 12);	Point f = new Point(13, 7);	Polygon dir = new Polygon(new int[] { a.x, b.x, c.x, d.x, e.x, f.x },	                          new int[] { a.y, b.y, c.y, d.y, e.y, f.y }, 6);	g.setColor(new Color(153, 204, 255));	g.fillPolygon(dir);	g.setColor(Color.BLACK);	g.drawPolygon(dir);	a = new Point(12, 15);	b = new Point(9, 18);	c = new Point(15, 18);	Polygon arrow = new Polygon(new int[] { a.x, b.x, c.x },	                            new int[] { a.y, b.y, c.y }, 3);	g.fillPolygon(arrow);	g.drawLine(12, 15, 12, 22);	g.translate(-x, -y);	g.setColor(saved);      }    };  // -- begin private, but package local since used in inner classes --  /** The file chooser component represented by this UI delegate. */  JFileChooser filechooser;  /** The file list. */  JList filelist;  /** The combo box used to display/select file filters. */  JComboBox filters;  /** The model for the directory list. */  BasicDirectoryModel model;  /** The file filter for all files. */  FileFilter acceptAll = new AcceptAllFileFilter();  /** The default file view. */  FileView fv = new BasicFileView();  /** The icon size. */  static final int ICON_SIZE = 24;  /** A combo box for display/selection of parent directories. */  JComboBox parents;  /** The current file name. */  String filename;  /** The accept (open/save) button. */  JButton accept;  /** The cancel button. */  JButton cancel;  /** The button to move up to the parent directory. */  JButton upFolderButton;  /** The button to create a new directory. */  JButton newFolderButton;  /** The button to move to the user's home directory. */  JButton homeFolderButton;  /** An optional accessory panel. */  JPanel accessoryPanel;  /** A property change listener. */  PropertyChangeListener propertyChangeListener;  /** The text describing the filter for "all files". */  String acceptAllFileFilterText;  /** The text describing a directory type. */  String dirDescText;  /** The text describing a file type. */  String fileDescText;  /** Is a directory selected? */  boolean dirSelected = false;  /** The current directory. */  File currDir = null;  // FIXME: describe what is contained in the bottom panel  /** The bottom panel. */  JPanel bottomPanel;    /** The close panel. */  JPanel closePanel;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -