Skip to content

Commit

Permalink
-edited images
Browse files Browse the repository at this point in the history
-added descriptions for optional mods
  • Loading branch information
EinfachRobbe committed Mar 19, 2024
1 parent 9ccd03c commit bb73d99
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 27 deletions.
Binary file not shown.
40 changes: 40 additions & 0 deletions src/main/java/dev/nachwahl/bteginstaller/FinishForm.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="dev.nachwahl.bteginstaller.FinishForm">
<grid id="27dc6" binding="FinishForm" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="534" height="200"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="afe01" class="javax.swing.JLabel">
<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"/>
</constraints>
<properties>
<font size="18" style="1"/>
<text value="Installation/Update abgeschlossen"/>
</properties>
</component>
<component id="458c8" class="javax.swing.JLabel" binding="installiereLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Du kannst dieses Fenster nun schließen"/>
</properties>
</component>
<component id="382d2" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
<icon value="checkmark.png"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
</form>
25 changes: 25 additions & 0 deletions src/main/java/dev/nachwahl/bteginstaller/FinishForm.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package dev.nachwahl.bteginstaller;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

public class FinishForm{
public JPanel FinishForm;
private JLabel installiereLabel;
private InstallUtil installUtil;

public FinishForm(InstallUtil installUtil, JFrame frame, JDialog finish) {
this.installUtil = installUtil;
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
}
});


}

}
14 changes: 10 additions & 4 deletions src/main/java/dev/nachwahl/bteginstaller/InstallTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ protected Void doInBackground() throws InterruptedException {
@Override
public void done() {
InstallUtil.playSound("notification.wav");
progressDialog.setTitle("Installation/Update abgeschlossen");
progessLabel.setText("Installation/Update abgeschlossen");
progressBar.setValue(100);
progressDialog.dispose();
JDialog finish = new JDialog(Installer.pframe, "Installation/Update abgeschlossen", true);
finish.setContentPane(new FinishForm(installUtil, Installer.pframe, finish).FinishForm);
finish.setResizable(false);
finish.setSize(500, 150);
finish.setLocationRelativeTo(null);
finish.setVisible(true);
finish.toFront();
finish.repaint();
}

private static Path getMinecraftDir(String mcFolderNanme) {
Expand Down Expand Up @@ -385,7 +391,7 @@ private boolean unzipFabric(File minecraftFolder) throws IOException {
dir.mkdir();
} else {
long zipFileSize = 0;

System.out.println(filePath);
FileOutputStream fos = new FileOutputStream(filePath);
byte[] buffer = new byte[1024];
int bytesRead;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/dev/nachwahl/bteginstaller/Installer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
public class Installer {
private static int modpackCount = 0;
public static List<Modpack> modpacks = new ArrayList<Modpack>();
public static JFrame pframe = null;

public static void main(String[] args) throws IOException {

FlatOneDarkIJTheme.install(new FlatOneDarkIJTheme());
final JFrame frame = new JFrame("BTE Germany Installer");
pframe = frame;
try {
frame.setIconImage(ImageIO.read(MainForm.class.getResourceAsStream("/logo.png")));
} catch (IOException e) {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/dev/nachwahl/bteginstaller/MainForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ public class MainForm {
private JComboBox modpackVersionDropDown;
private JLabel versionText;
private JButton selectOptionalShadersButton;

public static String selectedItem;


public MainForm(final JFrame frame, final InstallUtil installUtil) {

frame.setResizable(false);
Expand Down Expand Up @@ -56,7 +54,7 @@ public MainForm(final JFrame frame, final InstallUtil installUtil) {
installModpackButton.addActionListener(e -> {
String modpackVersion = modpackVersionDropDown.getSelectedItem().toString();
JDialog loading = new JDialog(frame, "Installiere...", true);
loading.setContentPane(new LoadingForm(installUtil, frame, loading,modpackVersion).LoadingForm);
loading.setContentPane(new LoadingForm(installUtil, frame, loading, modpackVersion).LoadingForm);
loading.setResizable(false);
loading.setSize(500, 150);
loading.setLocationRelativeTo(null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/nachwahl/bteginstaller/OptionsForm.form
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<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>
<icon value="chest.png"/>
<icon value="anvil.png"/>
<text value=""/>
</properties>
</component>
Expand Down
40 changes: 23 additions & 17 deletions src/main/java/dev/nachwahl/bteginstaller/OptionsForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,59 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.List;

public class OptionsForm {
public JPanel OptionFormPanel;
private JButton speichernButton;
private JPanel DATA;
private JDialog dialog;

public OptionsForm(JDialog dialog,final InstallUtil installUtil) {
public OptionsForm(JDialog dialog, final InstallUtil installUtil) {
this.dialog = dialog;

DATA.setLayout(new GridBagLayout());
DATA.setLayout(new BorderLayout()); // Setzt das Hauptlayout zu BorderLayout

JPanel centerPanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER; // Endet die Zeile
gbc.gridwidth = GridBagConstraints.REMAINDER; // Beendet die Zeile
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1; // Verteilt den zusätzlichen horizontalen Raum
gbc.weighty = 1;

for (Modpack m : Installer.modpacks) {
if (m.getLabel().equals(MainForm.selectedItem)) {
for (int i = 0; i < m.getOptionalMods().size(); i++) {
HashMap<String, String> hm = m.getOptionalMods().get(i);
JCheckBox checkbox = new JCheckBox();
checkbox.setName(hm.get("label"));
checkbox.setText(hm.get("label") + " | " + hm.get("desc"));
checkbox.setSelected("true".equals(hm.get("enabled")));

checkbox.setText(hm.get("label"));
checkbox.setSelected("true".equals(hm.get("on")));
checkbox.addActionListener(e -> hm.put("on", checkbox.isSelected() ? "true" : "false"));

if (i < hm.size() - 1) {
gbc.weighty = 0;
}
JPanel modPanel = new JPanel();
modPanel.setLayout(new BoxLayout(modPanel, BoxLayout.Y_AXIS));
modPanel.add(checkbox);

DATA.add(checkbox, gbc);
}
// Beschreibung in kleinerer und kursiver Schrift
JLabel descriptionLabel = new JLabel(" " + hm.get("desc"));
Font currentFont = descriptionLabel.getFont();
descriptionLabel.setFont(currentFont.deriveFont(Font.ITALIC, currentFont.getSize() - 2f));
modPanel.add(descriptionLabel);

centerPanel.add(modPanel, gbc);
}
}
}

gbc.weighty = 1; // Wichtig, um zu gewährleisten, dass Komponenten oben starten und der Platz unten bleibt
centerPanel.add(Box.createGlue(), gbc); // Fügt den Klebstoff hinzu, um den Inhalt zu zentrieren

DATA.add(centerPanel, BorderLayout.CENTER); // Fügt das centerPanel in der Mitte hinzu

speichernButton.addActionListener(e -> {
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.dispose();
});

}

}

4 changes: 2 additions & 2 deletions src/main/java/dev/nachwahl/bteginstaller/ShadersForm.form
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
<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>
<icon value="chest.png"/>
<icon value="lightbulb.png"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
</form>
</form>
Binary file added src/main/resources/anvil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/checkmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/checkmark32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/lightbulb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/notification.wav
Binary file not shown.

0 comments on commit bb73d99

Please sign in to comment.