📄 mainjframe.java
字号:
jLabel17.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseMoved(java.awt.event.MouseEvent evt) {
handCursor(evt);
}
});
jLabel17.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel17MouseClicked(evt);
}
});
jLabel18.setFont(new java.awt.Font("Courier New", 0, 14));
jLabel18.setForeground(new java.awt.Color(0, 102, 153));
jLabel18.setText("<html><a href=\"www.shu.edu.cn\">Shanghai University </a></html>");
jLabel18.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseMoved(java.awt.event.MouseEvent evt) {
handCursor(evt);
}
});
jLabel18.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel18MouseClicked(evt);
}
});
org.jdesktop.layout.GroupLayout aboutDialogLayout = new org.jdesktop.layout.GroupLayout(aboutDialog.getContentPane());
aboutDialog.getContentPane().setLayout(aboutDialogLayout);
aboutDialogLayout.setHorizontalGroup(
aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(aboutDialogLayout.createSequentialGroup()
.addContainerGap()
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, jLabel8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(aboutDialogLayout.createSequentialGroup()
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(aboutDialogLayout.createSequentialGroup()
.add(jLabel9)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel12)
.add(jLabel14, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
.add(aboutDialogLayout.createSequentialGroup()
.add(jLabel10)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(aboutDialogLayout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel13)
.add(21, 21, 21))
.add(jLabel17, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jLabel18, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
.add(jLabel16, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jLabel15, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)))))
.addContainerGap())
);
aboutDialogLayout.setVerticalGroup(
aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(aboutDialogLayout.createSequentialGroup()
.addContainerGap()
.add(jLabel8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel9)
.add(jLabel16))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel14)
.add(jLabel15))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel12)
.add(jLabel17))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel10)
.add(jLabel18))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel13))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("title"));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setLocationByPlatform(true);
jPanel1.setLayout(new java.awt.GridLayout(3, 3, 10, 10));
for(int i=0;i<9;i++){
jb[i]=new JButton();
if(i==8){
jb[i].setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ray/ninegrid/pics/"+0+".png")));
}else{
jb[i].setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ray/ninegrid/pics/"+(i+1)+".png")));
}
jb[i].setToolTipText("");
jb[i].setEnabled(false);
jb[i].setMargin(new java.awt.Insets(0, 0, 0, 0));
final int index=i;
jb[i].addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbActionPerformed(evt,index);
}
});
jPanel1.add(jb[i]);
}
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("game_panel")));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("goal_panel")));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/ray/ninegrid/pics/10.png")));
jLabel1.setLabelFor(jPanel2);
jLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP);
jLabel1.setIconTextGap(0);
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel2Layout.createSequentialGroup()
.add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("statistic_panel")));
jLabel2.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("user"));
userLabel.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("anonymity"));
jLabel4.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("userscore"));
scoreLabel.setText("0");
jLabel6.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("steps"));
stepsLabel.setText("0");
otherStepsLabel.setText("0");
jLabel3.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("time"));
timeLabel.setText("0");
userInfo.setEnabled(false);
userInfo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
userInfoActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(timeLabel))
.add(jPanel3Layout.createSequentialGroup()
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel2)
.add(jLabel4)
.add(jLabel6))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(stepsLabel)
.add(scoreLabel)
.add(userLabel)))))
.add(jPanel3Layout.createSequentialGroup()
.add(userInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 9, Short.MAX_VALUE)
.add(otherStepsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(userLabel))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(scoreLabel))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel6)
.add(stepsLabel))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(userInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(otherStepsLabel))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(timeLabel)
.add(jLabel3))
.addContainerGap(14, Short.MAX_VALUE))
);
gameM.setMnemonic('g');
gameM.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("game"));
gameM.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gameMActionPerformed(evt);
}
});
startItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
startItem.setMnemonic('n');
startItem.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("start_game"));
startItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
startItemActionPerformed(evt);
}
});
gameM.add(startItem);
pauseItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
pauseItem.setMnemonic('p');
pauseItem.setText(java.util.ResourceBundle.getBundle("org/ray/ninegrid/frame").getString("pause"));
pauseItem.setEnabled(false);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -