Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ui;
- import java.io.File;
- import java.io.FileNotFoundException;
- import javax.swing.JOptionPane;
- import domainmodel.Bib;
- import domainmodel.Database;
- import domainmodel.Item;
- import domainmodel.ItemFactory;
- public class UI {
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String type = JOptionPane.showInputDialog(null,"Welke type item wilt u toevoegen van item?");
- String id = JOptionPane.showInputDialog(null,"Welk ID heeft dit item?");
- String titel = JOptionPane.showInputDialog(null, "Geef de titel van het item?");
- File data = new File("Data.txt");
- Bib bib = new Bib("Bib Brussel");
- Database databaseOne = new Database();
- ItemFactory builder = new ItemFactory();
- Item item = builder.createItem(type, id, titel);
- bib.addItem(item);
- try{
- int x = -1;
- while (x != 0) {
- //databaseOne.leesUitBestand(data);
- String txt = "";
- txt = JOptionPane.showInputDialog(null,"Toon assortiment van " + bib.getnaam() +" druk 1"+"\n druk 2 om nog een item toe te voegen"+" \n druk 3 om item te zoeken in bib " +" \n druk 100 om de toepassing af te sluiten");
- x = Integer.parseInt(txt);
- if(x == 1)
- {
- JOptionPane.showMessageDialog(null, bib.toString());
- }
- if ( x == 2)
- {
- String type2 = JOptionPane.showInputDialog(null,"Welke type item wilt u toevoegen van item?");
- String id2 = JOptionPane.showInputDialog(null,"Welk ID heeft dit item?");
- String titel2 = JOptionPane.showInputDialog(null, "Geef de titel van het item?");
- Item item2 = builder.createItem(type2, id2, titel2);
- bib.addItem(item2);
- }
- if( x == 3 )
- {
- String zoekID = JOptionPane.showInputDialog(null,"Geef ID van het item dat u zoekt");
- JOptionPane.showMessageDialog(null, bib.getItem(zoekID));
- }
- if( x == 100)
- {
- databaseOne.schrijfNaarBestand(bib,data);
- x = 0;
- }
- }
- }
- catch(FileNotFoundException e)
- {
- e.printStackTrace();
- }
- }
- }// end UI
Add Comment
Please, Sign In to add comment