View Javadoc
1   /**
2    * SpamSchutz - simple way to protect your mail addresses from naïve spammers
3    * Copyright (C) 2011, Aiki IT
4    * <p>
5    * This program is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * <p>
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * <p>
15   * You should have received a copy of the GNU General Public License
16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17   */
18  ///usr/bin/env jbang "$0" "$@" ; exit $?
19  //DEPS org.projectlombok:lombok:1.18.28
20  //DEPS com.google.guava:guava:32.1.2-jre
21  //DEPS org.apache.logging.log4j:log4j-core:3.0.0-alpha1
22  //SOURCES **
23  // how to integrate properties - https://github.com/jbangdev/jbang/issues/1665
24  //FILES ../../../../resources/spamprotector.properties
25  //FILES ../../../../resources/spamprotector_en.properties
26  // https://github.com/jbangdev/jbang/issues/1666 - adding as file is not working
27  
28  // #94: including as SOURCE yields compile error as package does not seem to match
29  /*SOURCEs ../../../../resources/Version.java */
30  /* FILES de.aikiit.spamprotector.util.Version.java=../../../../resources/Version.java */
31  
32  package de.aikiit.spamprotector;
33  
34  import lombok.AccessLevel;
35  import lombok.NoArgsConstructor;
36  
37  import javax.swing.*;
38  import java.awt.*;
39  
40  import static de.aikiit.spamprotector.util.LocalizationHelper.getBundleString;
41  
42  /**
43   * Application starter class.
44   */
45  @NoArgsConstructor(access = AccessLevel.PRIVATE)
46  public final class AntiSpamApplication {
47  
48      /**
49       * Helper that starts and initializes the application itself.
50       */
51      private static void initApplication() {
52          SwingUtilities.invokeLater(
53                  () -> {
54                      JFrame frame = new JFrame();
55                      GUI g = new GUI();
56                      frame.setTitle(getBundleString("spamschutz.main.title"));
57                      frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
58                      frame.setSize(new Dimension(800, 300));
59                      frame.add(g);
60                      frame.setVisible(true);
61                  }
62          );
63      }
64  
65      /**
66       * Main method that loads the application in a proper size.
67       *
68       * @param args Arguments from console.
69       */
70      public static void main(final String[] args) {
71          initApplication();
72      }
73  }