1
0
Fork 0
This commit is contained in:
Tergel TSAGAAN 2020-12-24 21:02:10 +01:00
parent 86ef72e388
commit 54d76581f3
4 changed files with 223 additions and 25 deletions

1
config.json Normal file
View file

@ -0,0 +1 @@
{"host":"vps.flifloo.fr","password":"cannes","database":"cannes","user":"root"}

View file

@ -1,47 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="GUI.GUI">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="27dc6" binding="mainPanel" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="500" height="400"/>
<xy x="20" y="20" width="500" height="695"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<toolbar id="c7ac7">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="20"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children/>
</toolbar>
<grid id="7954c" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="7954c" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="668e3">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="17c84" class="javax.swing.JLabel">
<grid id="7f894" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="fc703" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="25" left="50" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="284" height="61"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="a4e5" class="javax.swing.JButton" binding="LMButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="75" height="-1"/>
</grid>
</constraints>
<properties>
<foreground color="-16777216"/>
<text value="Projection Planning"/>
<text value="LM"/>
</properties>
</component>
<component id="b3aec" class="javax.swing.JButton" binding="HCButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="75" height="-1"/>
</grid>
</constraints>
<properties>
<text value="HC"/>
</properties>
</component>
<component id="e290e" class="javax.swing.JButton" binding="UCRButton" default-binding="true">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="75" height="-1"/>
</grid>
</constraints>
<properties>
<text value="UCR"/>
</properties>
</component>
</children>
</grid>
<hspacer id="4ab95">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="14" height="61"/>
</grid>
</constraints>
</hspacer>
<grid id="4fa1" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="50" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="8afcf" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font size="22"/>
<labelFor value="c1d0a"/>
<text value="Agenda"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</children>
</grid>
<grid id="8ead9" layout-manager="GridBagLayout">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<maximum-size width="-1" height="750"/>
</grid>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="c1d0a" binding="scrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="7" anchor="0" fill="3" indent="1" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e6114" class="javax.swing.JTable" binding="table1" default-binding="true">
<constraints/>
<properties>
<cellSelectionEnabled value="true"/>
<gridColor color="-13105660"/>
<intercellSpacing width="1" height="1"/>
<rowHeight value="100"/>
<rowMargin value="1"/>
</properties>
</component>
</children>
</scrollpane>
</children>
</grid>
<grid id="7e556" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="37e85" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Label"/>
</properties>
</component>
<hspacer id="6580f">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="2dd31">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
</grid>
</children>
</grid>
</form>

View file

@ -1,15 +1,62 @@
package GUI;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableModel;
import java.awt.*;
public class GUI extends JFrame {
private JPanel mainPanel;
private JButton LMButton;
private JButton HCButton;
private JButton UCRButton;
private JTable table1;
private JScrollPane scrollPane;
private JTable table2;
private JMenuBar menuBar = new JMenuBar();
private JMenu menuFichier = new JMenu("File");
private JMenuItem menuItemAddProj = new JMenuItem("Add projection");
private JMenuItem menuItemEditProj = new JMenuItem("Edit projection");
private JMenuItem menuItemRemoveProj = new JMenuItem("Remove projection");
public GUI() {
super();
construct();
}
private void renderMenu() {
menuBar.add(menuFichier);
menuFichier.add(menuItemAddProj);
menuFichier.add(menuItemEditProj);
menuFichier.add(menuItemRemoveProj);
setJMenuBar(menuBar);
}
private void renderTable() {
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment(SwingConstants.CENTER);
TableModel dataTest = new MyTableModel();
table1.setModel(dataTest);
for (int columnIndex = 0; columnIndex < dataTest.getColumnCount(); columnIndex++)
{
table1.getColumnModel().getColumn(columnIndex).setCellRenderer(centerRenderer);
}
scrollPane.setViewportView(table1);
JList rowHeader = new JList(new AbstractListModel() {
String headers[] = { "Matin", "Midi", "Milieu A", "Fin Aprem", "Soirée"};
@Override
public int getSize() {
return headers.length;
}
@Override
public Object getElementAt(int index) {
return headers[index];
}
});
rowHeader.setFixedCellHeight(100);
rowHeader.setFixedCellWidth(60);
scrollPane.setRowHeaderView(rowHeader);
}
private void construct() {
setTitle("Projection Planning");
setContentPane(mainPanel);
@ -17,6 +64,8 @@ public class GUI extends JFrame {
setLocationRelativeTo(null);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.renderMenu();
this.renderTable();
setVisible(true);
}
}

View file

@ -0,0 +1,27 @@
package GUI;
import javax.swing.table.AbstractTableModel;
public class MyTableModel extends AbstractTableModel {
private String[] columnNames = {"Jour 1", "Jour 2", "Jour 3", "Jour 4", "Jour 5"};
private Object[][] data = {{"","Film 1","Film 2","",""}, {"","Film 4","","",""}, {"","","","",""}, {"","","","",""}, {"","","","",""}};
@Override
public int getRowCount() {
return data.length;
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public String getColumnName(int column) {
return columnNames[column];
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return data[rowIndex][columnIndex];
}
}