Ajout de l'api pour les logiciels

This commit is contained in:
Mysaa 2021-05-24 14:08:39 +02:00
parent a10deda7a9
commit e78c79b074
4 changed files with 67 additions and 8 deletions

View File

@ -0,0 +1,9 @@
package com.bernard.api;
public abstract class Configuration {
public Configuration() {}
public abstract Configuration getDefault();
}

View File

@ -0,0 +1,11 @@
package com.bernard.api;
import javax.swing.JPanel;
public interface Configurationnable {
public JPanel getBlankPanel();
public Configurationnable getFromPanel();
}

View File

@ -0,0 +1,7 @@
package com.bernard.api;
public interface Launcheable {
void launch(Configuration config);
}

View File

@ -1,36 +1,68 @@
package com.bernard.ator; package com.bernard.ator;
import javax.swing.JFrame; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JTabbedPane; import com.bernard.ator.obj.LauncheableItem;
import com.bernard.ator.view.LauncheableItemCellRenderer;
public class BernardatorWindow extends JFrame{ public class BernardatorWindow extends JFrame{
private static final long serialVersionUID = 6428140110872165791L; private static final long serialVersionUID = 6428140110872165791L;
public static final String defaultBernardatorHomeUNIX = ""; public static final String defaultBernardatorHomeUNIX = "~/.bernard/";
JTabbedPane panel; JTabbedPane panel;
JPanel[] onglets; JPanel[] onglets;
JList<LauncheableItem> launcheableList;
LauncheableItem[] launcheableItems;
public BernardatorWindow() { public BernardatorWindow() {
loadData();
panel = new JTabbedPane(); panel = new JTabbedPane();
onglets = new JPanel[4]; onglets = new JPanel[4];
panel.addTab("Programmes", onglets[0]); this.setSize(500, 500);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//init();
panel.add(new LauncheableItemCellRenderer().getListCellRendererComponent(null, launcheableItems[0], 0, true, true));
this.setContentPane(panel); this.setContentPane(panel);
this.pack();
this.setVisible(true);
} }
public void init() { public void init() {
onglets[0] = new JPanel(); onglets[0] = new JPanel();
} launcheableList = new JList<LauncheableItem>(launcheableItems);
launcheableList.setSelectionModel(new LauncheableItemCellRenderer.DisabledItemSelectionModel());
public void loadData() { launcheableList.setLayoutOrientation(JList.VERTICAL);
launcheableList.setVisibleRowCount(-1);
launcheableList.setCellRenderer(new LauncheableItemCellRenderer());
onglets[0].add(launcheableList);
panel.addTab("Programmes", new JScrollPane(onglets[0]));
} }
public void loadData() {
launcheableItems = new LauncheableItem[2];
launcheableItems[0] = new LauncheableItem("Cercloidator", "2x+3", null);
launcheableItems[1] = new LauncheableItem("Modulotator", "beta-beta", "Le programme a mal été chargé");
}
public static void main(String[] args) {
new BernardatorWindow();
}
} }