2、其次登录口袋宠物世界游戏以后,口袋宠物世界小程序香蕉特饮是用固定森含困材料合成。
3、最后寻老拆找固定材料,集齐之后就可以进此念行合成。
我用NetBeans写的,代码可能长了点,关于布局的那部分代码你可以不用看数悄,一贺尘运行自然就可以看到界面了,new出对象之后最重要的是这部分代码:jCheckBoxAllItemStateChanged(java.awt.event.ItemEvent evt) {if(jCheckBoxAll.isSelected()){
this.jCheckBoxApple.setSelected(true)
this.jCheckBoxJuZi.setSelected(true)
this.jCheckBoxBanana.setSelected(true)
this.jCheckBoxPuTao.setSelected(true)
this.jCheckBoxPear.setSelected(true)
}else{
this.jCheckBoxApple.setSelected(false)
this.jCheckBoxJuZi.setSelected(false)
this.jCheckBoxBanana.setSelected(false)
this.jCheckBoxPuTao.setSelected(false)
this.jCheckBoxPear.setSelected(false)
}
}
下边部分是程序全部代码:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Main.java
*
* Created on 2009-6-3, 17:48:53
*/
package com.javaeye.bluenight1.allIn
/**
*
* @author BlueNight
*/
public class Main extends javax.swing.JFrame {
/** Creates new form Main */
public Main() {
initComponents()
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">薯拍渣
private void initComponents() {
jPanel1 = new javax.swing.JPanel()
jCheckBoxApple = new javax.swing.JCheckBox()
jCheckBoxJuZi = new javax.swing.JCheckBox()
jCheckBoxBanana = new javax.swing.JCheckBox()
jCheckBoxPuTao = new javax.swing.JCheckBox()
jCheckBoxPear = new javax.swing.JCheckBox()
jCheckBoxAll = new javax.swing.JCheckBox()
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE)
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "选择你喜欢的水果", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("宋体", 0, 12), new java.awt.Color(0, 0, 204)))// NOI18N
jCheckBoxApple.setText("苹果")
jCheckBoxApple.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCheckBoxAppleItemStateChanged(evt)
}
})
jCheckBoxJuZi.setText("桔子")
jCheckBoxJuZi.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCheckBoxJuZiItemStateChanged(evt)
}
})
jCheckBoxBanana.setText("香蕉")
jCheckBoxBanana.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCheckBoxBananaItemStateChanged(evt)
}
})
jCheckBoxPuTao.setText("葡萄")
jCheckBoxPuTao.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCheckBoxPuTaoItemStateChanged(evt)
}
})
jCheckBoxPear.setText("桃子")
jCheckBoxPear.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCheckBoxPearItemStateChanged(evt)
}
})
jCheckBoxAll.setText("全选")
jCheckBoxAll.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCheckBoxAllItemStateChanged(evt)
}
})
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1)
jPanel1.setLayout(jPanel1Layout)
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBoxApple)
.addComponent(jCheckBoxJuZi)
.addComponent(jCheckBoxBanana)
.addComponent(jCheckBoxPuTao)
.addComponent(jCheckBoxPear)
.addComponent(jCheckBoxAll))
.addContainerGap(72, Short.MAX_VALUE))
)
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jCheckBoxApple)
.addGap(18, 18, 18)
.addComponent(jCheckBoxJuZi)
.addGap(18, 18, 18)
.addComponent(jCheckBoxBanana)
.addGap(18, 18, 18)
.addComponent(jCheckBoxPuTao)
.addGap(18, 18, 18)
.addComponent(jCheckBoxPear)
.addGap(18, 18, 18)
.addComponent(jCheckBoxAll)
.addContainerGap(20, Short.MAX_VALUE))
)
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane())
getContentPane().setLayout(layout)
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
)
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
)
pack()
}// </editor-fold>
private void jCheckBoxAppleItemStateChanged(java.awt.event.ItemEvent evt) {
// TODO add your handling code here:
}
private void jCheckBoxJuZiItemStateChanged(java.awt.event.ItemEvent evt) {
// TODO add your handling code here:
}
private void jCheckBoxBananaItemStateChanged(java.awt.event.ItemEvent evt) {
// TODO add your handling code here:
}
private void jCheckBoxPuTaoItemStateChanged(java.awt.event.ItemEvent evt) {
// TODO add your handling code here:
}
private void jCheckBoxPearItemStateChanged(java.awt.event.ItemEvent evt) {
// TODO add your handling code here:
}
private void jCheckBoxAllItemStateChanged(java.awt.event.ItemEvent evt) {
if(jCheckBoxAll.isSelected()){
this.jCheckBoxApple.setSelected(true)
this.jCheckBoxJuZi.setSelected(true)
this.jCheckBoxBanana.setSelected(true)
this.jCheckBoxPuTao.setSelected(true)
this.jCheckBoxPear.setSelected(true)
}else{
this.jCheckBoxApple.setSelected(false)
this.jCheckBoxJuZi.setSelected(false)
this.jCheckBoxBanana.setSelected(false)
this.jCheckBoxPuTao.setSelected(false)
this.jCheckBoxPear.setSelected(false)
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Main().setVisible(true)
}
})
}
// Variables declaration - do not modify
private javax.swing.JCheckBox jCheckBoxAll
private javax.swing.JCheckBox jCheckBoxApple
private javax.swing.JCheckBox jCheckBoxBanana
private javax.swing.JCheckBox jCheckBoxJuZi
private javax.swing.JCheckBox jCheckBoxPear
private javax.swing.JCheckBox jCheckBoxPuTao
private javax.swing.JPanel jPanel1
// End of variables declaration
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)