ApplicationFrame now correctly displays menu with maps on run()
This commit is contained in:
parent
46ced04536
commit
5c32997f8b
@ -3,6 +3,7 @@ package cicaprojekt;
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -10,32 +11,42 @@ import java.util.List;
|
||||
public class ApplicationFrame implements Runnable
|
||||
{
|
||||
private JFrame jframe;
|
||||
|
||||
private JPanel mapselectorpanel;
|
||||
private JPanel gamepanel;
|
||||
|
||||
private JList<File> filelist;
|
||||
|
||||
|
||||
public ApplicationFrame(){}
|
||||
|
||||
public void init(){
|
||||
jframe = new JFrame();
|
||||
jframe.setMinimumSize(new Dimension(600, 400));
|
||||
|
||||
mapselectorpanel = new JPanel();
|
||||
|
||||
List<File> dungeons = new ArrayList<>();
|
||||
DefaultListModel<File> dungeonslist = new DefaultListModel<>();
|
||||
File dir = new File(System.getProperty("user.dir"));
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("dungeon");
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("N/A", "dungeon");
|
||||
|
||||
for (File f : dir.listFiles()) {
|
||||
if (filter.accept(f)){
|
||||
dungeons.add(f);
|
||||
if (filter.accept(f) && f.isFile()){
|
||||
dungeonslist.addElement(f);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO create a JTable and put it into mapselectorpanel
|
||||
filelist = new JList<>(dungeonslist);
|
||||
filelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
filelist.setLayoutOrientation(JList.HORIZONTAL_WRAP);
|
||||
|
||||
mapselectorpanel.add(filelist);
|
||||
|
||||
jframe.add(mapselectorpanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
public void run() {
|
||||
jframe.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user