<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.swing.filechooser%2FFileView</id>
		<title>Java by API/javax.swing.filechooser/FileView - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.swing.filechooser%2FFileView"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.filechooser/FileView&amp;action=history"/>
		<updated>2026-05-12T14:19:54Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.filechooser/FileView&amp;diff=1029&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.filechooser/FileView&amp;diff=1029&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.filechooser/FileView&amp;diff=1030&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.filechooser/FileView&amp;diff=1030&amp;oldid=prev"/>
				<updated>2010-05-31T14:23:14Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== extends FileView ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.awt.ruponent;&lt;br /&gt;
import java.awt.Graphics;&lt;br /&gt;
import java.io.File;&lt;br /&gt;
import javax.swing.Icon;&lt;br /&gt;
import javax.swing.JFileChooser;&lt;br /&gt;
import javax.swing.filechooser.FileView;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] a) {&lt;br /&gt;
    JFileChooser fileChooser = new JFileChooser(&amp;quot;.&amp;quot;);&lt;br /&gt;
    FileView view = new JavaFileView();&lt;br /&gt;
    fileChooser.setFileView(view);&lt;br /&gt;
    int status = fileChooser.showOpenDialog(null);&lt;br /&gt;
    if (status == JFileChooser.APPROVE_OPTION) {&lt;br /&gt;
      File selectedFile = fileChooser.getSelectedFile();&lt;br /&gt;
      System.out.println(selectedFile.getParent());&lt;br /&gt;
      System.out.println(selectedFile.getName());&lt;br /&gt;
    } else if (status == JFileChooser.CANCEL_OPTION) {&lt;br /&gt;
      System.out.println(&amp;quot;JFileChooser.CANCEL_OPTION&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class JavaFileView extends FileView {&lt;br /&gt;
  Icon javaIcon = new MyIcon(Color.BLUE);&lt;br /&gt;
  Icon classIcon = new MyIcon(Color.GREEN);&lt;br /&gt;
  Icon htmlIcon = new MyIcon(Color.RED);&lt;br /&gt;
  Icon jarIcon = new MyIcon(Color.PINK);&lt;br /&gt;
  public String getName(File file) {&lt;br /&gt;
    String filename = file.getName();&lt;br /&gt;
    if (filename.endsWith(&amp;quot;.java&amp;quot;)) {&lt;br /&gt;
      String name = filename + &amp;quot; : &amp;quot; + file.length();&lt;br /&gt;
      return name;&lt;br /&gt;
    }&lt;br /&gt;
    return null;&lt;br /&gt;
  }&lt;br /&gt;
  public String getTypeDescription(File file) {&lt;br /&gt;
    String typeDescription = null;&lt;br /&gt;
    String filename = file.getName().toLowerCase();&lt;br /&gt;
    if (filename.endsWith(&amp;quot;.java&amp;quot;)) {&lt;br /&gt;
      typeDescription = &amp;quot;Java Source&amp;quot;;&lt;br /&gt;
    } else if (filename.endsWith(&amp;quot;.class&amp;quot;)) {&lt;br /&gt;
      typeDescription = &amp;quot;Java Class File&amp;quot;;&lt;br /&gt;
    } else if (filename.endsWith(&amp;quot;.jar&amp;quot;)) {&lt;br /&gt;
      typeDescription = &amp;quot;Java Archive&amp;quot;;&lt;br /&gt;
    } else if (filename.endsWith(&amp;quot;.html&amp;quot;) || filename.endsWith(&amp;quot;.htm&amp;quot;)) {&lt;br /&gt;
      typeDescription = &amp;quot;Applet Loader&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    return typeDescription;&lt;br /&gt;
  }&lt;br /&gt;
  public Icon getIcon(File file) {&lt;br /&gt;
    if (file.isDirectory()) {&lt;br /&gt;
      return null;&lt;br /&gt;
    }&lt;br /&gt;
    Icon icon = null;&lt;br /&gt;
    String filename = file.getName().toLowerCase();&lt;br /&gt;
    if (filename.endsWith(&amp;quot;.java&amp;quot;)) {&lt;br /&gt;
      icon = javaIcon;&lt;br /&gt;
    } else if (filename.endsWith(&amp;quot;.class&amp;quot;)) {&lt;br /&gt;
      icon = classIcon;&lt;br /&gt;
    } else if (filename.endsWith(&amp;quot;.jar&amp;quot;)) {&lt;br /&gt;
      icon = jarIcon;&lt;br /&gt;
    } else if (filename.endsWith(&amp;quot;.html&amp;quot;) || filename.endsWith(&amp;quot;.htm&amp;quot;)) {&lt;br /&gt;
      icon = htmlIcon;&lt;br /&gt;
    }&lt;br /&gt;
    return icon;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class MyIcon implements Icon {&lt;br /&gt;
  Color myColor;&lt;br /&gt;
  public MyIcon(Color myColor) {&lt;br /&gt;
    this.myColor = myColor;&lt;br /&gt;
  }&lt;br /&gt;
  public int getIconWidth() {&lt;br /&gt;
    return 16;&lt;br /&gt;
  }&lt;br /&gt;
  public int getIconHeight() {&lt;br /&gt;
    return 16;&lt;br /&gt;
  }&lt;br /&gt;
  public void paintIcon(Component c, Graphics g, int x, int y) {&lt;br /&gt;
    g.setColor(myColor);&lt;br /&gt;
    g.drawRect(0, 0, 16, 16);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>