gui gui :D
This commit is contained in:
parent
a1c3d2c933
commit
592e1a0f02
7
pom.xml
7
pom.xml
|
@ -42,5 +42,12 @@
|
||||||
<artifactId>opencsv</artifactId>
|
<artifactId>opencsv</artifactId>
|
||||||
<version>3.9</version>
|
<version>3.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JTattoo Look and Feel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jtattoo</groupId>
|
||||||
|
<artifactId>JTattoo</artifactId>
|
||||||
|
<version>1.6.11</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -2,8 +2,10 @@ import Model.Arrangement;
|
||||||
import Presenter.Presenter;
|
import Presenter.Presenter;
|
||||||
import View.MainFrame;
|
import View.MainFrame;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import javax.swing.JFrame;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.UnsupportedLookAndFeelException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
||||||
|
@ -28,11 +30,27 @@ public class App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void setLookAndFeel(JFrame view){
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel("com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (UnsupportedLookAndFeelException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
SwingUtilities.updateComponentTreeUI(view);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
MainFrame view = new MainFrame();
|
MainFrame view = new MainFrame();
|
||||||
view.setPresenter(new Presenter(new Arrangement(), view));
|
view.setPresenter(new Presenter(new Arrangement(), view));
|
||||||
|
setLookAndFeel(view);
|
||||||
setUIFont (new javax.swing.plaf.FontUIResource(new Font("Verdana",Font.PLAIN, 12)));
|
setUIFont (new javax.swing.plaf.FontUIResource(new Font("Verdana",Font.PLAIN, 12)));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,13 +7,19 @@ import View.Panels.MenuPanel;
|
||||||
import View.Panels.OutputPanel;
|
import View.Panels.OutputPanel;
|
||||||
import View.Panels.RMPanel;
|
import View.Panels.RMPanel;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.ComponentOrientation;
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Image;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
|
@ -50,6 +56,7 @@ public class MainFrame extends JFrame {
|
||||||
private LMSPanel lmsPanel;
|
private LMSPanel lmsPanel;
|
||||||
private RMPanel rmPanel;
|
private RMPanel rmPanel;
|
||||||
private JPanel pane;
|
private JPanel pane;
|
||||||
|
private JPanel northPanel;
|
||||||
|
|
||||||
private ArrangementDialog arrangement;
|
private ArrangementDialog arrangement;
|
||||||
private JDialog arrangementDialog;
|
private JDialog arrangementDialog;
|
||||||
|
@ -76,7 +83,7 @@ public class MainFrame extends JFrame {
|
||||||
|
|
||||||
setCloseOperations();
|
setCloseOperations();
|
||||||
setActionListeners();
|
setActionListeners();
|
||||||
|
setIcons();
|
||||||
disableFunctionality();
|
disableFunctionality();
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +154,8 @@ public class MainFrame extends JFrame {
|
||||||
private void addComponents() {
|
private void addComponents() {
|
||||||
pane.add(arrangementButton);
|
pane.add(arrangementButton);
|
||||||
pane.add(importButton);
|
pane.add(importButton);
|
||||||
|
northPanel.add(menupanel);
|
||||||
|
northPanel.add(pane);
|
||||||
|
|
||||||
setupSplitPane();
|
setupSplitPane();
|
||||||
setupTabbedPane();
|
setupTabbedPane();
|
||||||
|
@ -154,9 +163,9 @@ public class MainFrame extends JFrame {
|
||||||
progressContent.add(progressBar, BorderLayout.NORTH);
|
progressContent.add(progressBar, BorderLayout.NORTH);
|
||||||
progressBar.setBorder(BorderFactory.createTitledBorder("Import..."));
|
progressBar.setBorder(BorderFactory.createTitledBorder("Import..."));
|
||||||
|
|
||||||
this.add(pane, BorderLayout.SOUTH);
|
this.add(northPanel, BorderLayout.NORTH);
|
||||||
this.add(splitpane, BorderLayout.CENTER);
|
this.add(splitpane, BorderLayout.CENTER);
|
||||||
this.add(menupanel, BorderLayout.NORTH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSplitPane() {
|
private void setupSplitPane() {
|
||||||
|
@ -185,7 +194,8 @@ public class MainFrame extends JFrame {
|
||||||
|
|
||||||
private void setLayouts() {
|
private void setLayouts() {
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
pane.setLayout(new FlowLayout());
|
pane.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeComponents() {
|
private void initializeComponents() {
|
||||||
|
@ -194,6 +204,7 @@ public class MainFrame extends JFrame {
|
||||||
lmsPanel = new LMSPanel();
|
lmsPanel = new LMSPanel();
|
||||||
rmPanel = new RMPanel();
|
rmPanel = new RMPanel();
|
||||||
menupanel = new MenuPanel();
|
menupanel = new MenuPanel();
|
||||||
|
northPanel = new JPanel();
|
||||||
|
|
||||||
//Dialogs
|
//Dialogs
|
||||||
arrangementDialog = new JDialog();
|
arrangementDialog = new JDialog();
|
||||||
|
@ -212,6 +223,22 @@ public class MainFrame extends JFrame {
|
||||||
importButton = new JButton();
|
importButton = new JButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setIcons(){
|
||||||
|
try {
|
||||||
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
|
Image imgImport = ImageIO.read(classLoader.getResource("import.png")).getScaledInstance(16,16,Image.SCALE_SMOOTH);
|
||||||
|
Image imgPlot = ImageIO.read(classLoader.getResource("plot.png")).getScaledInstance(16,16,Image.SCALE_SMOOTH);
|
||||||
|
Image imgStart = ImageIO.read(classLoader.getResource("start.png")).getScaledInstance(32,32,Image.SCALE_SMOOTH);
|
||||||
|
|
||||||
|
importButton.setIcon(new ImageIcon(imgImport));
|
||||||
|
arrangementButton.setIcon(new ImageIcon(imgPlot));
|
||||||
|
lmsPanel.getStartButton().setIcon(new ImageIcon(imgStart));
|
||||||
|
rmPanel.getStartButton().setIcon(new ImageIcon(imgStart));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setActionListeners() {
|
private void setActionListeners() {
|
||||||
arrangementButton.addActionListener((ActionEvent e) -> {
|
arrangementButton.addActionListener((ActionEvent e) -> {
|
||||||
Thread t = new Thread(() -> getPresenter().visualizeDualLines());
|
Thread t = new Thread(() -> getPresenter().visualizeDualLines());
|
||||||
|
|
|
@ -2,10 +2,15 @@ package View.Panels;
|
||||||
|
|
||||||
import View.PlotDialog;
|
import View.PlotDialog;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
@ -50,7 +55,10 @@ public class LMSPanel extends JPanel {
|
||||||
addTextfieldAndInput(0, "Konstante", 0.5);
|
addTextfieldAndInput(0, "Konstante", 0.5);
|
||||||
addTextfieldAndInput(1, "Fehler", 0.05);
|
addTextfieldAndInput(1, "Fehler", 0.05);
|
||||||
|
|
||||||
this.startButton = new JButton("start");
|
this.startButton = new JButton("Start");
|
||||||
|
this.startButton.setFont(new Font("Verdana",Font.PLAIN, 16));
|
||||||
|
this.startButton.setContentAreaFilled(false);
|
||||||
|
this.startButton.setFocusPainted(false);
|
||||||
addButton(2, startButton);
|
addButton(2, startButton);
|
||||||
|
|
||||||
this.northPanel.add(continer, BorderLayout.CENTER);
|
this.northPanel.add(continer, BorderLayout.CENTER);
|
||||||
|
@ -81,14 +89,18 @@ public class LMSPanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addButton(int row, JButton button) {
|
private void addButton(int row, JButton button) {
|
||||||
|
JPanel buttonPanel = new JPanel();
|
||||||
|
buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
|
||||||
|
gbc.insets = new Insets(30, 0, 5, 0);
|
||||||
|
|
||||||
gbc.insets = new Insets(30, 5, 10, 0);
|
|
||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
gbc.gridy = row;
|
gbc.gridy = row;
|
||||||
gbc.weightx = 0.05;
|
gbc.weightx = 0.05;
|
||||||
gbc.weighty = 0.05;
|
gbc.weighty = 0.05;
|
||||||
|
gbc.gridwidth = 1;
|
||||||
continer.add(button, gbc);
|
buttonPanel.add(button);
|
||||||
|
continer.add(buttonPanel, gbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JButton getStartButton() {
|
public JButton getStartButton() {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package View.Panels;
|
||||||
|
|
||||||
import View.PlotDialog;
|
import View.PlotDialog;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
|
@ -50,13 +51,19 @@ public class RMPanel extends JPanel {
|
||||||
addTextfieldAndInput(0, "\u00df (0 < \u00df < 1)", 0.5);
|
addTextfieldAndInput(0, "\u00df (0 < \u00df < 1)", 0.5);
|
||||||
|
|
||||||
|
|
||||||
this.startButton = new JButton("start");
|
JPanel buttonPanel = new JPanel();
|
||||||
gbc.insets = new Insets(30, 5, 10, 0);
|
buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
this.startButton = new JButton("Start");
|
||||||
|
this.startButton.setFont(new Font("Verdana",Font.PLAIN, 16));
|
||||||
|
this.startButton.setContentAreaFilled(false);
|
||||||
|
this.startButton.setFocusPainted(false);
|
||||||
|
gbc.insets = new Insets(30, 0, 10, 0);
|
||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
gbc.gridy = 2;
|
gbc.gridy = 2;
|
||||||
gbc.weightx = 0.05;
|
gbc.weightx = 0.05;
|
||||||
gbc.weighty = 0.05;
|
gbc.weighty = 0.05;
|
||||||
continer.add(startButton, gbc);
|
buttonPanel.add(startButton);
|
||||||
|
continer.add(buttonPanel, gbc);
|
||||||
|
|
||||||
this.northPanel.add(continer, BorderLayout.CENTER);
|
this.northPanel.add(continer, BorderLayout.CENTER);
|
||||||
this.add(northPanel, BorderLayout.NORTH);
|
this.add(northPanel, BorderLayout.NORTH);
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
Loading…
Reference in New Issue