Package net.sf.cannagrower.data

Examples of net.sf.cannagrower.data.Variety


  private void initialize() {
    ContainerVector   varietiesAvaible         = Resources.getResources().getVarieties();
    java.util.Iterator<Container> iterator=varietiesAvaible.iterator();
    while(iterator.hasNext()){
      Container ghost=(Container)iterator.next();
      Variety variety;
     
      try{variety=(Variety)ghost.getData();}
      catch(ClassNotFoundException e){Messages.showException(e);variety=null;}
      catch(IOException e){Messages.showException(e);variety=null;}
   
      // Checking if variety type is added.
      Plants plants=(Plants)panel.getEvent();
      if (!plants.getVarieties().contains(variety)) {
        // Adding jMenu
        JMenuItem jMenuItem = new JMenuItem();
        jMenuItem.setText(variety.getName());       
        jMenuItem.setName(variety.toString());
        jMenuItem
            .addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(
                  java.awt.event.ActionEvent e) {
                JMenuItem jMenuItem = (JMenuItem) e.getSource();
                ContainerVector   varietiesAvaible         = Resources.getResources().getVarieties();
                java.util.Iterator<Container> iterator=varietiesAvaible.iterator();
                while(iterator.hasNext()){
                  Container ghost=(Container)iterator.next();
                  Variety variety;
                 
                  try{variety=(Variety)ghost.getData();}
                  catch(ClassNotFoundException ex){Messages.showException(ex);variety=null;}
                  catch(IOException ex){Messages.showException(ex);variety=null;}
                 
                  if(variety.toString().equals(jMenuItem.getName())){
                    Plants plants=(Plants)panel.getEvent();
                    plants.setPlants(variety,1);
                    // Refresh
                    panel.setEvent(panel.getEvent());
                  }
View Full Code Here

TOP

Related Classes of net.sf.cannagrower.data.Variety

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.