Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Rankings basics
Browse files Browse the repository at this point in the history
  • Loading branch information
yichunShen committed Jun 11, 2018
1 parent b4851e7 commit 4df4ce0
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 2 deletions.
Binary file added rCollection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed rCollectionButton.png
Binary file not shown.
Binary file added rLevel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed rLevelButton.png
Binary file not shown.
Binary file added rTotalBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rUserBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rWin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed rWinButton.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/game.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public game(){
for(int i =0;i<3;i++){
buttonEffects.add(new JLabel(new ImageIcon("gMouse.png")));
buttonEffects.get(i).setBounds(bInsets.left+i*120,bInsets.top,120,80);
buttonEffects.get(i).setVisible(false);
add(buttonEffects.get(i));
gButtons.get(i).addMouseListener(mouseEffect);
gButtons.get(i).setBounds(bInsets.left+10+i*120,bInsets.top+10,100,60);
add(gButtons.get(i));
buttonEffects.get(i).setVisible(false);
}
timerBoard.setBounds(bInsets.left+550,bInsets.top,200,100);
timerLabel.setBounds(bInsets.left+550,bInsets.top,200,100);
Expand Down
54 changes: 54 additions & 0 deletions src/rankings.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,66 @@
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;

public class rankings extends JPanel {
Insets bInsets = getInsets();

JLabel bgi = new JLabel(new ImageIcon("rankBgi.jpg"));
JLabel backButton = new JLabel(new ImageIcon("theBackButton.png"));
JLabel buttonEffect = new JLabel(new ImageIcon("gMouse.png"));
JLabel collectionButton = new JLabel(new ImageIcon("rCollection.png"));
JLabel levelButton = new JLabel(new ImageIcon("rLevel.png"));
JLabel winButton = new JLabel(new ImageIcon("rWin.png"));
JLabel screen = new JLabel(new ImageIcon("rTotalBack.png"));
JLabel userScreen = new JLabel(new ImageIcon("rUserBack.png"));
ArrayList<JLabel> subTypes = new ArrayList<JLabel>();
MouseListener mouseEffect = new MouseListener(){
public void mouseClicked(MouseEvent e) {
buttonEffect.setVisible(false);
}
public void mouseEntered(MouseEvent e) {
buttonEffect.setVisible(true);
}
public void mouseExited(MouseEvent e) {
buttonEffect.setVisible(false);
}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
};
public rankings(){
setSize(1300,700);
setLayout(null);
backButton.setBounds(bInsets.left+10,bInsets.top+10,100,60);
backButton.addMouseListener(mouseEffect);
add(backButton);
buttonEffect.setBounds(bInsets.left,bInsets.top,120,80);
add(buttonEffect);
buttonEffect.setVisible(false);
subTypes.add(collectionButton);
subTypes.add(levelButton);
subTypes.add(winButton);
for(int i =0;i<3;i++){
subTypes.get(i).setBounds(bInsets.left+10,bInsets.top+110+i*170,120,160);
add(subTypes.get(i));
}//end for
userScreen.setBounds(bInsets.left+185,bInsets.top+80,1050,200);
add(userScreen);
screen.setBounds(bInsets.left+135,bInsets.top+50,1150,600);
add(screen);
bgi.setBounds(bInsets.left,bInsets.top,1300,700);
add(bgi);
setBackground(Color.DARK_GRAY);
setVisible(true);
}
public static void main(String[] args){
JFrame f = new JFrame();
f.add(new rankings());
f.setSize(f.getPreferredSize());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
11 changes: 10 additions & 1 deletion src/system.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public void mouseClicked(MouseEvent event) {
enterGame();
repaint();
}
if(source.equals(baseInter.rankingButton)){
System.out.println(6);
remove(baseInter);
add(rankInter);
repaint();
}
if(source.getIcon().toString().equals("theBackButton.png")){
System.out.println(0);
getContentPane().removeAll();
Expand Down Expand Up @@ -56,10 +62,13 @@ public void mouseReleased(MouseEvent e) {}
};
base baseInter = new base();
game gameInter = new game();
rankings rankInter = new rankings();
public system() {
startGame = new login();
startGame.okButton.addMouseListener(loginOper);
baseInter.gameButton.addMouseListener(directory);//add directory to buttons in base interface
for(int i=0;i<6;i++){
baseInter.mRightButtons.get(i).addMouseListener(directory);//add directory to all buttons in base interface
}//end for
gameInter.backButton.addMouseListener(directory);//add directory to buttons in game interface

addWindowListener(new java.awt.event.WindowAdapter() {//need to save the information before closing
Expand Down

0 comments on commit 4df4ce0

Please sign in to comment.