Add help scrollbar and window limitation
This commit is contained in:
parent
161f9b64c2
commit
4806109ad6
@ -12,6 +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;
|
||||||
private JPanel basePanel;
|
private JPanel basePanel;
|
||||||
private JTabbedPane tabs;
|
private JTabbedPane tabs;
|
||||||
private JButton newGen;
|
private JButton newGen;
|
||||||
@ -45,10 +46,16 @@ public class MainFrame extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void newHelp() {
|
public void newHelp() {
|
||||||
|
if(nbHelpWindow>0){
|
||||||
|
JOptionPane.showMessageDialog(null, "Une fenêtre d'aide est déjà ouverte.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nbHelpWindow++;
|
||||||
|
|
||||||
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,800);
|
aide.setSize(700,500);
|
||||||
aide.setLocationRelativeTo(null);
|
aide.setLocationRelativeTo(null);
|
||||||
aide.setVisible(true);
|
aide.setVisible(true);
|
||||||
|
|
||||||
@ -56,7 +63,12 @@ public class MainFrame extends JFrame {
|
|||||||
helpText.setText(Constants.HELP);
|
helpText.setText(Constants.HELP);
|
||||||
helpText.setEditable(false);
|
helpText.setEditable(false);
|
||||||
|
|
||||||
aide.add(helpText);
|
JScrollPane scrollbar = new JScrollPane(helpText);
|
||||||
|
scrollbar.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||||
|
scrollbar.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||||
|
|
||||||
|
aide.add(scrollbar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void newTab() {
|
public void newTab() {
|
||||||
if(nbTabs>2)
|
if(nbTabs>2)
|
||||||
|
Loading…
Reference in New Issue
Block a user