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