Index: javax/swing/plaf/metal/MetalFileChooserUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java,v retrieving revision 1.17 diff -u -r1.17 MetalFileChooserUI.java --- javax/swing/plaf/metal/MetalFileChooserUI.java 4 Jan 2006 17:02:32 -0000 1.17 +++ javax/swing/plaf/metal/MetalFileChooserUI.java 4 Jan 2006 19:12:55 -0000 @@ -293,17 +293,21 @@ { if (file.isDirectory() && filechooser.isTraversable(file)) { + directoryLabel = look; + dirLabel.setText(directoryLabel); filechooser.setApproveButtonText(openButtonText); filechooser.setApproveButtonToolTipText(openButtonToolTipText); } else if (file.isFile()) { + directoryLabel = save; + dirLabel.setText(directoryLabel); filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } } - if (file == null || !file.isFile()) + if (file == null) setFileName(null); else setFileName(file.getName()); @@ -429,6 +433,8 @@ // Set text on button back to original. if (filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { + directoryLabel = save; + dirLabel.setText(directoryLabel); filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } @@ -922,7 +928,11 @@ Icon icon = getFileView(fc).getIcon(editFile); if (icon != null) - bounds.x += icon.getIconWidth() + 4; + { + int padding = icon.getIconWidth() + 4; + bounds.x += padding; + bounds.width -= padding; + } editField.setBounds(bounds); list.add(editField); @@ -1252,6 +1262,15 @@ /** The scrollpane used for the table and list. */ JScrollPane scrollPane; + /** The text for the label when saving. */ + String save; + + /** The text for the label when opening a directory. */ + String look; + + /** The label for the file combo box. */ + JLabel dirLabel; + /** Listeners. */ ListSelectionListener listSelList; MouseListener doubleClickList; @@ -1303,20 +1322,25 @@ { fc.setLayout(new BorderLayout()); topPanel = new JPanel(new BorderLayout()); - topPanel.add(new JLabel(directoryLabel), BorderLayout.WEST); + dirLabel = new JLabel(directoryLabel); + topPanel.add(dirLabel, BorderLayout.WEST); this.controls = new JPanel(); addControlButtons(); JPanel dirPanel = new JPanel(new VerticalMidLayout()); - dirPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); directoryModel = createDirectoryComboBoxModel(fc); directoryComboBox = new JComboBox(directoryModel); directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc)); dirPanel.add(directoryComboBox); topPanel.add(dirPanel); topPanel.add(controls, BorderLayout.EAST); + topPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); fc.add(topPanel, BorderLayout.NORTH); - fc.add(createList(fc), BorderLayout.CENTER); + + JPanel list = createList(fc); + list.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); + fc.add(list, BorderLayout.CENTER); + JPanel bottomPanel = getBottomPanel(); filterModel = createFilterComboBoxModel(); JComboBox fileFilterCombo = new JComboBox(filterModel); @@ -1324,6 +1348,7 @@ fileTextField = new JTextField(); JPanel fileNamePanel = new JPanel(new VerticalMidLayout()); + fileNamePanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 5)); fileNamePanel.add(fileTextField); JPanel row1 = new JPanel(new BorderLayout()); row1.add(new JLabel(this.fileLabel), BorderLayout.WEST); @@ -1332,24 +1357,27 @@ JPanel row2 = new JPanel(new BorderLayout()); row2.add(new JLabel(this.filterLabel), BorderLayout.WEST); + row2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); row2.add(fileFilterCombo); bottomPanel.add(row2); JPanel buttonPanel = new JPanel(new ButtonLayout()); - buttonPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 0)); approveButton = new JButton(getApproveSelectionAction()); approveButton.setText(getApproveButtonText(fc)); approveButton.setToolTipText(getApproveButtonToolTipText(fc)); approveButton.setMnemonic(getApproveButtonMnemonic(fc)); buttonPanel.add(approveButton); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0)); JButton cancelButton = new JButton(getCancelSelectionAction()); cancelButton.setText(cancelButtonText); cancelButton.setToolTipText(cancelButtonToolTipText); cancelButton.setMnemonic(cancelButtonMnemonic); buttonPanel.add(cancelButton); - bottomPanel.add(buttonPanel); + bottomPanel.add(buttonPanel, BorderLayout.SOUTH); + bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 8, 8)); fc.add(bottomPanel, BorderLayout.SOUTH); + fc.add(getAccessoryPanel(), BorderLayout.EAST); } @@ -1408,7 +1436,13 @@ protected void installStrings(JFileChooser fc) { super.installStrings(fc); - directoryLabel = "Look In: "; + look = "Look In: "; + save = "Save In: "; + if (fc.getDialogType() == JFileChooser.SAVE_DIALOG) + directoryLabel = save; + else + directoryLabel = look; + fileLabel = "File Name: "; filterLabel = "Files of Type: ";