From 73d5bf1a47e7205852aa1263c39771c79838e553 Mon Sep 17 00:00:00 2001
From: Tim Molter <tim.molter@gmail.com>
Date: Tue, 17 Mar 2015 18:49:42 +0100
Subject: [PATCH] fix for issue #99 - Why do the FileFilters within XChartPanel
 don't accept directories? (2)

---
 .../java/com/xeiam/xchart/XChartPanel.java    | 32 ++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java b/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java
index 9c95e036..32601ab9 100644
--- a/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java
+++ b/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java
@@ -151,7 +151,13 @@ public class XChartPanel extends JPanel {
     @Override
     public boolean accept(File f) {
 
-      return true;
+      if (f.isDirectory()) {
+        return true;
+      }
+
+      String s = f.getName();
+
+      return s.endsWith(".jpg") || s.endsWith(".JPG");
     }
 
     @Override
@@ -167,7 +173,13 @@ public class XChartPanel extends JPanel {
     @Override
     public boolean accept(File f) {
 
-      return true;
+      if (f.isDirectory()) {
+        return true;
+      }
+
+      String s = f.getName();
+
+      return s.endsWith(".bmp") || s.endsWith(".BMP");
     }
 
     @Override
@@ -183,7 +195,13 @@ public class XChartPanel extends JPanel {
     @Override
     public boolean accept(File f) {
 
-      return true;
+      if (f.isDirectory()) {
+        return true;
+      }
+
+      String s = f.getName();
+
+      return s.endsWith(".gif") || s.endsWith(".GIF");
     }
 
     @Override
@@ -199,7 +217,13 @@ public class XChartPanel extends JPanel {
     @Override
     public boolean accept(File f) {
 
-      return true;
+      if (f.isDirectory()) {
+        return true;
+      }
+
+      String s = f.getName();
+
+      return s.endsWith(".png") || s.endsWith(".PNG");
     }
 
     @Override
-- 
GitLab