310 newFolderAccessibleName); 311 b.setAlignmentX(JComponent.LEFT_ALIGNMENT); 312 b.setAlignmentY(JComponent.CENTER_ALIGNMENT); 313 b.setMargin(shrinkwrap); 314 } 315 topButtonPanel.add(b); 316 topButtonPanel.add(Box.createRigidArea(hstrut5)); 317 318 // View button group 319 ButtonGroup viewButtonGroup = new ButtonGroup(); 320 321 // List Button 322 listViewButton = new JToggleButton(listViewIcon); 323 listViewButton.setToolTipText(listViewButtonToolTipText); 324 listViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, 325 listViewButtonAccessibleName); 326 listViewButton.setSelected(true); 327 listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT); 328 listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT); 329 listViewButton.setMargin(shrinkwrap); 330 listViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_LIST)); 331 topButtonPanel.add(listViewButton); 332 viewButtonGroup.add(listViewButton); 333 334 // Details Button 335 detailsViewButton = new JToggleButton(detailsViewIcon); 336 detailsViewButton.setToolTipText(detailsViewButtonToolTipText); 337 detailsViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, 338 detailsViewButtonAccessibleName); 339 detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT); 340 detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT); 341 detailsViewButton.setMargin(shrinkwrap); 342 detailsViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_DETAILS)); 343 topButtonPanel.add(detailsViewButton); 344 viewButtonGroup.add(detailsViewButton); 345 346 filePane.addPropertyChangeListener(new PropertyChangeListener() { 347 public void propertyChange(PropertyChangeEvent e) { 348 if ("viewType".equals(e.getPropertyName())) { 349 int viewType = filePane.getViewType(); 350 switch (viewType) { 351 case FilePane.VIEWTYPE_LIST: 352 listViewButton.setSelected(true); 353 break; 354 355 case FilePane.VIEWTYPE_DETAILS: 356 detailsViewButton.setSelected(true); 357 break; 358 } 359 } 360 } 361 }); 362 363 // ************************************** // 364 // ******* Add the directory pane ******* // 365 // ************************************** // 366 fc.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS); 367 JComponent accessory = fc.getAccessory(); 368 if(accessory != null) { 369 getAccessoryPanel().add(accessory); 370 } 371 filePane.setPreferredSize(LIST_PREF_SIZE); 372 fc.add(filePane, BorderLayout.CENTER); 373 374 // ********************************** // 375 // **** Construct the bottom panel ** // | 310 newFolderAccessibleName); 311 b.setAlignmentX(JComponent.LEFT_ALIGNMENT); 312 b.setAlignmentY(JComponent.CENTER_ALIGNMENT); 313 b.setMargin(shrinkwrap); 314 } 315 topButtonPanel.add(b); 316 topButtonPanel.add(Box.createRigidArea(hstrut5)); 317 318 // View button group 319 ButtonGroup viewButtonGroup = new ButtonGroup(); 320 321 // List Button 322 listViewButton = new JToggleButton(listViewIcon); 323 listViewButton.setToolTipText(listViewButtonToolTipText); 324 listViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, 325 listViewButtonAccessibleName); 326 listViewButton.setSelected(true); 327 listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT); 328 listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT); 329 listViewButton.setMargin(shrinkwrap); 330 listViewButton.addActionListener(filePane.getViewTypeAction(FilePane.ViewType.LIST)); 331 topButtonPanel.add(listViewButton); 332 viewButtonGroup.add(listViewButton); 333 334 // Details Button 335 detailsViewButton = new JToggleButton(detailsViewIcon); 336 detailsViewButton.setToolTipText(detailsViewButtonToolTipText); 337 detailsViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, 338 detailsViewButtonAccessibleName); 339 detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT); 340 detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT); 341 detailsViewButton.setMargin(shrinkwrap); 342 detailsViewButton.addActionListener(filePane.getViewTypeAction(FilePane.ViewType.DETAILS)); 343 topButtonPanel.add(detailsViewButton); 344 viewButtonGroup.add(detailsViewButton); 345 346 filePane.addPropertyChangeListener(new PropertyChangeListener() { 347 public void propertyChange(PropertyChangeEvent e) { 348 if ("viewType".equals(e.getPropertyName())) { 349 FilePane.ViewType viewType = filePane.getViewType(); 350 switch (viewType) { 351 case LIST: 352 listViewButton.setSelected(true); 353 break; 354 355 case DETAILS: 356 detailsViewButton.setSelected(true); 357 break; 358 } 359 } 360 } 361 }); 362 363 // ************************************** // 364 // ******* Add the directory pane ******* // 365 // ************************************** // 366 fc.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS); 367 JComponent accessory = fc.getAccessory(); 368 if(accessory != null) { 369 getAccessoryPanel().add(accessory); 370 } 371 filePane.setPreferredSize(LIST_PREF_SIZE); 372 fc.add(filePane, BorderLayout.CENTER); 373 374 // ********************************** // 375 // **** Construct the bottom panel ** // |