Debug help window

This commit is contained in:
Eideen 2021-03-09 17:18:51 +01:00
parent 84f55b6ca4
commit c13aa279af

View File

@ -2,7 +2,7 @@ package lsystem.screen.main;
import lsystem.screen.Constants; import lsystem.screen.Constants;
import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -12,7 +12,7 @@ public class MainFrame extends JFrame {
private static final long serialVersionUID = -7898079642230075807L; private static final long serialVersionUID = -7898079642230075807L;
private int nbTabs; private int nbTabs;
private int nbHelpWindow; boolean helpWindow = false;
private JPanel basePanel; private JPanel basePanel;
private JTabbedPane tabs; private JTabbedPane tabs;
private JButton newGen; private JButton newGen;
@ -46,13 +46,14 @@ public class MainFrame extends JFrame {
} }
public void newHelp() { public void newHelp() {
if(nbHelpWindow>0){ if(helpWindow != false){
JOptionPane.showMessageDialog(null, "Une fenêtre d'aide est déjà ouverte."); JOptionPane.showMessageDialog(null, "Une fenêtre d'aide est déjà ouverte.");
} }
else { else {
nbHelpWindow++; helpWindow = true;
JFrame aide = new JFrame(); JFrame aide = new JFrame();
aide.setTitle("Aide"); aide.setTitle("Aide");
aide.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); aide.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
aide.setSize(700,500); aide.setSize(700,500);
@ -60,14 +61,20 @@ public class MainFrame extends JFrame {
aide.setVisible(true); aide.setVisible(true);
JTextArea helpText = new JTextArea(); JTextArea helpText = new JTextArea();
helpText.setText(Constants.HELP); helpText.setText(Constants.HELP);
helpText.setEditable(false); helpText.setEditable(false);
JScrollPane scrollbar = new JScrollPane(helpText); JScrollPane scrollbar = new JScrollPane(helpText);
scrollbar.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollbar.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollbar.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollbar.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
aide.add(scrollbar); aide.add(scrollbar);
aide.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
helpWindow = false;
}
});
} }
} }
public void newTab() { public void newTab() {