问题描述
私有无效 jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
DeckOfCards cards = new DeckOfCards();
cards.printCards();
}
public static void main(String args[]) {
java.awt.EventQueue.invokelater(new Runnable() {
public void run() {
new RandomWord().setVisible(true);
}
});
}
公共类 DeckOfCards { 私人名单名单; // 声明将存储句子的列表
// set up word of sentences and shuffle
public DeckOfCards() {
Card[] deck = new Card[12];
int count = 0; // number of sentences
// populate name with suit objects
for (Card.Suit suit : Card.Suit.values()) {
for (Card.Face face : Card.Face.values()) {
deck[count] = new Card(face,suit);
++count;
}
}
list = Arrays.asList(deck); // get List
Collections.shuffle(list); // shuffle deck
}
// output centences
private void printCards() {
// display 12 sentences in two columns
for (int i = 0; i < list.size(); i++) {
System.out.printf("%-30s%s",list.get(i),((i + 1) % 4 == 0) ? System.lineseparator() : "");
}
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods,choose Tools | Templates.
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)