From a7a7ab042815cfdbd67ea0fa227f4b20767b45c4 Mon Sep 17 00:00:00 2001 From: MrThanasiz <8089997+MrThanasiz@users.noreply.github.com> Date: Thu, 13 Jun 2019 22:16:26 +0300 Subject: [PATCH] Added Back button to InputDataFrame --- src/InputDataFrame.java | 30 +++++++++++++++++++++++++++--- src/UniversitySelectFrame.java | 2 -- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/InputDataFrame.java b/src/InputDataFrame.java index e7ab65f..443de00 100644 --- a/src/InputDataFrame.java +++ b/src/InputDataFrame.java @@ -47,10 +47,11 @@ public class InputDataFrame { private static final int LB_Y=HEIGHT*43/100; - //Next button + //Next/Back button private static final int NB_X=WIDTH*70/100; + private static final int BB_X=WIDTH*20/100; private static final int NB_Y=HEIGHT*80/100; - private static final int NB_WIDTH=WIDTH*13/100; + private static final int NB_WIDTH=WIDTH*18/100; private static final int NB_HEIGHT=HEIGHT*5/100; @@ -192,10 +193,33 @@ else if (i==4) { } }); + + + //Next screen button - JButton buttonNext=new JButton("Select Universities"); + JButton buttonNext=new JButton("Select Universities"); + if (stud.getAcademicYear()!=0) { + + } + + //Back Button (MainFrame) + JButton buttonBack=new JButton("Back to Tips"); + buttonBack.setBounds(BB_X,NB_Y,NB_WIDTH,NB_HEIGHT); + if (stud.getAcademicYear()!=0) { + buttonNext.setText("Save scores & Select Universities"); + f.add(buttonBack); + f.revalidate(); + f.repaint(); + } + buttonBack.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + f.dispose(); + new MainFrame(stud); + } + }); + buttonNext.setBounds(NB_X,NB_Y,NB_WIDTH,NB_HEIGHT); f.add(buttonNext); buttonNext.addActionListener(new ActionListener() { diff --git a/src/UniversitySelectFrame.java b/src/UniversitySelectFrame.java index abc1eeb..a04ef1b 100644 --- a/src/UniversitySelectFrame.java +++ b/src/UniversitySelectFrame.java @@ -124,8 +124,6 @@ public void actionPerformed(ActionEvent e) { stud.setScores(scores); CentralRegistry.serializeUsers(); f.dispose(); - - new MainFrame(stud); } }