2010-09-08 12 views

Trả lời

9

Trong thực tế, nó có thể sử dụng các tệp thuộc tính để dịch các chuỗi Swing chuẩn. Chỉ cần gọi

UIManager.getDefaults().addResourceBundle("com.mypackage.messages"); 

trong đó com.mypackage.messages là tên cơ sở trọn gói đủ điều kiện.

8

Bạn có thể thay đổi các thuộc tính của JFileChooser của bạn như FileChooser.openButtonText

UIManager.put("FileChooser.acceptAllFileFilterText", "Directorios"); 
UIManager.put("FileChooser.lookInLabelText", "Localização"); 
UIManager.put("FileChooser.cancelButtonText", "Cancelar"); 
UIManager.put("FileChooser.cancelButtonToolTipText", "Cancelar"); 
UIManager.put("FileChooser.openButtonText", "Adicionar"); 
UIManager.put("FileChooser.openButtonToolTipText", "Adicionar ficheiro(s)"); 
UIManager.put("FileChooser.filesOfTypeLabelText", "Tipo"); 
UIManager.put("FileChooser.fileNameLabelText", "Ficheiro(s)"); 
UIManager.put("FileChooser.listViewButtonToolTipText", "Lista"); 
UIManager.put("FileChooser.listViewButtonAccessibleName", "Lista"); 
UIManager.put("FileChooser.detailsViewButtonToolTipText", "Detalhes"); 
UIManager.put("FileChooser.detailsViewButtonAccessibleName", "Detalhes"); 
UIManager.put("FileChooser.upFolderToolTipText", "Um nível acima"); 
UIManager.put("FileChooser.upFolderAccessibleName", "Um nível acima"); 
UIManager.put("FileChooser.homeFolderToolTipText", "Ambiente de Trabalho"); 
UIManager.put("FileChooser.homeFolderAccessibleName", "Ambiente de Trabalho"); UIManager.put("FileChooser.fileNameHeaderText", "Nome"); 
UIManager.put("FileChooser.fileSizeHeaderText", "Tamanho"); 
UIManager.put("FileChooser.fileTypeHeaderText", "Tipo"); 
UIManager.put("FileChooser.fileDateHeaderText", "Data"); 
UIManager.put("FileChooser.fileAttrHeaderText", "Atributos"); 
UIManager.put("FileChooser.openDialogTitleText","Adicionar Fotos"); 
UIManager.put("FileChooser.readOnly", Boolean.TRUE); 

Resources:

+0

vì vậy, có cách nào để đặt điều này trong tệp propeties để logic chọn ngôn ngữ chọn đúng sẽ được thực hiện không? Tôi có thể thêm một mã kiểm tra cho các địa phương tôi đang tìm kiếm nhưng tôi thà có jvm chọn đúng tập tin cho tôi. –

+0

AFAIK, tôi e rằng bạn phải kiểm tra ngôn ngữ và thiết lập các giá trị mới theo cách thủ công. –

+0

Bạn có thể phân lớp JFileChooser, thêm mã tương tự trong khối khởi tạo tĩnh (bắt buộc) và sau đó bạn có thể xuất các giá trị này thành các thuộc tính giống như bạn luôn làm. –

Các vấn đề liên quan