Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Andrew Lalis | 5450f69c3b | |
Andrew Lalis | 7735602a2c |
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>nl.andrewlalis</groupId>
|
||||
<artifactId>BlockBookBinder</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<version>1.3.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package nl.andrewlalis.blockbookbinder;
|
||||
|
||||
import com.formdev.flatlaf.FlatDarkLaf;
|
||||
import nl.andrewlalis.blockbookbinder.util.VersionReader;
|
||||
import nl.andrewlalis.blockbookbinder.view.MainFrame;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -10,8 +9,6 @@ import javax.swing.*;
|
|||
* The main class for the application.
|
||||
*/
|
||||
public class BlockBookBinder {
|
||||
public static final String VERSION = VersionReader.getVersion();
|
||||
|
||||
public static void main(String[] args) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
FlatDarkLaf.setup();
|
||||
|
|
|
@ -8,6 +8,7 @@ import nl.andrewlalis.blockbookbinder.view.SourceTextPanel;
|
|||
import nl.andrewlalis.blockbookbinder.view.book.BookPreviewPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class CompileFromSourceAction extends AbstractAction {
|
||||
|
@ -26,6 +27,15 @@ public class CompileFromSourceAction extends AbstractAction {
|
|||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String text = this.sourceTextPanel.getSourceText();
|
||||
if (text.isBlank()) {
|
||||
JOptionPane.showMessageDialog(
|
||||
SwingUtilities.getWindowAncestor((Component) e.getSource()),
|
||||
"No source text to compile.\nEnter some text into the \"Source Text\" panel first.",
|
||||
"No Source Text",
|
||||
JOptionPane.WARNING_MESSAGE
|
||||
);
|
||||
} else {
|
||||
this.bookPreviewPanel.setBook(
|
||||
new BookBuilder(
|
||||
ApplicationProperties.getIntProp("book.page_max_lines"),
|
||||
|
@ -35,3 +45,4 @@ public class CompileFromSourceAction extends AbstractAction {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package nl.andrewlalis.blockbookbinder.util;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class VersionReader {
|
||||
public static String getVersion() {
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
try {
|
||||
Model model;
|
||||
if ((new File("pom.xml")).exists()) {
|
||||
model = reader.read(new FileReader("pom.xml"));
|
||||
} else {
|
||||
model = reader.read(new InputStreamReader(
|
||||
VersionReader.class.getResourceAsStream("/META-INF/maven/nl.andrewlalis/BlockBookBinder/pom.xml")
|
||||
));
|
||||
}
|
||||
return model.getVersion();
|
||||
} catch (IOException | XmlPullParserException e) {
|
||||
e.printStackTrace();
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package nl.andrewlalis.blockbookbinder.view;
|
||||
|
||||
import nl.andrewlalis.blockbookbinder.BlockBookBinder;
|
||||
import nl.andrewlalis.blockbookbinder.control.export.ExportBookToMinecraftAction;
|
||||
import nl.andrewlalis.blockbookbinder.control.source.CleanSourceAction;
|
||||
import nl.andrewlalis.blockbookbinder.control.source.CompileFromSourceAction;
|
||||
|
@ -22,7 +21,7 @@ public class MainFrame extends JFrame {
|
|||
ApplicationProperties.getIntProp("frame.default_width"),
|
||||
ApplicationProperties.getIntProp("frame.default_height")
|
||||
));
|
||||
this.setTitle(ApplicationProperties.getProp("frame.title") + " Version " + BlockBookBinder.VERSION);
|
||||
this.setTitle(ApplicationProperties.getProp("frame.title") + " Version " + ApplicationProperties.getProp("version"));
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
final URL iconUrl = this.getClass().getClassLoader().getResource("images/book_and_quill.png");
|
||||
if (iconUrl != null) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version=1.3.0
|
||||
version=1.3.1
|
||||
|
||||
# Settings for the application's GUI.
|
||||
frame.title=Block Book Binder
|
||||
|
|
Loading…
Reference in New Issue