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


Java JComboBox.setActionCommand方法代码示例

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


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

示例1: TransferDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public TransferDialog(Component frameComp, Component locationComp,
		String title,  I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	String[] currencies = {"EUR", "USD", "SEK" , "NOK"};
	currencyList = new JComboBox(currencies);
	currencyList.setEditable(true);
	currencyList.addActionListener(this);
	currencyList.setSelectedIndex(0);
	currencyList.setActionCommand(CURRENCY_CHANGED);
	
	totalCostField = new JTextField(FIELD_LEN);
	totalCostField.setEditable(true);
	totalCostField.setText("");		
	totalCostField.addKeyListener(this);
	
	dateFieldLabel = new JLabel("Maksupäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);


	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	currencyFieldLabel = new JLabel("Valuutta: ");
	
	updateRateFieldCcy((String) currencyList.getSelectedItem(), true);
	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:38,代码来源:TransferDialog.java

示例2: TaxDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public TaxDialog(Component frameComp, Component locationComp,
		String title,  I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	String[] currencies = {"EUR", "USD", "SEK" , "NOK"};
	currencyList = new JComboBox(currencies);
	currencyList.setEditable(true);
	currencyList.addActionListener(this);
	currencyList.setSelectedIndex(0);
	currencyList.setActionCommand(CURRENCY_CHANGED);
	
	totalCostField = new JTextField(FIELD_LEN);
	totalCostField.setEditable(true);
	totalCostField.setText("");		
	totalCostField.addKeyListener(this);
	
	dateFieldLabel = new JLabel("Maksupäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);


	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	currencyFieldLabel = new JLabel("Valuutta: ");
	
	updateRateFieldCcy((String) currencyList.getSelectedItem(), true);
	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:38,代码来源:TaxDialog.java

示例3: createSaveBox

import javax.swing.JComboBox; //导入方法依赖的package包/类
protected Component createSaveBox() {
	save = new JComboBox(saveOptions);
	save.addActionListener(this);
	save.addItemListener(this);
	save.addPopupMenuListener(this);
	save.setActionCommand("save");
	return save;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:CustomDB.java

示例4: createSelectBox

import javax.swing.JComboBox; //导入方法依赖的package包/类
protected Component createSelectBox() {
	box = new JComboBox();
	box.addActionListener(this);
	box.addItemListener(this);
	box.addPopupMenuListener(this);
	box.setActionCommand("select");
	return box;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:CustomDB.java

示例5: createCombo

import javax.swing.JComboBox; //导入方法依赖的package包/类
private <E> JComboBox<E> createCombo(String name)
{
	JComboBox<E> combo = new JComboBox<E>();
	combo.setActionCommand(name);
	combo.addActionListener(this);
	return combo;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:8,代码来源:SelectionBar.java

示例6: createCombo

import javax.swing.JComboBox; //导入方法依赖的package包/类
private <E> JComboBox<E> createCombo(String name)
{
    JComboBox<E> combo = new JComboBox<E>();
    combo.setActionCommand(name);
    combo.addActionListener(this);
    return combo;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:8,代码来源:SelectionBar.java

示例7: addConnectors

import javax.swing.JComboBox; //导入方法依赖的package包/类
private void addConnectors(int defaultIndex) {
    //assert connectorsLoaded.get();
    if (connectors.isEmpty()) {
        // no attaching connectors available => print message only
        add (new JLabel (
            NbBundle.getMessage (ConnectPanel.class, "CTL_No_Connector")
        ));
        return;
    }
    if (connectors.size () > 1) {
        // more than one attaching connector available => 
        // init cbConnectors & selext default connector
        
        cbConnectors = new JComboBox ();
        cbConnectors.getAccessibleContext ().setAccessibleDescription (
            NbBundle.getMessage (ConnectPanel.class, "ACSD_CTL_Connector")
        );
        int i, k = connectors.size ();
        for (i = 0; i < k; i++) {
            Connector connector = connectors.get (i);
            int jj = connector.name ().lastIndexOf ('.');
                          
            String s = (jj < 0) ? 
                connector.name () : 
                connector.name ().substring (jj + 1);
            cbConnectors.addItem (
                s + " (" + connector.description () + ")"
            );
        }
        cbConnectors.setActionCommand ("SwitchMe!");
        cbConnectors.addActionListener (this);
    }
    cbConnectors.setSelectedIndex (defaultIndex);
    selectedConnector = connectors.get(defaultIndex);
    setCursor(standardCursor);
    
    synchronized (connectorsLoaded) {
        connectorsLoaded.set(true);
        connectorsLoaded.notifyAll();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:ConnectPanel.java

示例8: CapitalRepaymentDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public CapitalRepaymentDialog(Component frameComp, Component locationComp,
		String title, Object[] brokers, Object[] sectors,
		Map<String, List<String>> stocks, I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	this.stocks = stocks;


	// Brokers

	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);

	// Sectors
	sectorList = new JComboBox(sectors);
	sectorList.setActionCommand(SECTOR_CHANGED);
	sectorList.addActionListener(this);

	// Stocks
	stocksList = new JComboBox();
	updateStockList((String) sectorList.getSelectedItem());
	stocksList.setActionCommand(STOCK_SELECTED);
	stocksList.addActionListener(this);

	amountField.addKeyListener(this);
	costField.addKeyListener(this);

	totalCostField.setEditable(false);
	totalCostField.setText("0.00");		

	sectorFieldLabel = new JLabel("Toimiala: ");
	sectorFieldLabel.setLabelFor(sectorList);

	stockFieldLabel = new JLabel("Arvopaperi: ");
	stockFieldLabel.setLabelFor(stocksList);

	dateFieldLabel = new JLabel("Maksupäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);

	amountFieldLabel = new JLabel("Määrä: ");
	amountFieldLabel.setLabelFor(amountField);

	costFieldLabel = new JLabel("Palautus/osake: ");
	costFieldLabel.setLabelFor(costField);

	brokerFieldLabel = new JLabel("Välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);

	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	String stockName = (String) stocksList.getSelectedItem();
	updateRateField(stockName);
	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:65,代码来源:CapitalRepaymentDialog.java

示例9: DividendDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public DividendDialog(Component frameComp, Component locationComp,
		String title, Object[] brokers, Object[] sectors,
		Map<String, List<String>> stocks, I_TickerManager tickerManager, Stock s) {
	super(frameComp, locationComp, title, tickerManager);

	this.stocks = stocks;


	// Brokers

	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);

	// Sectors
	sectorList = new JComboBox(sectors);
	sectorList.setActionCommand(SECTOR_CHANGED);
	sectorList.addActionListener(this);

	// Stocks
	stocksList = new JComboBox();
	updateStockList((String) sectorList.getSelectedItem());
	stocksList.setActionCommand(STOCK_SELECTED);
	stocksList.addActionListener(this);

	amountField.addKeyListener(this);
	costField.addKeyListener(this);
	dividendTaxField.addKeyListener(this);
	
	totalCostField.setEditable(false);
	totalCostField.setText("0.00");		
	
	netCostField.setEditable(false);
	netCostField.setText("0.00");	

	sectorFieldLabel = new JLabel("Toimiala: ");
	sectorFieldLabel.setLabelFor(sectorList);

	stockFieldLabel = new JLabel("Arvopaperi: ");
	stockFieldLabel.setLabelFor(stocksList);

	dateFieldLabel = new JLabel("Maksupäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);

	amountFieldLabel = new JLabel("Määrä: ");
	amountFieldLabel.setLabelFor(amountField);

	costFieldLabel = new JLabel("Osinko/osake: ");
	costFieldLabel.setLabelFor(costField);

	brokerFieldLabel = new JLabel("Välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);

	dividendTaxLabel = new JLabel("Ennakonpidätys: ");
	dividendTaxLabel.setLabelFor(dividendTaxField);
	dividendTaxField.setText("0.00");		
	
	totalCostFieldLabel = new JLabel("Yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);
	
	netCostFieldLabel = new JLabel("Netto: ");
	netCostFieldLabel.setLabelFor(totalCostField);
	
	setSelection(s);
	String stockName = (String) stocksList.getSelectedItem();
	updateRateFieldForce(stockName);
	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:77,代码来源:DividendDialog.java

示例10: SubscriptionDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public SubscriptionDialog(Component frameComp, Component locationComp, String title,
		Object[] brokers, Object[] sectors, Map<String, List<String>> stocks, I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	this.stocks = stocks;

	// Brokers

	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);

	// Sectors
	sectorList = new JComboBox(sectors);
	sectorList.setActionCommand(SECTOR_CHANGED);
	sectorList.addActionListener(this);

	// Stocks
	stocksList = new JComboBox();
	updateStockList((String) sectorList.getSelectedItem());
	stocksList.setActionCommand(STOCK_SELECTED);
	stocksList.addActionListener(this);
	
	amountField.addKeyListener(this);
	costField.addKeyListener(this);
	
	taxPurchaseDateChooser = new JDateChooser(Calendar.getInstance().getTime());
	taxPurchaseDateChooser.setLocale(new Locale("fi", "FI"));

	totalCostField.setEditable(false);
	totalCostField.setText("0.00");

	sectorFieldLabel = new JLabel("Toimiala: ");
	sectorFieldLabel.setLabelFor(sectorList);

	stockFieldLabel = new JLabel("Arvopaperi: ");
	stockFieldLabel.setLabelFor(stocksList);

	dateFieldLabel = new JLabel("Merkintäpäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);

	taxDateFieldLabel= new JLabel("Hankintapäivä verotuksessa: ");
	taxDateFieldLabel.setLabelFor(taxPurchaseDateChooser);
	
	amountFieldLabel = new JLabel("Määrä: ");
	amountFieldLabel.setLabelFor(amountField);

	costFieldLabel = new JLabel("Merkintähinta: ");
	costFieldLabel.setLabelFor(costField);

	brokerFieldLabel = new JLabel("Välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);

	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:67,代码来源:SubscriptionDialog.java

示例11: SellDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public SellDialog(Component frameComp, Component locationComp, String title,
		Map<String, Collection<BookEntry>> bookEntries, I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	this.bookEntries = bookEntries;
	
	
	// Brokers
	List<String> brokers = new ArrayList<String>();
	Iterator<String > iter = bookEntries.keySet().iterator();
	while (iter.hasNext()) {
		String b = iter.next();
		if (bookEntries.get(b).size() > 0) {
			brokers.add(b);
		}
	}
	
	
	brokerList = new JComboBox(brokers.toArray());
	brokerList.setActionCommand(BROKER_CHANGED);
	brokerList.addActionListener(this);
	//brokerList.setMinimumSize(new Dimension(200,20));
	// Stocks
	stocksList = new JComboBox();
	updateStockList((String) brokerList.getSelectedItem());
	stocksList.setActionCommand(STOCK_SELECTED);
	stocksList.addActionListener(this);
	
	amountField.addKeyListener(this);
	costField.addKeyListener(this);
	brokerCostField.addKeyListener(this);
	
	
	
	totalCostField.setEditable(false);
	totalCostField.setText("0.00");

	ownedAmountField.setEditable(false);
	
	brokerFieldLabel = new JLabel("Välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);
	
	stockFieldLabel = new JLabel("Arvopaperi: ");
	stockFieldLabel.setLabelFor(stocksList);

	dateFieldLabel = new JLabel("Myyntipäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);
	
	ownedAmountFieldLabel = new JLabel("Myytävissä: ");
	ownedAmountFieldLabel.setLabelFor(ownedAmountField);

	
	amountFieldLabel = new JLabel("Määrä: ");
	amountFieldLabel.setLabelFor(amountField);

	costFieldLabel = new JLabel("Myyntihinta: ");
	costFieldLabel.setLabelFor(costField);

	brokerCostFieldLabel = new JLabel("Kulut: ");
	brokerCostFieldLabel.setLabelFor(brokerCostField);

	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	updateOwnedAmount();
	
	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:78,代码来源:SellDialog.java

示例12: TransactionPane

import javax.swing.JComboBox; //导入方法依赖的package包/类
public TransactionPane(Portfolio portfolio) {
	super(new BorderLayout());

	this.portfolio = portfolio;

	// Stocks
	names = portfolio.getTransactionTickers("kaikki","kaikki"); 
	
	transactionStocksList = new JComboBox(names);
	transactionStocksList.setActionCommand("name");
	
	
	// years
	String[] years = portfolio.getTransactionYears(null);
	JComboBox yearList = new JComboBox(years);
	yearList.setActionCommand("year");


	// Brokers
	Object[] brokerNames = portfolio.getBrokers();
	brokerList = new BrokerList(brokerNames, this);
	
	// Transaction types
	JComboBox transactionNameList = new JComboBox(transactionNames);
	transactionNameList.setActionCommand("transaction");
	transactionNameList.setSelectedIndex(0);
	selectedTransaction = transactionNames[0];
	

	
	// Lay out

	FlowLayout flowLayout = new FlowLayout();

	top = new JPanel(flowLayout);
	top.add(new JLabel("Vuosi: "));
	top.add(yearList);

	top.add(new JLabel("AO-tili: "));
	top.add(brokerList.getBrokerList());

	top.add(new JLabel("Tapahtuma: "));
	top.add(transactionNameList);
	
	top.add(new JLabel("Nimi: "));
	top.add(transactionStocksList);
	
	add(top, BorderLayout.PAGE_START);

	// Create the scroll pane and add the table to it.
	scrollPane = new JScrollPane(table);

	// Add the scroll pane to this panel.
	add(scrollPane);

	
	
	if (years.length > 0) {

		selectedYear = years[years.length - 1];
		yearList.setSelectedIndex(years.length - 1);
		
		update();
	}
	yearList.addActionListener(this);
	transactionNameList.addActionListener(this);
	transactionStocksList.addActionListener(this);
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:69,代码来源:TransactionPane.java

示例13: SubscribeOldOwnershipDialog

import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public SubscribeOldOwnershipDialog(Component frameComp,
		Component locationComp, String title,Object[] brokers,
		Map<String, Collection<BookEntry>> bookEntries, I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	this.bookEntries = bookEntries;

	

	brokerList = new JComboBox(brokers);
	brokerList.setActionCommand(BROKER_CHANGED);
	brokerList.addActionListener(this);

	// Stocks
	stocksList = new JComboBox();
	updateStockList((String) brokerList.getSelectedItem());
	stocksList.setActionCommand(STOCK_SELECTED);
	stocksList.addActionListener(this);

	
	amountField.addKeyListener(this);
	costField.addKeyListener(this);

	totalCostField.setEditable(false);
	totalCostField.setText("0.00");

	ownedAmountField.setEditable(false);

	stockFieldLabel = new JLabel("Arvopaperi: ");
	stockFieldLabel.setLabelFor(stocksList);

	dateFieldLabel = new JLabel("Merkintäpäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);

	amountFieldLabel = new JLabel("Merkitty lukumäärä: ");
	amountFieldLabel.setLabelFor(amountField);

	costFieldLabel = new JLabel("Merkintähinta/kpl: ");
	costFieldLabel.setLabelFor(costField);

	brokerFieldLabel = new JLabel("Välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);

	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	ownedAmountFieldLabel = new JLabel("Vanhoja osakkeita: ");
	ownedAmountFieldLabel.setLabelFor(ownedAmountField);

	ratioFieldLabel = new JLabel("Merkintäsuhde (uudet/vanhat): ");
	ratioFieldLabel.setLabelFor(ratioField);

	
	
	updateOwnedAmount();

	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:68,代码来源:SubscribeOldOwnershipDialog.java


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