GUIUtils.java 595 B

1234567891011121314151617181920212223
  1. package eu.tankernn.accounts.frame;
  2. import java.util.List;
  3. import javax.swing.ComboBoxModel;
  4. import javax.swing.DefaultComboBoxModel;
  5. import javax.swing.DefaultListModel;
  6. public class GUIUtils {
  7. public static <T> DefaultListModel<T> listModelFromList(List<T> list) {
  8. DefaultListModel<T> model = new DefaultListModel<T>();
  9. for (T a : list)
  10. model.addElement(a);
  11. return model;
  12. }
  13. public static <T> ComboBoxModel<T> comboBoxModelFromList(List<T> list) {
  14. DefaultComboBoxModel<T> model = new DefaultComboBoxModel<T>();
  15. for (T a : list)
  16. model.addElement(a);
  17. return model;
  18. }
  19. }