Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
btevfik committed Dec 11, 2012
2 parents ef8d2ad + ca68946 commit ea34212
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 8 deletions.
8 changes: 5 additions & 3 deletions GUI/src/main/java/com/ece/superkids/ui/SuperKids.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.ece.superkids.ui;

import com.ece.superkids.ui.frames.MainFrame;
import java.awt.Image;
import java.awt.Toolkit;
import com.ece.superkids.ui.frames.MainFrame;

/**
* <code>SuperKids</code> main class where the program starts
* @author baris
* This class <code>SuperKids</code>
* starts the game/application
*
* @author david
*/
public class SuperKids {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* This GUI class <code>ImageLabel</code>
* extends JLabel so that images get resized and center in the JLabel
*
* @author david
* @author david cheung
*/
public class ImageLabel extends JLabel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public ButtonAction(JTextField field) {

}

@Override
public void actionPerformed(ActionEvent e) {
JButton source = (JButton) e.getSource();
field.setText(source.getName());
Expand All @@ -278,11 +279,13 @@ public void actionPerformed(ActionEvent e) {

class ButtonFocus implements FocusListener {

@Override
public void focusGained(FocusEvent e) {
JButton source = (JButton) e.getSource();
source.setBackground(Color.RED);
}

@Override
public void focusLost(FocusEvent e) {
JButton source = (JButton) e.getSource();
source.setBackground(Color.white);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package com.ece.superkids.ui.user.panels;

import com.ece.superkids.questions.enums.QuestionLevel;
import com.ece.superkids.ui.controllers.MusicController;
import com.ece.superkids.ui.controllers.PanelController;
import com.ece.superkids.ui.events.Session;
import com.ece.superkids.users.entities.User;
Expand Down Expand Up @@ -40,6 +41,9 @@ public NewGamePanel(String newOrContinue){
initComponents();
initLevelButtons();
jLabel1.setText(newOrContinue);
if (SoundPanel.getInstance().isMusicON()){
MusicController.getInstance().playMusic();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.ece.superkids.questions.enums.QuestionLevel;
import com.ece.superkids.ui.controllers.GameController;
import com.ece.superkids.ui.controllers.MusicController;
import com.ece.superkids.ui.controllers.PanelController;
import com.ece.superkids.ui.controllers.TTSController;
import com.ece.superkids.ui.events.Session;
Expand All @@ -23,6 +24,8 @@ public class SubjectSelectionPanel extends javax.swing.JPanel {
private Session session;
private boolean tutorial_flag = false;
private GameController gController;

String OS = System.getProperty("os.name").toLowerCase();


/**
Expand All @@ -48,6 +51,7 @@ public SubjectSelectionPanel(QuestionLevel level, boolean tutorial) {
subject2.setText(level.getCategories().get(1).toString());
subject3.setText(level.getCategories().get(2).toString());
//jLayeredPane1.setName("Tutorial Mode");
MusicController.getInstance().stopMusic();
}

/**
Expand Down Expand Up @@ -141,8 +145,31 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

private void subject1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subject1ActionPerformed
// TODO add your handling code here:
System.out.println(getClass().getClassLoader().getResource("videos/shapes.mp4"));
if (tutorial_flag) {

if (OS.indexOf("win")>=0) {
try {
if (level == QuestionLevel.LEVEL_1){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/shapes.mp4"));
}
else if (level == QuestionLevel.LEVEL_2){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/food.mp4"));
}
else if (level == QuestionLevel.LEVEL_3){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/stationary.mp4"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
else if (OS.indexOf("mac")>=0){
try {
Runtime.getRuntime().exec("open -a \"QuickTime Player\"" + getClass().getClassLoader().getResource("videos/shapes.mp4"));
} catch (Exception e) {
e.printStackTrace();
}
}

} else {
gController.newSubject(level, 0);
}
Expand All @@ -151,16 +178,59 @@ private void subject1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
private void subject2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subject2ActionPerformed
// TODO add your handling code here:
if (tutorial_flag) {

} else {
if (OS.indexOf("win")>=0) {
try {
if (level == QuestionLevel.LEVEL_1){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/animals.mp4"));
}
else if (level == QuestionLevel.LEVEL_2){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/planets.mp4"));
}
else if (level == QuestionLevel.LEVEL_3){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/bodyparts.mp4"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
else if (OS.indexOf("mac")>=0){
try {
Runtime.getRuntime().exec("open -a \"QuickTime Player\"" + getClass().getClassLoader().getResource("videos/animals.mp4"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
else {
gController.newSubject(level, 1);
}
}//GEN-LAST:event_subject2ActionPerformed

private void subject3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subject3ActionPerformed
// TODO add your handling code here:
if (tutorial_flag) {

if (OS.indexOf("win")>=0) {
try {
if (level == QuestionLevel.LEVEL_1){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/colors.mp4"));
}
else if (level == QuestionLevel.LEVEL_2){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/geography.mp4"));
}
else if (level == QuestionLevel.LEVEL_3){
Runtime.getRuntime().exec("C:/Program Files/Windows Media Player/wmplayer.exe /fullscreen /play /close " + getClass().getClassLoader().getResource("videos/instruments.mp4"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
else if (OS.indexOf("mac")>=0){
try {
Runtime.getRuntime().exec("open -a \"QuickTime Player\"" + getClass().getClassLoader().getResource("videos/colors.mp4"));
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
gController.newSubject(level, 2);
}
Expand Down
Binary file added GUI/src/main/resources/videos/bodyparts.mp4
Binary file not shown.
Binary file added GUI/src/main/resources/videos/food.mp4
Binary file not shown.
Binary file added GUI/src/main/resources/videos/geography.mp4
Binary file not shown.
Binary file added GUI/src/main/resources/videos/instruments.mp4
Binary file not shown.
Binary file added GUI/src/main/resources/videos/planets.mp4
Binary file not shown.
Binary file added GUI/src/main/resources/videos/stationary.mp4
Binary file not shown.

0 comments on commit ea34212

Please sign in to comment.