Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void load() {
- System.out.println("LOADING");
- pnlCheckBoxes.removeAll();
- Session s = NewHibernateUtil.getSessionFactory().openSession();
- Transaction t = s.beginTransaction();
- String qry = "from TestMethods";
- Query q = s.createQuery(qry);
- List l = q.list();
- Iterator<TestMethods> it = l.iterator();
- while (it.hasNext()) {
- TestMethods tm = it.next();
- System.out.println(tm.getMethodName());
- XCheckBox cb = new XCheckBox();
- cb.setText(tm.getMethodName());
- cb.setValue(tm);
- pnlCheckBoxes.add(cb);
- }
- t.commit();
- pnlCheckBoxes.revalidate();
- pnlCheckBoxes.repaint();
- System.out.println("END");
- }
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- Component c[] = pnlCheckBoxes.getComponents();
- for(int x=0;x<c.length;x++){
- Component cx = c[x];
- if(cx instanceof XCheckBox){
- XCheckBox cb = (XCheckBox) cx;
- TestMethods tm = (TestMethods)cb.getValue();
- if(cb.isSelected())System.out.println(tm.getMethodName()+" is selected");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement