Skip to content
Snippets Groups Projects
Commit 12825b2b authored by steyer's avatar steyer
Browse files

kezdetleges JFileChooser

parent 81aed3a4
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,12 @@ public class JTableTest { ...@@ -9,7 +9,12 @@ public class JTableTest {
public static void main(String[] args) { public static void main(String[] args) {
GameModel testModel = new GameModel(10, 10); GameModel testModel = new GameModel(10, 10);
testModel.setValueAt(true, 0, 0); testModel.setValueAt(true, 4, 4);
testModel.setValueAt(true, 4, 5);
testModel.setValueAt(true, 4, 6);
testModel.setValueAt(true, 5, 3);
testModel.setValueAt(true, 5, 4);
testModel.setValueAt(true, 5, 5 );
JFrame testFrame = new JFrame(); JFrame testFrame = new JFrame();
testFrame.setLayout(new BorderLayout()); testFrame.setLayout(new BorderLayout());
testFrame.add(new JTable(testModel)); testFrame.add(new JTable(testModel));
......
...@@ -8,5 +8,9 @@ public class StartWindowTest { ...@@ -8,5 +8,9 @@ public class StartWindowTest {
public static void main(String[] args) { public static void main(String[] args) {
JFrame startWindowFrame = new StartWindow(); JFrame startWindowFrame = new StartWindow();
startWindowFrame.setVisible(true); startWindowFrame.setVisible(true);
StartModel start = new StartModel();
start.loadFromFile();
} }
} }
package game;
public class GameBoardSaver {
//TODO JFileChooser
}
package game;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
public class StartModel {
private JFrame startFrame;
private JFileChooser fileChooser;
GameModel game;
GameBoard board;
public StartModel(){
startFrame = new StartWindow();
fileChooser = new JFileChooser();
FileFilter filter = new FileNameExtensionFilter("JSON File (.json)", "json");
fileChooser.setFileFilter(filter);
}
public void loadFromFile(){
int returnVal = fileChooser.showOpenDialog(startFrame);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment