SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public void load() {
  2.         System.out.println("LOADING");
  3.         pnlCheckBoxes.removeAll();
  4.         Session s = NewHibernateUtil.getSessionFactory().openSession();
  5.         Transaction t = s.beginTransaction();
  6.  
  7.         String qry = "from TestMethods";
  8.  
  9.         Query q = s.createQuery(qry);
  10.  
  11.         List l = q.list();
  12.  
  13.         Iterator<TestMethods> it = l.iterator();
  14.  
  15.         while (it.hasNext()) {
  16.             TestMethods tm = it.next();
  17.             System.out.println(tm.getMethodName());
  18.             XCheckBox cb = new XCheckBox();
  19.             cb.setText(tm.getMethodName());
  20.             cb.setValue(tm);
  21.            
  22.             pnlCheckBoxes.add(cb);
  23.         }
  24.         t.commit();
  25.         pnlCheckBoxes.revalidate();
  26.         pnlCheckBoxes.repaint();
  27.         System.out.println("END");
  28.  
  29.     }
  30.  
  31.  
  32.  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  33.         Component c[] = pnlCheckBoxes.getComponents();
  34.        
  35.        for(int x=0;x<c.length;x++){
  36.            Component cx = c[x];
  37.            if(cx instanceof XCheckBox){
  38.                XCheckBox cb = (XCheckBox) cx;
  39.                TestMethods tm = (TestMethods)cb.getValue();
  40.                if(cb.isSelected())System.out.println(tm.getMethodName()+" is selected");
  41.            }
  42.        }
  43.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top