- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
public Miner(String s) {
super(s);
MenuBar mb = new MenuBar();
setMenuBar(mb);
Menu mFile = new Menu("Файл");
Menu mHelp = new Menu("Справка");
mb.add(mFile);
mb.setHelpMenu(mHelp);
MenuItem create = new MenuItem("Новая игра",new MenuShortcut(KeyEvent.VK_N));
Menu mColor = new Menu("Цвет");
MenuItem mGreen = new MenuItem("Зелёный");
MenuItem mRed = new MenuItem("Красный");
MenuItem mBlue = new MenuItem("Синий");
MenuItem mGray = new MenuItem("Серый");
mColor.add(mGreen);
mColor.add(mRed);
mColor.add(mBlue);
mColor.addSeparator();
mColor.add(mGray);
Menu mHard = new Menu("Сложность");
MenuItem mDummy = new MenuItem("Новичок");
MenuItem mUser = new MenuItem("Среднячок");
MenuItem mHaker = new MenuItem("Проффи");
mHard.add(mDummy);
mHard.add(mUser);
mHard.add(mHaker);
MenuItem mSound = new MenuItem("Звук");
mSound.setEnabled(false);
MenuItem exit = new MenuItem("Выход",new MenuShortcut(KeyEvent.VK_X));
mFile.add(create);
mFile.add(mColor);
mFile.add(mHard);
mFile.add(mSound);
mFile.addSeparator();
mFile.add(exit);
Scribble scr = new Scribble(this,480,480);
mGreen.addActionListener(scr);
mRed.addActionListener(scr);
mBlue.addActionListener(scr);
mGray.addActionListener(scr);
add(scr);
Difficult diff = new Difficult(this,480,480);
mDummy.addActionListener(diff);
mUser.addActionListener(diff);
mHaker.addActionListener(diff);
add(diff);
create.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
status = 0;
repaint();
RandomArray();
}
});
exit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.exit(0);
}
});
MenuItem mInfo = new MenuItem("О программе",new MenuShortcut(KeyEvent.VK_H));
mHelp.add(mInfo);
mInfo.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
new AboutProgram("О программе");
}
});
setBounds(0,0,480,480); // setSize(480,480);
setVisible(true);
setLayout(null);
addMouseListener(this);
addWindowListener(new WinClose());
}