paquete com.txz1;
importar java.awt.Color;
importar javax.swing.ImageIcon
importar javax. swing.JFrame;
importar javax.swing.JLabel;
importar javax.swing.JPanel;
clase pública Txz {
public static void main(String[] args) {
JFrame frame = new JFrame("1.0"); //
frame.setBounds(100, 20, 20 * 48 16 , 14 * 48 38); //?λ?úС
JPanel panel = new JPanel(); //嬣
panel.setBackground(Color.red);
frame.setContentPane(panel);
panel.setLayout(null); //第?λ
//
ImageIcon boxImg = new ImageIcon("box2.PNG");
JLabel box = new JLabel(boxImg);
panel.add(box);
box.setBounds(5 * 48, 3 * 48, 48, 48);
//
ImageIcon trabajadorImg = new ImageIcon("workerDown2.png");
trabajador JLabel = new JLabel(workerImg);
panel.add(trabajador);
trabajador.setBounds(8 * 48, 8 * 48, 48, 48);
//
ImageIcon goalImg = new ImageIcon("goal2.png");
JLabel objetivo = new JLabel(goalImg); p> p>
panel.add(objetivo);
objetivo.setBounds(7 * 48, 6 * 48, 48, 48);
///?Χ? p>
ImageIcon wallImg = new ImageIcon("wall2.PNG");
JLabel[] paredes = new JLabel[100]
for (int i = 0; i lt; paredes.longitud; i ) {
paredes[i] = new JLabel(wallImg); // ?Χ?
para (int i =
0; i lt; 20; i ) {
panel.add(paredes[índice]);
paredes[índice].setBounds(i * 48, 0, 48, 48 );
índice ;
panel.add(paredes[índice]);
paredes[índice].setBounds(i * 48, 13 * 48, 48, 48);
índice ;
}
para (int i = 0; i lt; 12; i) {
panel.add(paredes[índice]);
paredes[índice].setBounds(0, (i 1) * 48, 48, 48);
índice; p> p>
panel.add(paredes[índice]);
paredes[índice].setBounds(19 * 48, (i 1) * 48, 48, 48); >
índice;
}
for (int i = 0, j = 0; i lt; 5; i, j = 2) {
panel .add(paredes[índice]);
paredes[índice].setBounds((i 2) * 48, j * 48, 48, 48
índice ;
p>}
for (int i = 0, j = 10; i lt; 5; i, j--) {
panel.add (paredes[índice ]);
paredes[índice].setBounds((i 12) * 48, j * 48, 48, 48
índice ;
}
///?
frame.setVisible(verdadero
}
}
;