(編輯)此問題已解決 - 請參閱答案。Java Swing ghost/doubled組件?
我遇到了Java/Swing和Netbeans之前從未見過的不幸問題。我在Netbeans中設計了一個基本的紙牌遊戲形式,看起來工作得很好。圖片如下: http://i.imgur.com/Zvt2TYL.png
注意左下方的導航器視圖,清楚地列出了底部面板中的所有組件。
當我實際運行的遊戲,它似乎一見鍾情精... http://i.imgur.com/hhJfl8v.png
...但是當你最大化窗口,你突然看到的面板內容的副本,沒有明顯的理由。 http://i.imgur.com/vPJgpUv.png
這種重疊不僅混亂,這也導致按鈕事件指向錯件,使遊戲完全無法播放。默認情況下會顯示正確的聊天文本區域,但是當您單擊它進行對焦時,它會突然將空白文本區域置於前面,從而有效地隱藏聊天文本區域。
此問題也會影響頂部面板,並且假定沒有文本的虛擬重複項(右側顯示)。
無論是什麼原因造成這種情況,以及如何解決?我無法在導航器中找到面板的重複內容,清理和構建不起作用,甚至自動生成的代碼也不會顯示向窗口添加兩個文本區域的提示。
非常感謝幫助!
(編輯)下面是相關的自動生成的initComponents代碼。我從來沒有觸及過這個代碼,因爲它是由Netbeans自動生成的。
// Variables declaration - do not modify
private javax.swing.JLabel bC1;
private javax.swing.JLabel bC2;
private javax.swing.JLabel bC3;
private javax.swing.JLabel bC4;
private javax.swing.JLabel bC5;
private javax.swing.JLabel bC6;
private javax.swing.JLabel bC7;
private javax.swing.JSpinner betSpinner;
private javax.swing.JButton btnBet;
private javax.swing.JButton btnPass;
private javax.swing.JPanel gamePanel;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JLabel lC1;
private javax.swing.JLabel lC2;
private javax.swing.JLabel lC3;
private javax.swing.JLabel lC4;
private javax.swing.JLabel lC5;
private javax.swing.JLabel lC6;
private javax.swing.JLabel lC7;
private javax.swing.JPanel playingField;
private javax.swing.JPanel plrBottom;
private javax.swing.JPanel plrLeft;
private javax.swing.JPanel plrRight;
private javax.swing.JPanel plrTop;
private javax.swing.JLabel rC1;
private javax.swing.JLabel rC2;
private javax.swing.JLabel rC3;
private javax.swing.JLabel rC4;
private javax.swing.JLabel rC5;
private javax.swing.JLabel rC6;
private javax.swing.JLabel rC7;
private javax.swing.JPanel statusPanel;
private javax.swing.JLabel tC1;
private javax.swing.JLabel tC2;
private javax.swing.JLabel tC3;
private javax.swing.JLabel tC4;
private javax.swing.JLabel tC5;
private javax.swing.JLabel tC6;
private javax.swing.JLabel tC7;
private javax.swing.JTextArea textAreaChat;
// End of variables declaration
private void initComponents() {
statusPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
textAreaChat = new javax.swing.JTextArea();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
betSpinner = new javax.swing.JSpinner();
btnBet = new javax.swing.JButton();
btnPass = new javax.swing.JButton();
gamePanel = new javax.swing.JPanel();
plrRight = new javax.swing.JPanel();
rC1 = new javax.swing.JLabel();
rC2 = new javax.swing.JLabel();
rC3 = new javax.swing.JLabel();
rC4 = new javax.swing.JLabel();
rC5 = new javax.swing.JLabel();
rC6 = new javax.swing.JLabel();
rC7 = new javax.swing.JLabel();
plrBottom = new javax.swing.JPanel();
bC1 = new javax.swing.JLabel();
bC2 = new javax.swing.JLabel();
bC3 = new javax.swing.JLabel();
bC4 = new javax.swing.JLabel();
bC5 = new javax.swing.JLabel();
bC6 = new javax.swing.JLabel();
bC7 = new javax.swing.JLabel();
plrLeft = new javax.swing.JPanel();
lC1 = new javax.swing.JLabel();
lC2 = new javax.swing.JLabel();
lC3 = new javax.swing.JLabel();
lC4 = new javax.swing.JLabel();
lC5 = new javax.swing.JLabel();
lC6 = new javax.swing.JLabel();
lC7 = new javax.swing.JLabel();
plrTop = new javax.swing.JPanel();
tC1 = new javax.swing.JLabel();
tC2 = new javax.swing.JLabel();
tC3 = new javax.swing.JLabel();
tC4 = new javax.swing.JLabel();
tC5 = new javax.swing.JLabel();
tC6 = new javax.swing.JLabel();
tC7 = new javax.swing.JLabel();
playingField = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
statusPanel.setPreferredSize(new java.awt.Dimension(0, 180));
textAreaChat.setEditable(false);
textAreaChat.setColumns(20);
textAreaChat.setRows(5);
jScrollPane1.setViewportView(textAreaChat);
jButton1.setText("Send");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel1.setText("Betting");
btnBet.setText("Bet");
btnBet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBetActionPerformed(evt);
}
});
btnPass.setText("Pass");
btnPass.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPassActionPerformed(evt);
}
});
javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
statusPanel.setLayout(statusPanelLayout);
statusPanelLayout.setHorizontalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 308, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(statusPanelLayout.createSequentialGroup()
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnBet, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(betSpinner, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnPass, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())))))
);
statusPanelLayout.setVerticalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(betSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnBet)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnPass))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addGap(27, 27, 27))
);
getContentPane().add(statusPanel, java.awt.BorderLayout.PAGE_END);
gamePanel.setLayout(new java.awt.BorderLayout());
rC1.setText("jLabel1");
rC1.setMaximumSize(new java.awt.Dimension(14, 34));
rC1.setMinimumSize(new java.awt.Dimension(14, 34));
rC1.setPreferredSize(new java.awt.Dimension(14, 34));
rC2.setText("jLabel1");
rC2.setMaximumSize(new java.awt.Dimension(14, 34));
rC2.setMinimumSize(new java.awt.Dimension(14, 34));
rC2.setPreferredSize(new java.awt.Dimension(14, 34));
rC3.setText("jLabel1");
rC3.setMaximumSize(new java.awt.Dimension(14, 34));
rC3.setMinimumSize(new java.awt.Dimension(14, 34));
rC3.setPreferredSize(new java.awt.Dimension(14, 34));
rC4.setText("jLabel1");
rC4.setMaximumSize(new java.awt.Dimension(14, 34));
rC4.setMinimumSize(new java.awt.Dimension(14, 34));
rC4.setPreferredSize(new java.awt.Dimension(14, 34));
rC5.setText("jLabel1");
rC5.setMaximumSize(new java.awt.Dimension(14, 34));
rC5.setMinimumSize(new java.awt.Dimension(14, 34));
rC5.setPreferredSize(new java.awt.Dimension(14, 34));
rC6.setText("jLabel1");
rC6.setMaximumSize(new java.awt.Dimension(14, 34));
rC6.setMinimumSize(new java.awt.Dimension(14, 34));
rC6.setPreferredSize(new java.awt.Dimension(14, 34));
rC7.setText("jLabel1");
rC7.setMaximumSize(new java.awt.Dimension(14, 34));
rC7.setMinimumSize(new java.awt.Dimension(14, 34));
rC7.setPreferredSize(new java.awt.Dimension(14, 34));
javax.swing.GroupLayout plrRightLayout = new javax.swing.GroupLayout(plrRight);
plrRight.setLayout(plrRightLayout);
plrRightLayout.setHorizontalGroup(
plrRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrRightLayout.createSequentialGroup()
.addGroup(plrRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rC1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rC2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rC3, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rC4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rC5, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rC6, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(rC7, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
plrRightLayout.setVerticalGroup(
plrRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrRightLayout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(rC1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rC2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rC3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rC4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rC5, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rC6, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rC7, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
gamePanel.add(plrRight, java.awt.BorderLayout.LINE_END);
bC1.setText("jLabel1");
bC2.setText("jLabel1");
bC3.setText("jLabel1");
bC4.setText("jLabel1");
bC5.setText("jLabel1");
bC6.setText("jLabel1");
bC7.setText("jLabel1");
javax.swing.GroupLayout plrBottomLayout = new javax.swing.GroupLayout(plrBottom);
plrBottom.setLayout(plrBottomLayout);
plrBottomLayout.setHorizontalGroup(
plrBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrBottomLayout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(bC1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bC2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bC3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bC4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bC5, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bC6, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bC7, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
plrBottomLayout.setVerticalGroup(
plrBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bC1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bC2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bC3, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bC4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bC5, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bC6, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bC7, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
);
gamePanel.add(plrBottom, java.awt.BorderLayout.PAGE_END);
lC1.setText("jLabel1");
lC1.setMaximumSize(new java.awt.Dimension(14, 34));
lC1.setMinimumSize(new java.awt.Dimension(14, 34));
lC1.setPreferredSize(new java.awt.Dimension(14, 34));
lC2.setText("jLabel1");
lC2.setMaximumSize(new java.awt.Dimension(14, 34));
lC2.setMinimumSize(new java.awt.Dimension(14, 34));
lC2.setPreferredSize(new java.awt.Dimension(14, 34));
lC3.setText("jLabel1");
lC3.setMaximumSize(new java.awt.Dimension(14, 34));
lC3.setMinimumSize(new java.awt.Dimension(14, 34));
lC3.setPreferredSize(new java.awt.Dimension(14, 34));
lC4.setText("jLabel1");
lC4.setMaximumSize(new java.awt.Dimension(14, 34));
lC4.setMinimumSize(new java.awt.Dimension(14, 34));
lC4.setPreferredSize(new java.awt.Dimension(14, 34));
lC5.setText("jLabel1");
lC5.setMaximumSize(new java.awt.Dimension(14, 34));
lC5.setMinimumSize(new java.awt.Dimension(14, 34));
lC5.setPreferredSize(new java.awt.Dimension(14, 34));
lC6.setText("jLabel1");
lC6.setMaximumSize(new java.awt.Dimension(14, 34));
lC6.setMinimumSize(new java.awt.Dimension(14, 34));
lC6.setPreferredSize(new java.awt.Dimension(14, 34));
lC7.setText("jLabel1");
lC7.setMaximumSize(new java.awt.Dimension(14, 34));
lC7.setMinimumSize(new java.awt.Dimension(14, 34));
lC7.setPreferredSize(new java.awt.Dimension(14, 34));
javax.swing.GroupLayout plrLeftLayout = new javax.swing.GroupLayout(plrLeft);
plrLeft.setLayout(plrLeftLayout);
plrLeftLayout.setHorizontalGroup(
plrLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrLeftLayout.createSequentialGroup()
.addGroup(plrLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lC1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lC2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lC3, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lC4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lC5, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lC6, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lC7, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
plrLeftLayout.setVerticalGroup(
plrLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrLeftLayout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(lC1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lC2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lC3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lC4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lC5, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lC6, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lC7, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
gamePanel.add(plrLeft, java.awt.BorderLayout.LINE_START);
tC1.setText("jLabel1");
tC2.setText("jLabel1");
tC3.setText("jLabel1");
tC4.setText("jLabel1");
tC5.setText("jLabel1");
tC6.setText("jLabel1");
tC7.setText("jLabel1");
javax.swing.GroupLayout plrTopLayout = new javax.swing.GroupLayout(plrTop);
plrTop.setLayout(plrTopLayout);
plrTopLayout.setHorizontalGroup(
plrTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrTopLayout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(tC1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tC2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tC3, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tC4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tC5, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tC6, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tC7, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
plrTopLayout.setVerticalGroup(
plrTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(plrTopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tC1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tC2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tC3, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tC4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tC5, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tC6, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tC7, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
);
gamePanel.add(plrTop, java.awt.BorderLayout.PAGE_START);
javax.swing.GroupLayout playingFieldLayout = new javax.swing.GroupLayout(playingField);
playingField.setLayout(playingFieldLayout);
playingFieldLayout.setHorizontalGroup(
playingFieldLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
playingFieldLayout.setVerticalGroup(
playingFieldLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
gamePanel.add(playingField, java.awt.BorderLayout.CENTER);
getContentPane().add(gamePanel, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>
......代碼?請? –
我很抱歉排除它,現在將其編輯到主要帖子中。 – lvk
.. [MCVE](http://stackoverflow.com/help/mcve)? –