本文整理了Java中javax.swing.JComboBox.revalidate()
方法的一些代码示例,展示了JComboBox.revalidate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.revalidate()
方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:revalidate
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
private void addRecentTregexPattern(String pattern) {
// If pattern already exists, just move it to the top of the list
int existingIndex = recentTregexPatternsModel.getIndexOf(pattern);
if (existingIndex != -1) {
recentTregexPatternsModel.removeElementAt(existingIndex);
recentTregexPatternsModel.insertElementAt(pattern, 0);
recentTregexPatterns.setSelectedIndex(0);
return;
}
if(recentTregexPatternsModel.getSize() >= numRecentPatterns) {
recentTregexPatternsModel.removeElementAt(numRecentPatterns - 1);
}
recentTregexPatternsModel.insertElementAt(pattern,0);
recentTregexPatterns.setSelectedIndex(0);
recentTregexPatterns.revalidate();
}
代码示例来源:origin: com.clearnlp/clearnlp
@SuppressWarnings("unchecked")
private void resetCBTrees(List<DEPTree> trees)
{
int i, size = trees.size();
cb_trees.removeAllItems();
for (i=0; i<size; i++)
cb_trees.addItem(Integer.toString(i)+" - "+trees.get(i).toStringRaw());
cb_trees.revalidate();
}
代码示例来源:origin: com.googlecode.clearnlp/clearnlp
private void resetCBTrees(List<DEPTree> trees)
{
int i, size = trees.size();
cb_trees.removeAllItems();
for (i=0; i<size; i++)
cb_trees.addItem(Integer.toString(i)+" - "+trees.get(i).toStringRaw());
cb_trees.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Adds auto complete support to the drop down box.
*
* @param list
* list representation of content
* @param contextBox
* JComboBox to wrap
*/
private void addAutoCompleteSupport(List<Object> list, final JComboBox contextBox) {
final Object[] elements = list.toArray();
// request the event-dispatching thread to run certain code
Runnable doWorkRunnable = new Runnable() {
public void run() {
SortedList<Object> sorted = new SortedList<Object>(GlazedLists.eventListOf(elements));
// auto completion support for selection list
support = AutoCompleteSupport.install(contextBox, sorted);
support.setStrict(true);
support.setFilterMode(TextMatcherEditor.CONTAINS);
}
};
SwingUtilities.invokeLater(doWorkRunnable);
contextBox.revalidate();
}
代码示例来源:origin: clearnlp/clearnlp
@SuppressWarnings("unchecked")
private void resetCBTrees(List<DEPTree> trees)
{
int i, size = trees.size();
cb_trees.removeAllItems();
for (i=0; i<size; i++)
cb_trees.addItem(Integer.toString(i)+" - "+trees.get(i).toStringRaw());
cb_trees.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Get node selection from graph for tag.
*
*/
private void initTag() {
tags.removeAllItems();
tags.addItem("");
tags.addItem(Config.language.getProperty("Dialog.Concept.PickNew"));
for (ONDEXConcept c : viewer.getPickedNodes()) {
tags.addItem(String.valueOf(c.getId()));
}
tags.setSelectedIndex(0);
tags.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Get node selection from graph for context.
*
*/
private void initTags() {
tags.removeAllItems();
tags.addItem("");
tags.addItem(Config.language.getProperty("Dialog.Relation.PickNew"));
for (ONDEXConcept c : viewer.getPickedNodes()) {
tags.addItem(String.valueOf(c.getId()));
}
tags.setSelectedIndex(0);
tags.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Adds concept accession data sources to drop down box
*/
private void populateAccessionDataSource() {
// accessions are first index by data source
DataSource[] dataSources = accessions.keySet().toArray(new DataSource[0]);
Arrays.sort(dataSources);
// update drop-down box
accessionDataSource.removeActionListener(this);
accessionDataSource.removeAllItems();
for (DataSource ds : dataSources) {
accessionDataSource.addItem(ds);
}
accessionDataSource.addActionListener(this);
accessionDataSource.setSelectedIndex(0);
accessionDataSource.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Get node selection from graph.
*
*/
private void initNodes() {
from.removeAllItems();
to.removeAllItems();
from.addItem("");
to.addItem("");
from.addItem(Config.language.getProperty("Dialog.Relation.PickNew"));
to.addItem(Config.language.getProperty("Dialog.Relation.PickNew"));
for (ONDEXConcept c : viewer.getPickedNodes()) {
from.addItem(String.valueOf(c.getId()));
to.addItem(String.valueOf(c.getId()));
}
from.setSelectedIndex(0);
to.setSelectedIndex(0);
from.revalidate();
to.revalidate();
}
代码示例来源:origin: cmu-phil/tetrad
public void actionPerformed(ActionEvent e) {
JComboBox combo = (JComboBox) e.getSource();
BpcAlgorithmType type = (BpcAlgorithmType) combo.getSelectedItem();
getParams().set("bpcAlgorithmType", type);
if (type == BpcAlgorithmType.FIND_TWO_FACTOR_CLUSTERS) {
testSelector.removeAllItems();
testSelector.addItem(TestType.SAG);
testSelector.addItem(TestType.GAP);
testSelector.revalidate();
}
else {
testSelector.removeAllItems();
testSelector.addItem(TestType.TETRAD_WISHART);
testSelector.addItem(TestType.TETRAD_DELTA);
testSelector.revalidate();
}
if (paramsPureClusters.get("tetradTestType", TestType.TETRAD_WISHART) == TestType.TETRAD_WISHART) {
testSelector.setSelectedItem(TestType.TETRAD_WISHART);
}
else {
testSelector.setSelectedItem(TestType.TETRAD_DELTA);
}
}
});
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Loads available DataSources into ComboBox.
*
*/
protected void initDataSource(String selected) {
// get list of available data sources
Vector<String> dataSources = new Vector<String>();
dataSources.add("");
dataSources.add(Config.language.getProperty("Dialog.Concept.CreateDataSource"));
DataSource[] sorted = graph.getMetaData().getDataSources().toArray(new DataSource[0]);
Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator());
for (DataSource dataSource : sorted) {
dataSources.add(dataSource.getId());
}
dataSource.removeAllItems();
for (String ds : dataSources) {
dataSource.addItem(ds);
}
if (selected != null)
dataSource.setSelectedItem(selected);
dataSource.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Loads available EvidenceTypes into ComboBox.
*
*/
protected void initEvidenceTypes(String selected) {
// get list of available evidence types
Vector<String> evidenceTypes = new Vector<String>();
evidenceTypes.add("");
evidenceTypes.add(Config.language.getProperty("Dialog.Relation.CreateEvidenceType"));
EvidenceType[] sorted = graph.getMetaData().getEvidenceTypes().toArray(new EvidenceType[0]);
Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator());
for (EvidenceType et : sorted) {
evidenceTypes.add(et.getId());
}
evidences.removeAllItems();
for (String et : evidenceTypes) {
evidences.addItem(et);
}
if (selected != null)
evidences.setSelectedItem(selected);
evidences.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Loads available RelationTypes into ComboBox.
*
*/
protected void initRelationType(String selected) {
// get list of available relation types
Vector<String> relationTypes = new Vector<String>();
relationTypes.add("");
relationTypes.add(Config.language.getProperty("Dialog.Relation.CreateRelationType"));
RelationType[] sorted = graph.getMetaData().getRelationTypes().toArray(new RelationType[0]);
Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator());
for (RelationType rt : sorted) {
relationTypes.add(rt.getId());
}
relationType.removeAllItems();
for (String rt : relationTypes) {
relationType.addItem(rt);
}
if (selected != null)
relationType.setSelectedItem(selected);
relationType.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Loads available ConceptClasses into ComboBox.
*
*/
protected void initConceptClass(String selected) {
// get list of available concept classes
Vector<String> conceptClasses = new Vector<String>();
conceptClasses.add("");
conceptClasses.add(Config.language.getProperty("Dialog.Concept.CreateConceptClass"));
// sort meta data concept classes
ConceptClass[] sorted = graph.getMetaData().getConceptClasses().toArray(new ConceptClass[0]);
Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator());
for (ConceptClass cc : sorted) {
conceptClasses.add(cc.getId());
}
conceptClass.removeAllItems();
for (String cc : conceptClasses) {
conceptClass.addItem(cc);
}
if (selected != null)
conceptClass.setSelectedItem(selected);
conceptClass.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Loads available EvidenceTypes into ComboBox.
*
*/
protected void initEvidenceType(String selected) {
// get list of available evidence types
Vector<String> evidenceTypes = new Vector<String>();
evidenceTypes.add("");
evidenceTypes.add(Config.language.getProperty("Dialog.Concept.CreateEvidenceType"));
// sort meta data evidence types
EvidenceType[] sorted = graph.getMetaData().getEvidenceTypes().toArray(new EvidenceType[0]);
Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator());
for (EvidenceType et : sorted) {
evidenceTypes.add(et.getId());
}
evidences.removeAllItems();
for (String et : evidenceTypes) {
evidences.addItem(et);
}
if (selected != null)
evidences.setSelectedItem(selected);
evidences.revalidate();
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2-default
/**
* Populates given combo box with list of AttributeNames for visible
* concepts.
*
* @param box
* JComboBox to fill
*/
private void populateComboBox(JComboBox box) {
Set<AttributeName> ans = new HashSet<AttributeName>();
for (ONDEXConcept n : graph.getVertices()) {
for (Attribute g : n.getAttributes()) {
if (!AppearanceSynchronizer.attr
.contains(g.getOfType().getId()))
ans.add(g.getOfType());
}
}
box.removeAllItems();
box.addItem("None");
if (ans.size() > 0) {
AttributeName[] array = ans.toArray(new AttributeName[0]);
Arrays.sort(array);
for (AttributeName an : array) {
box.addItem(an);
}
box.revalidate();
}
}
代码示例来源:origin: atdl4j/atdl4j
@Override
public void applyConstOrInitValues() {
super.applyConstOrInitValues();
dropDownList.setMaximumSize(new Dimension(dropDownList.getPreferredSize().width + 5, dropDownList.getPreferredSize().height));
dropDownList.revalidate();
}
代码示例来源:origin: edu.stanford.nlp/stanford-corenlp
private void addRecentTregexPattern(String pattern) {
// If pattern already exists, just move it to the top of the list
int existingIndex = recentTregexPatternsModel.getIndexOf(pattern);
if (existingIndex != -1) {
recentTregexPatternsModel.removeElementAt(existingIndex);
recentTregexPatternsModel.insertElementAt(pattern, 0);
recentTregexPatterns.setSelectedIndex(0);
return;
}
if(recentTregexPatternsModel.getSize() >= numRecentPatterns) {
recentTregexPatternsModel.removeElementAt(numRecentPatterns - 1);
}
recentTregexPatternsModel.insertElementAt(pattern,0);
recentTregexPatterns.setSelectedIndex(0);
recentTregexPatterns.revalidate();
}
代码示例来源:origin: bcdev/beam
private void onRgbaExpressionChanged() {
if (settingRgbaExpressions) {
return;
}
final ProfileItem profileItem = getSelectedProfileItem();
if (profileItem != null) {
if (isSelectedProfileModified()) {
profileBox.revalidate();
profileBox.repaint();
}
}
updateUIState();
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
public void contentsChanged(ListDataEvent e)
{
if (!(e.getIndex0() == -1 && e.getIndex1() == -1))
{
isMinimumSizeDirty= true;
comboBox.revalidate();
}
// set the editor with the selected item since this
// is the event handler for a selected item change.
if (comboBox.isEditable() && editor != null)
{
comboBox.configureEditor(
comboBox.getEditor(),
comboBox.getSelectedItem());
}
comboBox.repaint();
}
内容来源于网络,如有侵权,请联系作者删除!