title: Creating custom JFileChooser
body: <p>To create an Arabic JFileChooser (RTL) I use the following:</p>
  
  <p><strong>MyFileChooser:</strong></p>
  
  <pre><code>import javax.swing.JOptionPane;
  import javax.swing.UIManager;
  import javax.swing.JFileChooser;
  import javax.swing.filechooser.FileNameExtensionFilter;
  import javax.swing.filechooser.FileView;
  import java.io.File;
  import java.awt.ComponentOrientation;
  import java.awt.Dimension;
  public class MyFileChooser extends JFileChooser
  {
      private String extension;
      private String title;
      public MyFileChooser(String extension, String title)
      {
          super();
          this.extension = extension;
          this.title = title;
          addChoosableFileFilter(new FileNameExtensionFilter(String.format("(*.%1$s) فقط %1$s ملفات", extension), extension));
          applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
          //setPreferredSize(new Dimension(450, 350));
      }
  
      @Override public String getDialogTitle()
      {
          return title;
      }
  
      @Override public File getSelectedFile()
      {
          File selectedFile = super.getSelectedFile();
          if(selectedFile != null)
          {
              String name = selectedFile.getName();
              if(!name.contains(".")) selectedFile = new File(selectedFile.getParentFile(), name + '.' + extension);
          }
          return selectedFile;
      }
  }
  </code></pre>
  
  <p><strong>Main:</strong></p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import javax.swing.border.*;
  import java.awt.event.*;
  public class MainFrame extends JFrame implements ActionListener
  {
      public MyFileChooser chooser;
      public MainFrame()
      {
          super("Main Frame");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          try{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}
          catch(Exception e){ System.out.println("Unable to load Windows look and feel");}
          setPreferredSize(new Dimension(300, 100));
          ((JPanel) getContentPane()).setBorder(new EmptyBorder(13, 13, 13, 13) );
          setLayout(new FlowLayout());
          JButton btn = new JButton("Open");
          btn.setActionCommand("myButton");
          btn.addActionListener(this);
          add(btn);
          JPanel panel = new JPanel();
  
          UIManager.put("FileChooser.saveButtonText", "حفظ");
          UIManager.put("FileChooser.openButtonText", "فتح");
          UIManager.put("FileChooser.cancelButtonText", "إلغاء");
          UIManager.put("FileChooser.updateButtonText", "تحديث");
          UIManager.put("FileChooser.helpButtonText", "مساعدة");
          UIManager.put("FileChooser.saveButtonToolTipText", "حفظ ملف");
          UIManager.put("FileChooser.openButtonToolTipText", "فتح ملف");
          UIManager.put("FileChooser.cancelButtonToolTipText", "إلغاء");
          UIManager.put("FileChooser.updateButtonToolTipText", "تحديث");
          UIManager.put("FileChooser.helpButtonToolTipText", "مساعدة");
          UIManager.put("FileChooser.listViewButtonToolTipText", "قائمة");
          UIManager.put("FileChooser.lookInLabelText", "بحث في:");
          UIManager.put("FileChooser.newFolderToolTipText", "إنشاء مجلد جديد");
          UIManager.put("FileChooser.fileNameLabelText", "اسم الملف:");
          UIManager.put("FileChooser.filesOfTypeLabelText", "  نوع الملف:");
          UIManager.put("FileChooser.detailsViewButtonToolTipText", "تفاصيل");
          UIManager.put("FileChooser.upFolderToolTipText", "للأعلى")
  
          chooser = new MyFileChooser("aaa", "العنوان");
          chooser.setAcceptAllFileFilterUsed(false);
          chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
          chooser.setFileHidingEnabled(false);
  
          pack();
          setLocationRelativeTo(null);
          setVisible(true);
          setResizable(false);
      }
      public void actionPerformed(ActionEvent e)
      {
          if(e.getActionCommand().equals("myButton"))
          {
              int status = chooser.showOpenDialog(null);
              // blah blah
          }
      }
      public static void main(String[] args)
      {
          new MainFrame();
      }
  }
  </code></pre>
  
  <p><strong>ScreenShots:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/dHiOh.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/1kaNk.png" alt="enter image description here"></p>
  
  <p>Everything is cool, except some parts I need to modify them so I can get an arabic JFileChooser:</p>
  
  <ul>
  <li>The scrollbar is always set to the left when list view is on. How can I fix it?</li>
  <li>On Details view, the header of the table is written in English. How can I modify it or at least disable the details view?</li>
  <li>The labeles "Recent Items", "Desktop", "My Documents", "Computer", and "Network" how can I modify them or at least remove them?</li>
  </ul>