当前位置: 首页>>代码示例>>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;未经允许,请勿转载。