Skip to content

Commit

Permalink
Updated the code
Browse files Browse the repository at this point in the history
  • Loading branch information
RaderRMT committed Sep 21, 2020
1 parent 790b1bc commit d796535
Show file tree
Hide file tree
Showing 26 changed files with 1,691 additions and 673 deletions.
119 changes: 0 additions & 119 deletions fr/rader/rtt/Interface.form

This file was deleted.

79 changes: 0 additions & 79 deletions fr/rader/rtt/Interface.java

This file was deleted.

55 changes: 43 additions & 12 deletions fr/rader/rtt/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package fr.rader.rtt;

import fr.rader.rtt.listeners.MenuItemListener;
import fr.rader.rtt.gui.main.MainInterface;
import fr.rader.rtt.gui.main.listeners.OpenReplayListener;
import fr.rader.rtt.gui.main.listeners.SaveReplayListener;

import javax.swing.*;
import java.io.File;
Expand All @@ -14,48 +16,77 @@ public class Main {

public JCheckBoxMenuItem saveToDefaultFolder;

public void start() {
MenuItemListener menuItemListener = new MenuItemListener();
private void start() {
// Check if every folders exists
File toCheck = new File(OpenReplayListener.REPLAY_RECORDINGS);
if(!toCheck.exists()) {
JOptionPane.showMessageDialog(null, "The replay_recordings folder does not exist.\nThe ReplayMod has never been installed/run before and the app will not start.");
return;
}

toCheck = new File(OpenReplayListener.LEFT_SIDE);
if(!toCheck.exists()) toCheck.mkdirs();

toCheck = new File(OpenReplayListener.RIGHT_SIDE);
if(!toCheck.exists()) toCheck.mkdirs();

createInterface();
}

public void createInterface() {
JFrame frame = new JFrame("Replay Timeline Transfer");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800, 600);

JMenuBar menuBar = new JMenuBar();

JMenu fileMenu = new JMenu("File");

JMenu helpMenu = new JMenu("Help");

// File
SaveReplayListener saveReplayListener = new SaveReplayListener();
JMenuItem saveLeftAs = new JMenuItem("Save Left As...");
JMenuItem saveRightAs = new JMenuItem("Save Right As...");
saveLeftAs.addActionListener(saveReplayListener);
saveRightAs.addActionListener(saveReplayListener);
JMenuItem saveBoth = new JMenuItem("Save Both");
saveBoth.addActionListener(menuItemListener);

saveBoth.addActionListener(saveReplayListener);
JMenuItem saveLeft = new JMenuItem("Save Left");
saveLeft.addActionListener(menuItemListener);

saveLeft.addActionListener(saveReplayListener);
JMenuItem saveRight = new JMenuItem("Save Right");
saveRight.addActionListener(menuItemListener);

saveRight.addActionListener(saveReplayListener);
saveToDefaultFolder = new JCheckBoxMenuItem("Save timelines to default folder");
saveToDefaultFolder.setState(true);

// Help
JMenuItem aboutItem = new JMenuItem("About");
// todo: add event to show a popup writing about this program

fileMenu.add(saveLeftAs);
fileMenu.add(saveRightAs);
fileMenu.add(new JSeparator());
fileMenu.add(saveBoth);
fileMenu.add(saveLeft);
fileMenu.add(saveRight);
fileMenu.add(new JSeparator());
fileMenu.add(saveToDefaultFolder);

helpMenu.add(aboutItem);

menuBar.add(fileMenu);
menuBar.add(helpMenu);

frame.setJMenuBar(menuBar);

frame.setContentPane(new Interface().panel1);
frame.setContentPane(new MainInterface().mainPanel);
frame.setVisible(true);
}

public static void main(String[] args) {
new Main();
}

public Main() {
private Main() {
instance = this;

// Set OS look and feel
Expand Down
Loading

0 comments on commit d796535

Please sign in to comment.