Commit e1794404 authored by tr808axm's avatar tr808axm
Browse files

+ Initialized Repository.

+ Added GUI.
parents
.idea/
out/
\ No newline at end of file
This diff is collapsed.
Copyright (C) 2016 tr808axm
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
\ No newline at end of file
Manifest-Version: 1.0
Main-Class: de.tr808axm.launcher.LauncherMain
/*
* Copyright (C) 2016 tr808axm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tr808axm.launcher;
import de.tr808axm.launcher.gui.LauncherGUI;
/**
* This is the access point for launching the project.
* Created by tr808axm on 18.10.2016.
*/
public class LauncherMain {
private LauncherMain() {
new LauncherGUI();
}
public static void main(String[] args) {
new LauncherMain();
}
}
/*
* Copyright (C) 2016 tr808axm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tr808axm.launcher.gui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
/**
* Represents a launchable as a GUI component.
* Created by tr808axm on 22.10.2016.
*/
public class JLaunchableComponent extends JPanel {
private static Color backgroundColor = new Color(236, 240, 241);
private final String name;
public JLaunchableComponent(String name) {
super();
this.name = name;
setPreferredSize(new Dimension(50, 75));
addMouseListener(new MouseClickListener() {
@Override
public void mouseClicked(MouseEvent e) {
launch();
}
});
}
private void launch() {
JOptionPane.showMessageDialog(getRootPane(), "Launching " + name, "Launching program", JOptionPane.INFORMATION_MESSAGE); //TODO launch an actual thing
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
setBackground(backgroundColor);
g.setColor(Color.GREEN);
int horizontalMarginSize = getHeight() / 10;
int verticalMarginSize = getWidth() / 10;
g.fillRect(verticalMarginSize, horizontalMarginSize,
getWidth() - 2 * verticalMarginSize, getHeight() - 2 * horizontalMarginSize);
g.setColor(Color.BLACK);
g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 9));
g.drawString(name, (int) (getWidth() * 0.05), (int) (getHeight() * 0.95));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.tr808axm.launcher.gui.LauncherGUI">
<grid id="27dc6" binding="contentPane" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="cb2ba" class="javax.swing.JLabel" binding="launchablesLabel">
<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"/>
<gridbag weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Launchables"/>
</properties>
</component>
<grid id="f339a" binding="launchablePanel" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="3">
<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"/>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties>
<background color="-1"/>
</properties>
<border type="line">
<color color="-526345"/>
</border>
<children/>
</grid>
</children>
</grid>
</form>
/*
* Copyright (C) 2016 tr808axm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tr808axm.launcher.gui;
import javax.swing.*;
import java.awt.*;
/**
* This is the GUI implementation of the Launcher.
* Created by tr808axm on 22.10.2016.
*/
public class LauncherGUI {
private JFrame frame;
private JPanel contentPane;
private JLabel launchablesLabel;
private JPanel launchablePanel;
public LauncherGUI() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
frame = new JFrame("Launcher");
frame.setContentPane(contentPane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setSize(400, 500);
frame.setVisible(true);
// Create 10 Launchables TODO Remove this as it is an example.
for (int i = 0; i < 10; i++) {
launchablePanel.add(new JLaunchableComponent("Program " + i));
}
}
});
} // TODO Very ugly generated code down there... Will be implemented in a better way when GUI-design is finished
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contentPane = new JPanel();
contentPane.setLayout(new GridBagLayout());
launchablesLabel = new JLabel();
launchablesLabel.setText("Launchables");
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.WEST;
contentPane.add(launchablesLabel, gbc);
launchablePanel = new JPanel();
launchablePanel.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 5));
launchablePanel.setBackground(new Color(-1));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
contentPane.add(launchablePanel, gbc);
launchablePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-526345)), null));
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPane;
}
}
/*
* Copyright (C) 2016 tr808axm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tr808axm.launcher.gui;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
* Simplifies the MouseListener interface to the mouseClick event.
* Created by tr808axm on 22.10.2016.
*/
public abstract class MouseClickListener implements MouseListener {
@Override
public void mousePressed(MouseEvent e) {
return;
}
@Override
public void mouseReleased(MouseEvent e) {
return;
}
@Override
public void mouseEntered(MouseEvent e) {
return;
}
@Override
public void mouseExited(MouseEvent e) {
return;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment