List of usage examples for javax.swing JList setName
public void setName(String name)
From source file:fr.duminy.jbackup.swing.ConfigurationManagerPanel.java
private static JList<BackupConfiguration> createList(ConfigurationManager manager) { //TODO enable sorting : JList list = new JList(new SortedListModel(new DefaultListModel(), COMPARATOR)); JList<BackupConfiguration> list = new JList<>(new Model(manager)); list.setCellRenderer(BackupConfigurationRenderer.INSTANCE); list.setName("configurations"); return list;/* ww w. j a va 2s . co m*/ }
From source file:Main.java
public static JList generateListFor(Object... objs) { Container c = search(objs, Container.class); String[] name_value = search(objs, String[].class); ListModel model = search(objs, ListModel.class); Object[] dataObjects = search(objs, Object[].class); Vector dataVector = search(objs, Vector.class); ListSelectionListener selectionListener = search(objs, ListSelectionListener.class); ListUI ui = search(objs, ListUI.class); ListSelectionModel selectionModel = search(objs, ListSelectionModel.class); ListCellRenderer cellRenderer = search(objs, ListCellRenderer.class); JList list = model == null ? (dataObjects == null ? (dataVector == null ? new JList() : new JList(dataVector)) : new JList(dataObjects)) : new JList(model); list.setName(name_value == null ? "" : name_value[0]); if (selectionListener != null) list.addListSelectionListener(selectionListener); if (ui != null) list.setUI(ui);//from w w w .j a v a 2 s.c om if (selectionModel != null) list.setSelectionModel(selectionModel); if (cellRenderer != null) list.setCellRenderer(cellRenderer); addJContainerListeners(list, objs); if (c != null) addToContainer(c, list); return list; }
From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java
/** * /*from ww w .java2 s. c om*/ * @param name * @param model * @param cellRenderer * @return */ public static JList list(final String name, final ListModel model, final ListCellRenderer cellRenderer) { final JList list = new JList(); list.setName(name); list.setModel(model); if (cellRenderer != null) { list.setCellRenderer(cellRenderer); } return list; }
From source file:fr.duminy.jbackup.swing.SourceListTypeMapper.java
@Nonnull @Override/* w ww.ja va 2 s .c om*/ public ListPanel<Source, JList<Source>> createEditorComponent() { JList<Source> list = new JList(new DefaultMutableListModel<Source>()); list.setName("sources"); list.setCellRenderer(SourceRenderer.INSTANCE); DefaultFormBuilder sourceFormBuilder = new DefaultFormBuilder<Source>(Source.class) { @Override protected void configureBuilder(FormBuilder<Source> builder) { super.configureBuilder(builder); builder.useForProperty("path", new StringPathTypeMapper(SHOW_HIDDEN_FILES_BUILDER)); } }; SimpleItemManager<Source> sourceProvider = new SimpleItemManager<>(Source.class, sourceFormBuilder, parent, "Source", DIALOG); return new SourceListPanel(list, sourceProvider); }