找回密码
 立即注册
问题
如何更改 JFileChooser 标签“查看:” “保存在:” (不是标题)?在这里您可以看到我想要更改的内容:

回答
我找到了一个解决方案,也许它也适用于某些人:
  1. JFileChooser chooser = new JFileChooser("Open");

  2. //Set the text and language of all the components in JFileChooser
  3. UIManager.put("FileChooser.openDialogTitleText", "Open");
  4. UIManager.put("FileChooser.lookInLabelText", "LookIn");
  5. UIManager.put("FileChooser.openButtonText", "Open");
  6. UIManager.put("FileChooser.cancelButtonText", "Cancel");
  7. UIManager.put("FileChooser.fileNameLabelText", "FileName");
  8. UIManager.put("FileChooser.filesOfTypeLabelText", "TypeFiles");
  9. UIManager.put("FileChooser.openButtonToolTipText", "OpenSelectedFile");
  10. UIManager.put("FileChooser.cancelButtonToolTipText","Cancel");
  11. UIManager.put("FileChooser.fileNameHeaderText","FileName");
  12. UIManager.put("FileChooser.upFolderToolTipText", "UpOneLevel");
  13. UIManager.put("FileChooser.homeFolderToolTipText","Desktop");
  14. UIManager.put("FileChooser.newFolderToolTipText","CreateNewFolder");
  15. UIManager.put("FileChooser.listViewButtonToolTipText","List");
  16. UIManager.put("FileChooser.newFolderButtonText","CreateNewFolder");
  17. UIManager.put("FileChooser.renameFileButtonText", "RenameFile");
  18. UIManager.put("FileChooser.deleteFileButtonText", "DeleteFile");
  19. UIManager.put("FileChooser.filterLabelText", "TypeFiles");
  20. UIManager.put("FileChooser.detailsViewButtonToolTipText", "Details");
  21. UIManager.put("FileChooser.fileSizeHeaderText","Size");
  22. UIManager.put("FileChooser.fileDateHeaderText", "DateModified");

  23. //Set icons for the JFileChooser
  24. UIManager.put("FileView.directoryIcon", new ImageIcon(FileSystem.class.getResource("folder.png")));
  25. UIManager.put("FileChooser.homeFolderIcon", new ImageIcon(FileSystem.class.getResource("user-home.png")));
  26. UIManager.put("FileView.computerIcon", new ImageIcon(FileSystem.class.getResource("computer.png")));
  27. UIManager.put("FIleView.floppyDriveIcon", new ImageIcon(FileSystem.class.getResource("media-floppy.png")));
  28. UIManager.put("FileView.hardDriveIcon", new ImageIcon(FileSystem.class.getResource("drive-harddisk.png")));
  29. UIManager.put("FileView.fileIcon", new ImageIcon(FileSystem.class.getResource("file.png")));
  30. UIManager.put("FileChooser.upFolderIcon", new ImageIcon(FileSystem.class.getResource("go.png")));
  31. UIManager.put("FileChooser.newFolderIcon", new ImageIcon(FileSystem.class.getResource("folder-new.png")));
  32. UIManager.put("FileView.fileIcon", new ImageIcon(FileSystem.class.getResource("file.png")));
  33. UIManager.put("FileChooser.listViewIcon", new ImageIcon(FileSystem.class.getResource("listIcon.png")));
  34. UIManager.put("FileChooser.detailsViewIcon", new ImageIcon(FileSystem.class.getResource("details.png")));

  35. //Update UI
  36. SwingUtilities.updateComponentTreeUI(chooser);
复制代码






上一篇:d3文本元素的读取宽度
下一篇:thingsboard 使用 MQTT 连接到 esp32