本文整理汇总了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;
}
}
示例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);
}
};
}
示例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()});
}
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
});
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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");
}
}
}
示例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();
}
}