|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2006-6-29 10:36
|
显示全部楼层
Vielen dank für alle und eure Beiträge,ich habe davon sehr viel gelernt,besonders von greenflute.
Ich bin an der Uni,kann nur Deutsch schreiben.
Insofern bin ich so weit und habe das Programm geschrieben. Die weitere Aufgabe kommt am Freitag wieder.Ich werd dem verfolgen.
mein Programm lautet:
import java.awt.*;
public class Sudoku extends Frame
{
Button [][]feld = new Button[9][9];
Panel[] kleinePanel = new Panel[9];
int hori, vert,horiinPanel,vertinPanel;
int getButtonZahl;
public static void main (String[] args)
{
new Sudoku ();
}
public Sudoku()
{
setLayout(new GridLayout(3,3,3,3));
for (int p = 0; p < 9; p++) {
kleinePanel[p] = new Panel(new GridLayout(3,3,1,1));
add(kleinePanel[p]);
}
//set all the Buttons in 9 Panels
for (int y = 0; y < 9; y++) {
vert = (y / 3);
vertinPanel = (y % 3);
for (int x = 0; x < 9; x++) {
hori = (x / 3);
vertinPanel = (x % 3);
getButtonZahl++;
feld[y][x] = new Button();
kleinePanel[(vert * 3) + hori].add(feld[y][x]);
}
}
//setColor
Color HELLBLAU = new Color(127,127,255);
Color HELLGELB = new Color(255,255,127);
setBackground(HELLGELB);
for (int c = 0; c < 8; c++) {
if ((c % 2) == 0)
kleinePanel[c + 1].setBackground(HELLBLAU);
else
kleinePanel[c].setBackground(HELLBLAU);
}
//setFont
Font f = new Font("SansSerif", Font.PLAIN, 30);
setFont(f);
setSize(458,458);
show();
}
} |
|