JDK-4624353 : Motif FileChooserDemo always shows the control buttons in the FileChooser dialog
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux,solaris_8
  • CPU: generic,x86,sparc
  • Submitted: 2002-01-16
  • Updated: 2003-05-21
  • Resolved: 2003-04-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Duplicate :  
Relates :  
Description
Steps to reproduce:
1)Launch FilechooserDemo
2)Select Motif L/F 
3)Uncheck the "Show Control Buttons" checkbox
4)Click on "Show FileChooser" button
The file chooser dialog that pops up shows the control buttons even if the  "Show Control Buttons" checkbox is unchecked.
On the other hand, the behavior is proper for Windows & Metal L/F i.e. the control buttons are not painted in the dialog box if "Show Control Buttons" checkbox is unchecked.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b06 VERIFIED IN: tiger
24-08-2004

SUGGESTED FIX Name: keR10081 Date: 01/16/2003 ------- MotifFileChooserUI.java ------- *** /tmp/sccs.yRayYA Thu Jan 16 14:46:36 2003 --- MotifFileChooserUI.java Fri Jan 10 17:33:59 2003 *************** *** 55,60 **** --- 55,61 ---- private static final Insets buttonMargin = new Insets(3, 3, 3, 3); private JPanel directoryPanel = new JPanel(); + private JPanel bottomPanel; protected JButton approveButton; *************** *** 157,163 **** prop == JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY) { approveButton.setText(getApproveButtonText(getFileChooser())); approveButton.setToolTipText(getApproveButtonToolTipText(getFileChooser())); ! } else if (prop.equals("componentOrientation")) { ComponentOrientation o = (ComponentOrientation)e.getNewValue(); JFileChooser cc = (JFileChooser)e.getSource(); if (o != (ComponentOrientation)e.getOldValue()) { --- 158,166 ---- prop == JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY) { approveButton.setText(getApproveButtonText(getFileChooser())); approveButton.setToolTipText(getApproveButtonToolTipText(getFileChooser())); ! } else if (prop.equals(JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) { ! doControlButtonsChanged(e); ! } else if (prop.equals("componentOrientation")) { ComponentOrientation o = (ComponentOrientation)e.getNewValue(); JFileChooser cc = (JFileChooser)e.getSource(); if (o != (ComponentOrientation)e.getOldValue()) { *************** *** 324,330 **** filenameTextField.setAlignmentX(JComponent.LEFT_ALIGNMENT); interior.add(filenameTextField); ! JPanel bottomPanel = new JPanel(new BorderLayout(0, 4)); bottomPanel.add(new JSeparator(), BorderLayout.NORTH); // Add buttons --- 327,333 ---- filenameTextField.setAlignmentX(JComponent.LEFT_ALIGNMENT); interior.add(filenameTextField); ! bottomPanel = getBottomPanel(); bottomPanel.add(new JSeparator(), BorderLayout.NORTH); // Add buttons *************** *** 386,394 **** buttonPanel.add(Box.createGlue()); bottomPanel.add(buttonPanel, BorderLayout.SOUTH); ! fc.add(bottomPanel, BorderLayout.SOUTH); } public void uninstallComponents(JFileChooser fc) { fc.removeAll(); } --- 389,414 ---- buttonPanel.add(Box.createGlue()); bottomPanel.add(buttonPanel, BorderLayout.SOUTH); ! if (fc.getControlButtonsAreShown()) { ! fc.add(bottomPanel, BorderLayout.SOUTH); ! } } + protected JPanel getBottomPanel() { + if (bottomPanel == null) { + bottomPanel = new JPanel(new BorderLayout(0, 4)); + } + return bottomPanel; + } + + private void doControlButtonsChanged(PropertyChangeEvent e) { + if (getFileChooser().getControlButtonsAreShown()) { + getFileChooser().add(bottomPanel,BorderLayout.SOUTH); + } else { + getFileChooser().remove(getBottomPanel()); + } + } + public void uninstallComponents(JFileChooser fc) { fc.removeAll(); } ###@###.### ======================================================================
24-08-2004

EVALUATION Consider fixing for next release. ###@###.### 2002-01-16
16-01-2002