1
0

Maven dołącza do JAR'a niezbędne zależności.

Poprawki w kodzie
This commit is contained in:
2014-06-14 20:48:02 +01:00
parent 11c7716d95
commit afd44baba9
2 changed files with 80 additions and 38 deletions

92
pom.xml
View File

@@ -8,40 +8,13 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<name>ksiazka-kucharska</name> <name>ksiazka-kucharska</name>
<url>http://maven.apache.org</url> <url>http://git.pioder.pl/index.php/p/ksiazka-kucharska</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>ksiazka.kucharska.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@@ -56,4 +29,65 @@
<version>3.7.2</version> <version>3.7.2</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>no_img_recipe.jpg</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>ksiazka.kucharska.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>attached</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>ksiazka.kucharska.App</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

View File

@@ -2,9 +2,11 @@ package ksiazka.kucharska;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.ImageObserver; import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.List; import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
@@ -33,7 +35,7 @@ public class CB_View extends JFrame{
private JLabel lblIngredients = new JLabel("Składniki:"); private JLabel lblIngredients = new JLabel("Składniki:");
private JLabel lblDescription = new JLabel("Opis wykonania:"); private JLabel lblDescription = new JLabel("Opis wykonania:");
private JLabel imgRecipe = new JLabel(""); private JLabel imgRecipe = new JLabel("");
private JLabel lblRecipeTitle = new JLabel("Nazwa przepisu"); private JLabel lblRecipeTitle = new JLabel("Przepis");
private JLabel lblTags = new JLabel("Tagi:"); private JLabel lblTags = new JLabel("Tagi:");
private JFileChooser fcImg = new JFileChooser(); private JFileChooser fcImg = new JFileChooser();
private JScrollPane scrollPane = new JScrollPane(); private JScrollPane scrollPane = new JScrollPane();
@@ -61,7 +63,7 @@ public class CB_View extends JFrame{
splitPane.setLeftComponent(panel); splitPane.setLeftComponent(panel);
txtSearch.setBounds(5, 5, 237, 20); txtSearch.setBounds(5, 5, 237, 20);
txtSearch.setColumns(10); txtSearch.setColumns(10);
scrollPane_2.setBounds(5, 30, 237, 453); scrollPane_2.setBounds(5, 30, 237, 448);
scrollPane_2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane_2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane_2.setMaximumSize(new Dimension(100, 100)); scrollPane_2.setMaximumSize(new Dimension(100, 100));
@@ -97,9 +99,15 @@ public class CB_View extends JFrame{
fcImg.addChoosableFileFilter(new FileNameExtensionFilter("Pliki PNG", "png")); fcImg.addChoosableFileFilter(new FileNameExtensionFilter("Pliki PNG", "png"));
fcImg.setAcceptAllFileFilterUsed(false); fcImg.setAcceptAllFileFilterUsed(false);
fcImg.setFileFilter(ffAll); fcImg.setFileFilter(ffAll);
imgDefaultRecipe = new ImageIcon("no_img_recipe.jpg"); try {
BufferedImage bi = ImageIO.read(getClass().getResource("/no_img_recipe.jpg"));
imgDefaultRecipe = new ImageIcon(bi);
imgRecipe.setIcon(imgDefaultRecipe); imgRecipe.setIcon(imgDefaultRecipe);
bi.flush();
}
catch (IOException e) {
e.printStackTrace();
}
btnLoadImg.setVisible(false); btnLoadImg.setVisible(false);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
@@ -136,9 +144,9 @@ public class CB_View extends JFrame{
panel.add(txtSearch); panel.add(txtSearch);
panel.add(scrollPane_2); panel.add(scrollPane_2);
btnAddRecipe.setBounds(5, 486, 116, 25); btnAddRecipe.setBounds(5, 481, 116, 25);
panel.add(btnAddRecipe); panel.add(btnAddRecipe);
btnDelRecipe.setBounds(125, 486, 116, 25); btnDelRecipe.setBounds(125, 481, 116, 25);
panel.add(btnDelRecipe); panel.add(btnDelRecipe);
panel.add(txtSearch); panel.add(txtSearch);
panel_2.add(btnSave); panel_2.add(btnSave);