/
CreditsDialog.java
105 lines (90 loc) · 3.38 KB
/
CreditsDialog.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package at.vintagestory.modelcreator.gui;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
public class CreditsDialog
{
public static void show(JFrame parent)
{
JPanel container = new JPanel(new BorderLayout(20, 10));
container.setBorder(new EmptyBorder(10, 10, 10, 10));
JPanel leftPanel = new JPanel(new BorderLayout());
JLabel title = new JLabel("<html><span style=\"font-size:16px;\"><b>Vintage Story Model Creator</b></span><br>based on MrCrayfishs Model Creator for Minecraft</html>");
leftPanel.add(title, BorderLayout.NORTH);
JLabel message = new JLabel();
message.setText("<html>All praise for this program should go to MrCrayFish for making this awesome and simply to use tool "
+ "originally for Minecraft. He open sourced it and so Tyron took the freedom to adjust it to his needs for Vintage Story. "
+ "If you like this program, show some love to MrCrayFish! <3<br><br>Some of the features added by tyron:<br>- Animations & Keyframe Editor, Gif Animation Exporter<br>- Undo/Redo capability<br>- More Streamlined loading&saving system<br>- Drag&Drop loading of models and textures<br>- Texture autoreload<br>- Entity Texture mode with box-uv-auto-unwrap<br>- UV Map exporter<br>- Attachment point editor</html>");
leftPanel.add(message, BorderLayout.CENTER);
container.add(leftPanel, BorderLayout.CENTER);
JPanel btnGrid = new JPanel(new GridLayout(1, 4, 5, 0));
JButton btnDonate = new JButton("Donate");
btnDonate.setIcon(Icons.coin);
btnDonate.addActionListener(a ->
{
openUrl("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HVXLDWFN4MNA2");
});
btnGrid.add(btnDonate);
JButton btnTwitter = new JButton("Twitter");
btnTwitter.setIcon(Icons.twitter);
btnTwitter.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent arg0)
{
openUrl("https://www.twitter.com/MrCraayfish");
}
});
btnGrid.add(btnTwitter);
JButton btnFacebook = new JButton("Facebook");
btnFacebook.setIcon(Icons.facebook);
btnFacebook.addActionListener(a ->
{
openUrl("https://www.facebook.com/MrCrayfish");
});
btnGrid.add(btnFacebook);
JButton btnClose = new JButton("Close");
btnClose.addActionListener(a ->
{
SwingUtilities.getWindowAncestor(btnClose).dispose();
});
btnGrid.add(btnClose);
// container.add(header, BorderLayout.NORTH);
container.add(btnGrid, BorderLayout.SOUTH);
JDialog dialog = new JDialog(parent, "Credits", false);
// dialog.setLayout(new BorderLayout());
dialog.setResizable(false);
dialog.setPreferredSize(new Dimension(500, 390));
dialog.add(container);
dialog.pack();
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
dialog.requestFocusInWindow();
}
private static void openUrl(String url)
{
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE))
{
try
{
desktop.browse(new URL(url).toURI());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}