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

Print this page




 182         Insets leftListInset = new Insets(0, 8, 0, 4);
 183         Insets rightListInset = new Insets(0, 4, 0, 8);
 184         Insets separatorInset = new Insets(8, 0, 0, 0);
 185         Insets labelInset = new Insets(0, 8, 0, 0);
 186         Insets buttonsInset = new Insets(10, 8, 10, 8);
 187 
 188         // add components to GridBagLayout "gbl"
 189 
 190         Font f = new Font(Font.DIALOG, Font.PLAIN, 12);
 191 
 192         Label label = new Label(pathLabelText);
 193         label.setFont(f);
 194         addComponent(label, gbl, gbc, 0, 0, 1,
 195                      GridBagConstraints.WEST, (Container)fileDialog,
 196                      1, 0, GridBagConstraints.NONE, labelInset);
 197 
 198         // Fixed 6260650: FileDialog.getDirectory() does not return null when file dialog is cancelled
 199         // After showing we should display 'user.dir' as current directory
 200         // if user didn't set directory programatically
 201         pathField = new TextField(savedDir != null ? savedDir : userDir);
 202 
 203         pathChoice = new Choice() {
 204                 public Dimension getPreferredSize() {
 205                     return new Dimension(PATH_CHOICE_WIDTH, pathField.getPreferredSize().height);
 206                 }
 207             };

 208         pathPanel = new Panel();
 209         pathPanel.setLayout(new BorderLayout());
 210 
 211         pathPanel.add(pathField,BorderLayout.CENTER);
 212         pathPanel.add(pathChoice,BorderLayout.EAST);
 213         //addComponent(pathField, gbl, gbc, 0, 1, 2,
 214         //             GridBagConstraints.WEST, (Container)fileDialog,
 215         //             1, 0, GridBagConstraints.HORIZONTAL, textFieldInset);
 216         //addComponent(pathChoice, gbl, gbc, 1, 1, GridBagConstraints.RELATIVE,
 217          //            GridBagConstraints.WEST, (Container)fileDialog,
 218           //           1, 0, GridBagConstraints.HORIZONTAL, textFieldInset);
 219         addComponent(pathPanel, gbl, gbc, 0, 1, 2,
 220                     GridBagConstraints.WEST, (Container)fileDialog,
 221                    1, 0, GridBagConstraints.HORIZONTAL, textFieldInset);
 222 
 223 
 224 
 225         label = new Label(filterLabelText);
 226 
 227         label.setFont(f);


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

 848 class Separator extends Canvas {
 849     public final static int HORIZONTAL = 0;
 850     public final static int VERTICAL = 1;
 851     int orientation;
 852 
 853     public Separator(int length, int thickness, int orient) {
 854         super();
 855         orientation = orient;
 856         if (orient == HORIZONTAL) {
 857             resize(length, thickness);
 858         } else {
 859             // VERTICAL
 860             resize(thickness, length);
 861         }
 862     }
 863 
 864     public void paint(Graphics g) {
 865         int x1, y1, x2, y2;
 866         Rectangle bbox = bounds();
 867         Color c = getBackground();




 182         Insets leftListInset = new Insets(0, 8, 0, 4);
 183         Insets rightListInset = new Insets(0, 4, 0, 8);
 184         Insets separatorInset = new Insets(8, 0, 0, 0);
 185         Insets labelInset = new Insets(0, 8, 0, 0);
 186         Insets buttonsInset = new Insets(10, 8, 10, 8);
 187 
 188         // add components to GridBagLayout "gbl"
 189 
 190         Font f = new Font(Font.DIALOG, Font.PLAIN, 12);
 191 
 192         Label label = new Label(pathLabelText);
 193         label.setFont(f);
 194         addComponent(label, gbl, gbc, 0, 0, 1,
 195                      GridBagConstraints.WEST, (Container)fileDialog,
 196                      1, 0, GridBagConstraints.NONE, labelInset);
 197 
 198         // Fixed 6260650: FileDialog.getDirectory() does not return null when file dialog is cancelled
 199         // After showing we should display 'user.dir' as current directory
 200         // if user didn't set directory programatically
 201         pathField = new TextField(savedDir != null ? savedDir : userDir);
 202         @SuppressWarnings("serial") // Anonymous class
 203         Choice tmp = new Choice() {
 204                 public Dimension getPreferredSize() {
 205                     return new Dimension(PATH_CHOICE_WIDTH, pathField.getPreferredSize().height);
 206                 }
 207             };
 208         pathChoice = tmp;
 209         pathPanel = new Panel();
 210         pathPanel.setLayout(new BorderLayout());
 211 
 212         pathPanel.add(pathField,BorderLayout.CENTER);
 213         pathPanel.add(pathChoice,BorderLayout.EAST);
 214         //addComponent(pathField, gbl, gbc, 0, 1, 2,
 215         //             GridBagConstraints.WEST, (Container)fileDialog,
 216         //             1, 0, GridBagConstraints.HORIZONTAL, textFieldInset);
 217         //addComponent(pathChoice, gbl, gbc, 1, 1, GridBagConstraints.RELATIVE,
 218          //            GridBagConstraints.WEST, (Container)fileDialog,
 219           //           1, 0, GridBagConstraints.HORIZONTAL, textFieldInset);
 220         addComponent(pathPanel, gbl, gbc, 0, 1, 2,
 221                     GridBagConstraints.WEST, (Container)fileDialog,
 222                    1, 0, GridBagConstraints.HORIZONTAL, textFieldInset);
 223 
 224 
 225 
 226         label = new Label(filterLabelText);
 227 
 228         label.setFont(f);


 829         // If the set of the directories the exactly same as the used to be then dummy
 830         if (pathChoice.getItem(0).equals(pathField.getText()))
 831             return;
 832 
 833         pathChoice.removeAll();
 834         addItemsToPathChoice(pathField.getText());
 835     }
 836 
 837     /*
 838      * Refresh the file dialog at the time of the closing choice according to the selected item of the choice
 839      * See 6240074 for more information
 840      */
 841     public void unfurledChoiceClosing(){
 842           // This is the exactly same code as invoking later at the time of the itemStateChanged
 843           // Here is we restore Windows behaviour: change current directory if user press 'ESC'
 844           String dir = pathChoice.getSelectedItem();
 845           target.setDirectory(dir);
 846     }
 847 }
 848 
 849 @SuppressWarnings("serial") // JDK-implementation class
 850 class Separator extends Canvas {
 851     public final static int HORIZONTAL = 0;
 852     public final static int VERTICAL = 1;
 853     int orientation;
 854 
 855     public Separator(int length, int thickness, int orient) {
 856         super();
 857         orientation = orient;
 858         if (orient == HORIZONTAL) {
 859             resize(length, thickness);
 860         } else {
 861             // VERTICAL
 862             resize(thickness, length);
 863         }
 864     }
 865 
 866     public void paint(Graphics g) {
 867         int x1, y1, x2, y2;
 868         Rectangle bbox = bounds();
 869         Color c = getBackground();