當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractListModel類代碼示例

本文整理匯總了Java中javax.swing.AbstractListModel的典型用法代碼示例。如果您正苦於以下問題:Java AbstractListModel類的具體用法?Java AbstractListModel怎麽用?Java AbstractListModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractListModel類屬於javax.swing包,在下文中一共展示了AbstractListModel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeList

import javax.swing.AbstractListModel; //導入依賴的package包/類
private JList<String> makeList(final String[][] items, int visibleRows, Container parent) {
	JList<String> list = new JList<>(new AbstractListModel<String>()	{
		/**
		 * 
		 */
		private static final long serialVersionUID = 6510576197401709714L;

		public String getElementAt(int i) {
			return items[i][0];				
		}
		
		public int getSize() {
			return items.length;
		}
	});

	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	list.setVisibleRowCount(visibleRows);
	parent.add(new JScrollPane(list));
	return list;
}
 
開發者ID:guilhebl,項目名稱:routerapp,代碼行數:22,代碼來源:OpenGraphDialog.java

示例2: ScrollBivariatePanel

import javax.swing.AbstractListModel; //導入依賴的package包/類
public ScrollBivariatePanel(JWatBivariateStatsTable table) {
	tab = table;
	setViewportView(tab);
	ListModel lm = new AbstractListModel() {

		private static final long serialVersionUID = 1L;

		String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();

		public int getSize() {
			return headers.length;
		}

		public Object getElementAt(int index) {
			return headers[index];
		}

	};
	JList rowHeader = new JList(lm);
	rowHeader.setBackground(getBackground());
	rowHeader.setFixedCellWidth(100);
	rowHeader.setFixedCellHeight(tab.getRowHeight());
	rowHeader.setCellRenderer(new RowHeaderRenderer(tab));
	setRowHeaderView(rowHeader);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:26,代碼來源:ScrollBivariatePanel.java

示例3: setNames

import javax.swing.AbstractListModel; //導入依賴的package包/類
public void setNames() {
	ListModel lm = new AbstractListModel() {

		private static final long serialVersionUID = 1L;

		String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();

		public int getSize() {
			return headers.length;
		}

		public Object getElementAt(int index) {
			return headers[index];
		}

	};
	JList rowHeader = new JList(lm);
	rowHeader.setBackground(getBackground());
	rowHeader.setFixedCellWidth(100);
	rowHeader.setFixedCellHeight(tab.getRowHeight());
	rowHeader.setCellRenderer(new RowHeaderRenderer(tab));
	setRowHeaderView(rowHeader);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:24,代碼來源:ScrollBivariatePanel.java

示例4: setNames

import javax.swing.AbstractListModel; //導入依賴的package包/類
public void setNames() {
	ListModel lm = new AbstractListModel() {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();

		public int getSize() {
			return headers.length;
		}

		public Object getElementAt(int index) {
			return headers[index];
		}
	};
	JList rowHeader = new JList(lm);
	rowHeader.setBackground(getBackground());
	rowHeader.setFixedCellWidth(100);
	rowHeader.setFixedCellHeight(tab.getRowHeight());

	rowHeader.setCellRenderer(new RowHeaderRenderer(tab));

	setRowHeaderView(rowHeader);
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:26,代碼來源:ScrollBivariatePanel.java

示例5: SelectBaseFunctionDialog

import javax.swing.AbstractListModel; //導入依賴的package包/類
public SelectBaseFunctionDialog(GUIFramework framework) {
    super(framework.getMainFrame(), true);
    setTitle(GlobalResourcesManager.getString("SelectModel"));
    result = null;
    final List<Qualifier> base = IDEF0Plugin.getBaseQualifiers(framework
            .getEngine());
    Collections.sort(base, new Comparator<Qualifier>() {

        private Collator collator = Collator.getInstance();

        @Override
        public int compare(Qualifier o1, Qualifier o2) {
            return collator.compare(o1.getName(), o2.getName());
        }
    });
    list.setModel(new AbstractListModel() {

        @Override
        public Object getElementAt(int index) {
            return base.get(index);
        }

        @Override
        public int getSize() {
            return base.size();
        }

    });

    JScrollPane pane = new JScrollPane();
    pane.setViewportView(list);
    setMainPane(pane);
    pack();
    setMinimumSize(getSize());
    setLocationRelativeTo(null);
    Options.loadOptions(this);
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:38,代碼來源:SelectBaseFunctionDialog.java

示例6: propertyChange

import javax.swing.AbstractListModel; //導入依賴的package包/類
@Override
public void propertyChange(PropertyChangeEvent evt) {
    final Song[] newQueue = (Song[]) evt.getNewValue();
    
    this.queueList.setModel(new AbstractListModel() {
        @Override
        public int getSize() {
            return  newQueue.length;
        }

        @Override
        public Object getElementAt(int index) {
            return newQueue[index].getTitle();
        }
    });
}
 
開發者ID:bart-kneepkens,項目名稱:OpenHeosControl,代碼行數:17,代碼來源:QueueObserver.java

示例7: setColumns

import javax.swing.AbstractListModel; //導入依賴的package包/類
public void setColumns(final List<EnumTableColumn<E>> enumColumns) {
	columns.clear();
	columnIndex.clear();
	columnIndex.addAll(enumColumns);
	for (EnumTableColumn<E> column : enumColumns) {
		columns.put(column.name(), column);
	}
	jColumnSelection.setModel(new AbstractListModel<EnumTableColumn<E>>() {
		@Override
		public int getSize() {
			return columnIndex.size();
		}

		@Override
		public EnumTableColumn<E> getElementAt(int index) {
			return columnIndex.get(index);
		}
	});
}
 
開發者ID:GoldenGnu,項目名稱:jeveassets,代碼行數:20,代碼來源:ExportDialog.java

示例8: createNamedColorListModel

import javax.swing.AbstractListModel; //導入依賴的package包/類
/**
 * 
 * Creates and returns a listModel with items of type NamedColor.
 * @return a ListModel containing items of type NamedColor.
 */
public static ListModel createNamedColorListModel() {
    final TableModel wrappee = new AncientSwingTeam();
    ListModel model = new AbstractListModel() {

        public Object getElementAt(int index) {
            return wrappee.getValueAt(index, 2);
        }

        public int getSize() {
            return wrappee.getRowCount();
        }
        
    };
    return model;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:21,代碼來源:AncientSwingTeam.java

示例9: setUp

import javax.swing.AbstractListModel; //導入依賴的package包/類
@Override
protected void setUp() throws Exception {
    super.setUp();
    sortableTableModel = new AncientSwingTeam();
    listModel = new AbstractListModel() {

        public int getSize() {
            return sortableTableModel.getRowCount();
        }

        public Object getElementAt(int index) {
            return sortableTableModel.getValueAt(index, 0);
        }
        
    };
    treeTableModel = new FileSystemModel();
    foregroundHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null,
            Color.MAGENTA);
    backgroundHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW,
            null);
 }
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:22,代碼來源:RolloverVisualCheck.java

示例10: testFindPanelFirstRowBackwards

import javax.swing.AbstractListModel; //導入依賴的package包/類
/**
 * Issue #236-swingx: backwards match in first row shows not-found-message.
 * Trackdown from Nicfagn - findPanel.doSearch always returns the next startIndex
 * in backwards search that's -1 which is interpreted as "not-found"
 * 
 */
public void testFindPanelFirstRowBackwards() {
    JXList list = new JXList( new AbstractListModel() {
        private String[] data = { "a", "b", "c" };
        public Object getElementAt(int index) {
            return data[ index ];
        }
        public int getSize() {
            return data.length;
        }
    });
    JXFindPanel findPanel = new JXFindPanel(list.getSearchable());
    findPanel.init();
    PatternModel patternModel = findPanel.getPatternModel();
    patternModel.setBackwards(true);
    patternModel.setRawText("a");
    int matchIndex = list.getSearchable().search(patternModel.getPattern(),
            patternModel.getFoundIndex(), patternModel.isBackwards());
    assertEquals("found match", matchIndex, findPanel.doSearch());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:26,代碼來源:FindIssues.java

示例11: ItemFilterPanel

import javax.swing.AbstractListModel; //導入依賴的package包/類
public ItemFilterPanel() {
	setLayout(new BorderLayout(0, 0));

	JList<String> list = new JList<String>();
	list.setModel(new AbstractListModel<String>() {
		private static final long serialVersionUID = 1L;
		String[] values = new String[] { "Blah", "Blub", "Dingens" };

		public int getSize() {
			return values.length;
		}

		public String getElementAt(int index) {
			return values[index];
		}
	});
	add(list, BorderLayout.CENTER);
}
 
開發者ID:hsteffan,項目名稱:stranded-mapviewer,代碼行數:19,代碼來源:ItemFilterPanel.java

示例12: updateColorList

import javax.swing.AbstractListModel; //導入依賴的package包/類
private void updateColorList(ColorImpressionKnowledge ci) {
    final HSVColor[] colors = ci.getColors();
    final DefaultListModel<Color> colorListModel = new DefaultListModel<Color>();
    for (int i = 0; i < colors.length; i++) {
        colorListModel.addElement(colors[i]);
    }
    colorList.setModel(colorListModel);

    final String[] words = ci.getWords();
    csList.setCellRenderer(new ImpressionWordListCellRenderer(ci, 14f));
    csList.setModel(new AbstractListModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public int getSize() {
            return words.length;
        }

        @Override
        public String getElementAt(int index) {
            return words[index];
        }
    });
}
 
開發者ID:shuichi,項目名稱:MediaMatrix,代碼行數:26,代碼來源:ColorSchemePanel.java

示例13: run

import javax.swing.AbstractListModel; //導入依賴的package包/類
@Override
public void run() 
{
    while(Scanner.status)
    {
        list.setModel(new AbstractListModel() {

        @Override
        public int getSize() {
            return Loading.viruslist.size();
        }

        @Override
        public Object getElementAt(int index) {
            return Loading.viruslist.get(index);
        }
    });
    }
}
 
開發者ID:ashmeh6,項目名稱:ashantivirus,代碼行數:20,代碼來源:VirusDisplay.java

示例14: createColorPicker

import javax.swing.AbstractListModel; //導入依賴的package包/類
@Override
protected JComponent createColorPicker() {
    List<ColorItem> colors = getColorItems();
    JList<ColorItem> view = new JList<>(new AbstractListModel<ColorItem>() {
        @Override
        public int getSize() {
            return colors.size();
        }

        @Override
        public ColorItem getElementAt(int index) {
            return colors.get(index);
        }
    });
    view.setCellRenderer(new ColorItemListCellRenderer());
    view.addListSelectionListener(e -> {
        setSelectedColor(view.getSelectedValue().color);
    });
    return new JScrollPane(view);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:21,代碼來源:ColorSelectionTest.java

示例15: createCenterList

import javax.swing.AbstractListModel; //導入依賴的package包/類
private JComponent createCenterList() {
    centerNames = new JList<>(new AbstractListModel<String>() {
        @Override
        public int getSize() {
            return nameProvider.getCenterNames().length;
        }

        @Override
        public String getElementAt(int index) {
            return nameProvider.getCenterNames()[index];
        }
    });
    centerNames.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    centerNames.addListSelectionListener(new CenterListSelectionListener(centerNames));
    centerNames.setEnabled(false);
    final JScrollPane scrollPane = new JScrollPane(centerNames);
    scrollPane.setPreferredSize(new Dimension(160, 200));
    return scrollPane;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:NamesAssociationDialog.java


注:本文中的javax.swing.AbstractListModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。