From 74dd97fc449f432f06f7bbb16b79d31bb8dce9da Mon Sep 17 00:00:00 2001 From: Eideen Date: Tue, 16 Feb 2021 17:12:02 +0100 Subject: [PATCH] Add a Help window --- src/lsystem/screen/MainFrame.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/lsystem/screen/MainFrame.java b/src/lsystem/screen/MainFrame.java index 09c8577..daa18b3 100644 --- a/src/lsystem/screen/MainFrame.java +++ b/src/lsystem/screen/MainFrame.java @@ -32,7 +32,7 @@ public class MainFrame extends JFrame { basePanel = new JPanel(); basePanel.setLayout(new FlowLayout(FlowLayout.CENTER)); tabs = new JTabbedPane(SwingConstants.TOP); - + JToolBar toolBar = new JToolBar(); newGen = new JButton("Nouvelle génération"); newGen.addActionListener(new NewGenListener(this)); @@ -40,8 +40,8 @@ public class MainFrame extends JFrame { help = new JButton("Aide"); help.addActionListener(new HelpListener(this)); toolBar.add(help); - - this.setTitle("L-system interface"); + + this.setTitle("L-system interface"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(Constants.WIDTH, Constants.HEIGHT); this.setLocationRelativeTo(null); @@ -57,7 +57,18 @@ public class MainFrame extends JFrame { } public void newHelp() { - new Help(tabs); + JFrame aide = new JFrame(); + aide.setTitle("Aide"); + aide.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + aide.setSize(700,800); + aide.setLocationRelativeTo(null); + aide.setVisible(true); + + JTextArea helpText = new JTextArea(); + helpText.setText(Constants.HELP); + helpText.setEditable(false); + + aide.add(helpText); } public void newTab() { if(nbTabs>2) @@ -80,7 +91,7 @@ public class MainFrame extends JFrame { list.setText("Règles : \n"); default: throw new IllegalArgumentException("Wrong argument given to method changeList"); - } + } }else{ list.append(stringToAdd); } @@ -111,4 +122,3 @@ public class MainFrame extends JFrame { } } -