当前位置: 首页>>代码示例>>Java>>正文


Java JList.getSelectedValue方法代码示例

本文整理汇总了Java中javax.swing.JList.getSelectedValue方法的典型用法代码示例。如果您正苦于以下问题:Java JList.getSelectedValue方法的具体用法?Java JList.getSelectedValue怎么用?Java JList.getSelectedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JList的用法示例。


在下文中一共展示了JList.getSelectedValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectListenerClass

import javax.swing.JList; //导入方法依赖的package包/类
private String selectListenerClass(JavaComponentInfo ci) {
    List<ReferenceType> attachableListeners = RemoteServices.getAttachableListeners(ci);
    //System.err.println("Attachable Listeners = "+attachableListeners);
    String[] listData = new String[attachableListeners.size()];
    for (int i = 0; i < listData.length; i++) {
        listData[i] = attachableListeners.get(i).name();
    }
    JList jl = new JList(listData);
    JScrollPane jsp = new JScrollPane(jl);
    NotifyDescriptor nd = new DialogDescriptor(jsp,
            NbBundle.getMessage(EventsModel.class, "TTL_SelectListener"),
            true, null);
    Object res = DialogDisplayer.getDefault().notify(nd);
    if (DialogDescriptor.OK_OPTION.equals(res)) {
        String clazz = (String) jl.getSelectedValue();
        return clazz;
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:EventsModel.java

示例2: createListSelectionListener

import javax.swing.JList; //导入方法依赖的package包/类
private ListSelectionListener createListSelectionListener(final JList<Configurable> list) {
	return new ListSelectionListener() {

		@Override
		public void valueChanged(ListSelectionEvent e) {

			if (e.getValueIsAdjusting()) {
				return;
			}
			Configurable configurable = list.getSelectedValue();
			updateParameterPanel(configurable);
			previousConfigurable = configurable;

			if (e.getSource() == list && configurable != null) {
				unselectAllOtherLists(configurable.getSource());
			}
			updateButtonState(true);
		}
	};
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:ConfigurableDialog.java

示例3: valueChanged

import javax.swing.JList; //导入方法依赖的package包/类
public void valueChanged(ListSelectionEvent e) {
    if(!e.getValueIsAdjusting()) {
        JList source = (JList)e.getSource();
        if(!source.isSelectionEmpty()) {
            if(!this.otherList.isSelectionEmpty()) {
                this.otherList.clearSelection();
            }

            PackageDescriptor desc = null;
            Object selectedValue = source.getSelectedValue();
            desc = (PackageDescriptor)selectedValue;

            try {
                ConfirmLicensesDialog.this.setLicensePaneContent(desc);
            } catch (Exception var6) {
                SwingTools.showSimpleErrorMessage("error_installing_update", var6, new Object[]{var6.getMessage()});
            }
        }
    }

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:22,代码来源:ConfirmLicensesDialog.java

示例4: valueChanged

import javax.swing.JList; //导入方法依赖的package包/类
@Override
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting() == false) {
        @SuppressWarnings("unchecked")
        JList<String> list = (JList<String>) e.getSource();
        String selectedValue = (String) list.getSelectedValue();

        String oldValue = textComponent.getText();
        textComponent.setText(selectedValue);
        if (!oldValue.equalsIgnoreCase(selectedValue)) {
            textComponent.selectAll();
            textComponent.requestFocus();
        }

        updateSampleFont();
    }
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:18,代码来源:FontChooser.java

示例5: valueChanged

import javax.swing.JList; //导入方法依赖的package包/类
public void valueChanged(ListSelectionEvent e)
{
    if (e.getValueIsAdjusting() == false)
    {
        JList list = (JList) e.getSource();
        String selectedValue = (String) list.getSelectedValue();

        String oldValue = textComponent.getText();
        textComponent.setText(selectedValue);
        if (!oldValue.equalsIgnoreCase(selectedValue))
        {
            textComponent.selectAll();
            textComponent.requestFocus();
        }

        updateSampleFont();
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:19,代码来源:JFontChooser.java

示例6: invokeSelectedItem

import javax.swing.JList; //导入方法依赖的package包/类
/** Actually invokes action selected in the results list */
public void invokeSelectedItem () {
    JList list = displayer.getList();
    ResultsModel.ItemResult ir = (ItemResult) list.getSelectedValue();

    // special handling of invocation of "more results item" (three dots)
    if (ir != null) {
        Runnable action = ir.getAction();
        if (action instanceof CategoryResult) {
            CategoryResult cr = (CategoryResult)action;
            evaluate(cr.getCategory());
            return;
        }
    }

    // #137259: invoke only some results were found
    if (list.getModel().getSize() > 0) {
        returnFocus(false);
        // #137342: run action later to let focus indeed be transferred
        // by previous returnFocus() call
        SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    displayer.invoke();
                }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:AbstractQuickSearchComboBar.java

示例7: getSelectedValue

import javax.swing.JList; //导入方法依赖的package包/类
private Configurable getSelectedValue() {

		if (!localConfigList.isSelectionEmpty()) {
			return localConfigList.getSelectedValue();
		} else {
			for (JList<Configurable> list : remoteConfigLists.values()) {
				if (!list.isSelectionEmpty()) {
					return list.getSelectedValue();
				}
			}
		}
		return null;
	}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:ConfigurableDialog.java

示例8: valueChanged

import javax.swing.JList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void valueChanged(ListSelectionEvent e)
{
    JList<String> v_Tables    = (JList<String>)e.getSource();
    String        v_TableName = v_Tables.getSelectedValue();
    
    if ( !JavaHelp.isNull(v_TableName) )
    {
        if ( !v_TableName.equals(this.getTableName()) )
        {
            this.getAppFrame().setTableName(v_TableName);
        }
    }
}
 
开发者ID:HY-ZhengWei,项目名称:HBaseClient,代码行数:16,代码来源:SelectTableInfoListener.java

示例9: createTransferable

import javax.swing.JList; //导入方法依赖的package包/类
@Override
public Transferable createTransferable(JComponent component) {
	if (component instanceof JList) {
		JList<?> list = (JList<?>) component;
		Object value = list.getSelectedValue();
		
		if (value instanceof Gate) {
			Gate gate = (Gate) value;
			return new GateTransferable(gate);
		}
	}
	
	return null;
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:15,代码来源:GateList.java

示例10: valueChanged

import javax.swing.JList; //导入方法依赖的package包/类
@Override
public void valueChanged(ListSelectionEvent e) {
	if (!e.getValueIsAdjusting()) {
		JList<?> list = (JList<?>) e.getSource();
		if (!list.isSelectionEmpty()) {
			selectedRecord = (Record) list.getSelectedValue();
			References.CHRONOMETER.setChronometerValue(String.format("%02d : %02d . %02d",
					selectedRecord.getMinutes(), selectedRecord.getSeconds(), selectedRecord.getHundreths()));
		} else {
			References.CHRONOMETER.setChronometerValue("00 : 00 . 00");
		}
	}
}
 
开发者ID:AitorB,项目名称:POPBL_V,代码行数:14,代码来源:RecordPanel.java

示例11: valueChanged

import javax.swing.JList; //导入方法依赖的package包/类
public void valueChanged(ListSelectionEvent e) {
	if (e.getValueIsAdjusting() == false) {
		JList<?> list = (JList<?>) e.getSource();
		String selectedValue = (String) list.getSelectedValue();

		String oldValue = textComponent.getText();
		textComponent.setText(selectedValue);
		if (!oldValue.equalsIgnoreCase(selectedValue)) {
			textComponent.selectAll();
			textComponent.requestFocus();
		}

		updateSampleFont();
	}
}
 
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:16,代码来源:JFontChooser.java


注:本文中的javax.swing.JList.getSelectedValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。