Browse Source

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

Poprawki w kodzie
master
Piotr Dergun 10 years ago
parent
commit
afd44baba9
2 changed files with 68 additions and 26 deletions
  1. +52
    -18
      pom.xml
  2. +16
    -8
      src/main/java/ksiazka/kucharska/CB_View.java

+ 52
- 18
pom.xml View File

@ -8,15 +8,39 @@
<packaging>jar</packaging>
<name>ksiazka-kucharska</name>
<url>http://maven.apache.org</url>
<url>http://git.pioder.pl/index.php/p/ksiazka-kucharska</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>.</directory>
<includes>
<include>no_img_recipe.jpg</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
@ -25,7 +49,7 @@
<target>${jdk.version}</target>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@ -37,23 +61,33 @@
</manifest>
</archive>
</configuration>
</plugin>
</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>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
</dependency>
</dependencies>
</project>

+ 16
- 8
src/main/java/ksiazka/kucharska/CB_View.java View File

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

Loading…
Cancel
Save