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>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JTattoo Look and Feel -->
|
||||
<dependency>
|
||||
<groupId>com.jtattoo</groupId>
|
||||
<artifactId>JTattoo</artifactId>
|
||||
<version>1.6.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -2,8 +2,10 @@ import Model.Arrangement;
|
|||
import Presenter.Presenter;
|
||||
import View.MainFrame;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
MainFrame view = new MainFrame();
|
||||
view.setPresenter(new Presenter(new Arrangement(), view));
|
||||
setLookAndFeel(view);
|
||||
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.RMPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.ComponentOrientation;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
|
@ -50,6 +56,7 @@ public class MainFrame extends JFrame {
|
|||
private LMSPanel lmsPanel;
|
||||
private RMPanel rmPanel;
|
||||
private JPanel pane;
|
||||
private JPanel northPanel;
|
||||
|
||||
private ArrangementDialog arrangement;
|
||||
private JDialog arrangementDialog;
|
||||
|
@ -76,7 +83,7 @@ public class MainFrame extends JFrame {
|
|||
|
||||
setCloseOperations();
|
||||
setActionListeners();
|
||||
|
||||
setIcons();
|
||||
disableFunctionality();
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
@ -147,6 +154,8 @@ public class MainFrame extends JFrame {
|
|||
private void addComponents() {
|
||||
pane.add(arrangementButton);
|
||||
pane.add(importButton);
|
||||
northPanel.add(menupanel);
|
||||
northPanel.add(pane);
|
||||
|
||||
setupSplitPane();
|
||||
setupTabbedPane();
|
||||
|
@ -154,9 +163,9 @@ public class MainFrame extends JFrame {
|
|||
progressContent.add(progressBar, BorderLayout.NORTH);
|
||||
progressBar.setBorder(BorderFactory.createTitledBorder("Import..."));
|
||||
|
||||
this.add(pane, BorderLayout.SOUTH);
|
||||
this.add(northPanel, BorderLayout.NORTH);
|
||||
this.add(splitpane, BorderLayout.CENTER);
|
||||
this.add(menupanel, BorderLayout.NORTH);
|
||||
|
||||
}
|
||||
|
||||
private void setupSplitPane() {
|
||||
|
@ -185,7 +194,8 @@ public class MainFrame extends JFrame {
|
|||
|
||||
private void setLayouts() {
|
||||
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() {
|
||||
|
@ -194,6 +204,7 @@ public class MainFrame extends JFrame {
|
|||
lmsPanel = new LMSPanel();
|
||||
rmPanel = new RMPanel();
|
||||
menupanel = new MenuPanel();
|
||||
northPanel = new JPanel();
|
||||
|
||||
//Dialogs
|
||||
arrangementDialog = new JDialog();
|
||||
|
@ -212,6 +223,22 @@ public class MainFrame extends JFrame {
|
|||
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() {
|
||||
arrangementButton.addActionListener((ActionEvent e) -> {
|
||||
Thread t = new Thread(() -> getPresenter().visualizeDualLines());
|
||||
|
|
|
@ -2,10 +2,15 @@ package View.Panels;
|
|||
|
||||
import View.PlotDialog;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
@ -50,7 +55,10 @@ public class LMSPanel extends JPanel {
|
|||
addTextfieldAndInput(0, "Konstante", 0.5);
|
||||
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);
|
||||
|
||||
this.northPanel.add(continer, BorderLayout.CENTER);
|
||||
|
@ -81,14 +89,18 @@ public class LMSPanel extends JPanel {
|
|||
}
|
||||
|
||||
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.gridy = row;
|
||||
gbc.weightx = 0.05;
|
||||
gbc.weighty = 0.05;
|
||||
|
||||
continer.add(button, gbc);
|
||||
gbc.gridwidth = 1;
|
||||
buttonPanel.add(button);
|
||||
continer.add(buttonPanel, gbc);
|
||||
}
|
||||
|
||||
public JButton getStartButton() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package View.Panels;
|
|||
|
||||
import View.PlotDialog;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
|
@ -50,13 +51,19 @@ public class RMPanel extends JPanel {
|
|||
addTextfieldAndInput(0, "\u00df (0 < \u00df < 1)", 0.5);
|
||||
|
||||
|
||||
this.startButton = new JButton("start");
|
||||
gbc.insets = new Insets(30, 5, 10, 0);
|
||||
JPanel buttonPanel = new JPanel();
|
||||
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.gridy = 2;
|
||||
gbc.weightx = 0.05;
|
||||
gbc.weighty = 0.05;
|
||||
continer.add(startButton, gbc);
|
||||
buttonPanel.add(startButton);
|
||||
continer.add(buttonPanel, gbc);
|
||||
|
||||
this.northPanel.add(continer, BorderLayout.CENTER);
|
||||
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