Premier commit - Inclusion dans le projet git
This commit is contained in:
commit
a10deda7a9
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
.project
|
||||||
|
bin/
|
||||||
36
src/com/bernard/ator/BernardatorWindow.java
Normal file
36
src/com/bernard/ator/BernardatorWindow.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.bernard.ator;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTabbedPane;
|
||||||
|
|
||||||
|
public class BernardatorWindow extends JFrame{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6428140110872165791L;
|
||||||
|
public static final String defaultBernardatorHomeUNIX = "";
|
||||||
|
|
||||||
|
JTabbedPane panel;
|
||||||
|
|
||||||
|
JPanel[] onglets;
|
||||||
|
|
||||||
|
public BernardatorWindow() {
|
||||||
|
|
||||||
|
panel = new JTabbedPane();
|
||||||
|
onglets = new JPanel[4];
|
||||||
|
|
||||||
|
panel.addTab("Programmes", onglets[0]);
|
||||||
|
|
||||||
|
this.setContentPane(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
|
||||||
|
onglets[0] = new JPanel();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
41
src/com/bernard/ator/obj/LauncheableItem.java
Normal file
41
src/com/bernard/ator/obj/LauncheableItem.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package com.bernard.ator.obj;
|
||||||
|
|
||||||
|
public class LauncheableItem {
|
||||||
|
|
||||||
|
String programName;
|
||||||
|
String programVersion;
|
||||||
|
String programError;
|
||||||
|
|
||||||
|
public LauncheableItem(String programName, String programVersion, String programError) {
|
||||||
|
super();
|
||||||
|
this.programName = programName;
|
||||||
|
this.programVersion = programVersion;
|
||||||
|
this.programError = programError;
|
||||||
|
}
|
||||||
|
public String getProgramName() {
|
||||||
|
return programName;
|
||||||
|
}
|
||||||
|
public void setProgramName(String programName) {
|
||||||
|
this.programName = programName;
|
||||||
|
}
|
||||||
|
public String getProgramVersion() {
|
||||||
|
return programVersion;
|
||||||
|
}
|
||||||
|
public void setProgramVersion(String programVersion) {
|
||||||
|
this.programVersion = programVersion;
|
||||||
|
}
|
||||||
|
public String getProgramError() {
|
||||||
|
return programError;
|
||||||
|
}
|
||||||
|
public void setProgramError(String programError) {
|
||||||
|
this.programError = programError;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "LauncheableItem [programName=" + programName + ", programVersion=" + programVersion + ", programError="
|
||||||
|
+ programError + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
82
src/com/bernard/ator/view/LauncheableItemCellRenderer.java
Normal file
82
src/com/bernard/ator/view/LauncheableItemCellRenderer.java
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package com.bernard.ator.view;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
|
import com.bernard.ator.obj.LauncheableItem;
|
||||||
|
|
||||||
|
public class LauncheableItemCellRenderer extends JPanel implements ListCellRenderer<LauncheableItem> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1137058883626164294L;
|
||||||
|
|
||||||
|
public static final int height = 100;
|
||||||
|
public static final int PADDING = 10;
|
||||||
|
public static final String PLAY_IMAGE = "/com/bernard/res/image/play.png";
|
||||||
|
public static final String SETTINGS_IMAGE = "/com/bernard/res/image/settings.png";
|
||||||
|
|
||||||
|
public static final Font programNameFont = new Font("Suruma", Font.BOLD, 18),
|
||||||
|
programVersionFont = new Font("Suruma", Font.ITALIC, 15),
|
||||||
|
programErrorFont = new Font("Impact", Font.ITALIC, 12);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getListCellRendererComponent(JList<? extends LauncheableItem> list, LauncheableItem value,
|
||||||
|
int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
|
|
||||||
|
FlowLayout flayout = new FlowLayout(FlowLayout.RIGHT,0,0);
|
||||||
|
JPanel component = new JPanel(flayout);
|
||||||
|
component.setBorder(new EmptyBorder(PADDING, PADDING, PADDING, PADDING));
|
||||||
|
component.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
|
||||||
|
ImageIcon playIcon = new ImageIcon(Class.class.getResource(PLAY_IMAGE));
|
||||||
|
ImageIcon settingsIcon = new ImageIcon(Class.class.getResource(SETTINGS_IMAGE));
|
||||||
|
component.add(new JLabel(settingsIcon));
|
||||||
|
component.add(new JLabel(playIcon));
|
||||||
|
|
||||||
|
SpringLayout slayout = new SpringLayout();
|
||||||
|
JPanel textPan = new JPanel(slayout);
|
||||||
|
JLabel programNameText = new JLabel(value.getProgramName());
|
||||||
|
programNameText.setFont(programNameFont);
|
||||||
|
programNameText.setForeground(Color.black);
|
||||||
|
JLabel programVersionText = new JLabel("Version "+value.getProgramVersion());
|
||||||
|
programVersionText.setFont(programVersionFont);
|
||||||
|
programVersionText.setForeground(Color.darkGray);
|
||||||
|
slayout.putConstraint(SpringLayout.WEST, programNameText, 0, SpringLayout.WEST, textPan);
|
||||||
|
slayout.putConstraint(SpringLayout.NORTH, programNameText, 0, SpringLayout.NORTH, textPan);
|
||||||
|
textPan.add(programNameText);
|
||||||
|
slayout.putConstraint(SpringLayout.WEST, programVersionText, 0, SpringLayout.WEST, textPan);
|
||||||
|
slayout.putConstraint(SpringLayout.NORTH, programVersionText, 0, SpringLayout.SOUTH, programNameText);
|
||||||
|
textPan.add(programVersionText);
|
||||||
|
|
||||||
|
|
||||||
|
if(value.getProgramError() != null) {
|
||||||
|
JLabel programErrorText = new JLabel(value.getProgramError());
|
||||||
|
programErrorText.setFont(programErrorFont);
|
||||||
|
programErrorText.setForeground(Color.red);
|
||||||
|
slayout.putConstraint(SpringLayout.WEST, programErrorText, 0, SpringLayout.WEST, textPan);
|
||||||
|
slayout.putConstraint(SpringLayout.SOUTH, programErrorText, 0, SpringLayout.SOUTH, textPan);
|
||||||
|
textPan.add(programErrorText);
|
||||||
|
}
|
||||||
|
|
||||||
|
//textPan.setBackground(randColor());
|
||||||
|
component.add(textPan);
|
||||||
|
|
||||||
|
System.out.println(component);
|
||||||
|
|
||||||
|
return textPan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DisabledItemSelectionModel extends DefaultListSelectionModel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7391599696239728930L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectionInterval(int index0, int index1) {
|
||||||
|
super.setSelectionInterval(-1, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Color randColor() {
|
||||||
|
return Color.getHSBColor((float)Math.random(), 1f, 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/com/bernard/res/image/play.png
Normal file
BIN
src/com/bernard/res/image/play.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
src/com/bernard/res/image/settings.png
Normal file
BIN
src/com/bernard/res/image/settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Loading…
x
Reference in New Issue
Block a user