lab6 some minor fixes

This commit is contained in:
Zakharov_Rostislav 2023-12-20 20:16:23 +04:00
parent 3047272489
commit a8d164c663

View File

@ -258,6 +258,7 @@ public class FrameShipsCollection extends JFrame {
} }
private void loadFile(){ private void loadFile(){
JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents"); JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents");
fc.addChoosableFileFilter(new TxtFilter());
int ret = fc.showDialog(null, "Открыть файл"); int ret = fc.showDialog(null, "Открыть файл");
if(ret == JFileChooser.APPROVE_OPTION){ if(ret == JFileChooser.APPROVE_OPTION){
File file = fc.getSelectedFile(); File file = fc.getSelectedFile();
@ -273,6 +274,7 @@ public class FrameShipsCollection extends JFrame {
private void loadSet(){ private void loadSet(){
JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents"); JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents");
int ret = fc.showDialog(null, "Открыть файл"); int ret = fc.showDialog(null, "Открыть файл");
fc.addChoosableFileFilter(new TxtFilter());
if(ret == JFileChooser.APPROVE_OPTION){ if(ret == JFileChooser.APPROVE_OPTION){
File file = fc.getSelectedFile(); File file = fc.getSelectedFile();
try { try {