本文整理匯總了Java中java.awt.Choice.getItemCount方法的典型用法代碼示例。如果您正苦於以下問題:Java Choice.getItemCount方法的具體用法?Java Choice.getItemCount怎麽用?Java Choice.getItemCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Choice
的用法示例。
在下文中一共展示了Choice.getItemCount方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GtkChoicePeer
import java.awt.Choice; //導入方法依賴的package包/類
public GtkChoicePeer (Choice c)
{
super (c);
int count = c.getItemCount ();
if (count > 0)
{
for (int i = 0; i < count; i++)
add(c.getItem(i), i);
selected = c.getSelectedIndex();
if (selected >= 0)
select( selected );
}
else
selected = -1;
}
示例2: setup
import java.awt.Choice; //導入方法依賴的package包/類
protected void setup()
{
super.setup();
Choice c = (Choice) owner;
int n = c.getItemCount();
for ( int i = 0; i < n ; i++ )
add( c.getItem( i ), i );
select( c.getSelectedIndex() );
}
示例3: setup
import java.awt.Choice; //導入方法依賴的package包/類
protected void setup()
{
super.setup();
Choice c = (Choice) owner;
int n = c.getItemCount();
for ( int i = 0; i < n ; i++ )
add( c.getItem( i ), i );
select( c.getSelectedIndex() );
}
示例4: updateComboBox
import java.awt.Choice; //導入方法依賴的package包/類
private void updateComboBox(Choice certificateComboBox){
certificateComboBox.removeAll();
certificateComboBox.addItem("Loading Certificates...");
certificateComboBox.select(0);
ArrayList<CertificateData> certList = new ArrayList<CertificateData>();
try {
certList = signEngine.loadSmartCardCertificateList(readAllCertificates).certificateList;
} catch (Exception e) {
e.printStackTrace();
SignUtils.playBeeps(1);
JOptionPane.showMessageDialog(null, "ERROR LOADING CERTIFICATES:\n"+e.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
}
certificateComboBox.removeAll();
certificateComboBox.addItem("--Select Certificate--");
for(int i=0;i<certList.size();i++)
certificateComboBox.addItem(certList.get(i).id);
if(certificateComboBox.getItemCount()==1){
certificateComboBox.removeAll();
certificateComboBox.addItem("--No Certificates Available!--");
SignUtils.playBeeps(2);
}
else{
if(certificateComboBox.getItemCount()==2){
certificateComboBox.remove(0);
}
SignUtils.playBeeps(1);
}
}