src/solaris/classes/sun/awt/X11/XFileDialogPeer.java

Print this page




 819         // If the set of the directories the exactly same as the used to be then dummy
 820         if (pathChoice.getItem(0).equals(pathField.getText()))
 821             return;
 822 
 823         pathChoice.removeAll();
 824         addItemsToPathChoice(pathField.getText());
 825     }
 826 
 827     /*
 828      * Refresh the file dialog at the time of the closing choice according to the selected item of the choice
 829      * See 6240074 for more information
 830      */
 831     public void unfurledChoiceClosing(){
 832           // This is the exactly same code as invoking later at the time of the itemStateChanged
 833           // Here is we restore Windows behaviour: change current directory if user press 'ESC'
 834           String dir = pathChoice.getSelectedItem();
 835           target.setDirectory(dir);
 836     }
 837 }
 838 
 839 class Separator extends Canvas {
 840     public final static int HORIZONTAL = 0;
 841     public final static int VERTICAL = 1;
 842     int orientation;
 843 
 844     public Separator(int length, int thickness, int orient) {
 845         super();
 846         orientation = orient;
 847         if (orient == HORIZONTAL) {
 848             resize(length, thickness);
 849         } else {
 850             // VERTICAL
 851             resize(thickness, length);
 852         }
 853     }
 854 
 855     public void paint(Graphics g) {
 856         int x1, y1, x2, y2;
 857         Rectangle bbox = bounds();
 858         Color c = getBackground();
 859         Color brighter = c.brighter();
 860         Color darker = c.darker();
 861 
 862         if (orientation == HORIZONTAL) {
 863             x1 = 0;
 864             x2 = bbox.width - 1;
 865             y1 = y2 = bbox.height/2 - 1;
 866 
 867         } else {
 868             // VERTICAL
 869             x1 = x2 = bbox.width/2 - 1;
 870             y1 = 0;
 871             y2 = bbox.height - 1;
 872         }
 873         g.setColor(darker);
 874         g.drawLine(x1, y2, x2, y2);
 875         g.setColor(brighter);
 876         if (orientation == HORIZONTAL)
 877             g.drawLine(x1, y2+1, x2, y2+1);
 878         else
 879             g.drawLine(x1+1, y2, x2+1, y2);
 880     }
 881 }
 882 
 883 /*
 884  * Motif file dialogs let the user specify a filter that controls the files that
 885  * are displayed in the dialog. This filter is generally specified as a regular
 886  * expression. The class is used to implement Motif-like filtering.
 887  */
 888 class FileDialogFilter implements FilenameFilter {
 889 
 890     String filter;
 891 
 892     public FileDialogFilter(String f) {
 893         filter = f;
 894     }
 895 
 896     /*
 897      * Tells whether or not the specified file should be included in a file list
 898      */
 899     public boolean accept(File dir, String fileName) {
 900 
 901         File f = new File(dir, fileName);
 902 




 819         // If the set of the directories the exactly same as the used to be then dummy
 820         if (pathChoice.getItem(0).equals(pathField.getText()))
 821             return;
 822 
 823         pathChoice.removeAll();
 824         addItemsToPathChoice(pathField.getText());
 825     }
 826 
 827     /*
 828      * Refresh the file dialog at the time of the closing choice according to the selected item of the choice
 829      * See 6240074 for more information
 830      */
 831     public void unfurledChoiceClosing(){
 832           // This is the exactly same code as invoking later at the time of the itemStateChanged
 833           // Here is we restore Windows behaviour: change current directory if user press 'ESC'
 834           String dir = pathChoice.getSelectedItem();
 835           target.setDirectory(dir);
 836     }
 837 }
 838 












































 839 /*
 840  * Motif file dialogs let the user specify a filter that controls the files that
 841  * are displayed in the dialog. This filter is generally specified as a regular
 842  * expression. The class is used to implement Motif-like filtering.
 843  */
 844 class FileDialogFilter implements FilenameFilter {
 845 
 846     String filter;
 847 
 848     public FileDialogFilter(String f) {
 849         filter = f;
 850     }
 851 
 852     /*
 853      * Tells whether or not the specified file should be included in a file list
 854      */
 855     public boolean accept(File dir, String fileName) {
 856 
 857         File f = new File(dir, fileName);
 858