Browse Source

Poprawki stylistyczne

master
Grzegorz 10 years ago
parent
commit
a35e8b4d44
5 changed files with 7 additions and 14 deletions
  1. +1
    -1
      .classpath
  2. +3
    -3
      .settings/org.eclipse.jdt.core.prefs
  3. BIN
      cookbook.db
  4. +0
    -4
      src/main/java/db/Cookbook.java
  5. +3
    -6
      src/main/java/ksiazka/kucharska/FrmMain.java

+ 1
- 1
.classpath View File

@ -12,7 +12,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
@ -20,5 +19,6 @@
</classpathentry>
<classpathentry kind="lib" path="miglayout15-swing.jar" sourcepath="miglayout-src.zip"/>
<classpathentry kind="lib" path="forms-1.3.0.jar" sourcepath="forms-1.3.0-src.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

+ 3
- 3
.settings/org.eclipse.jdt.core.prefs View File

@ -1,12 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.5

BIN
cookbook.db View File


+ 0
- 4
src/main/java/db/Cookbook.java View File

@ -55,13 +55,9 @@ public class Cookbook {
public boolean insertRecipe(String name, String ingredients, String description, String tags, ImageIcon img) {
try {
//przekształcam ImageIcon -> BuforowanyImg
BufferedImage bImg = new BufferedImage(img.getIconWidth(), img.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
bImg.getGraphics().drawImage(img.getImage(), 0,0, null);
//tworzę strumień bajtowy
ByteArrayOutputStream bStream = new ByteArrayOutputStream();
//zapisuję do strumienia bufor obrazka
ImageIO.write( bImg, "png", bStream );
bStream.flush();

+ 3
- 6
src/main/java/ksiazka/kucharska/FrmMain.java View File

@ -11,6 +11,7 @@ import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JButton;
import javax.swing.JTextField;
@ -47,7 +48,7 @@ public class FrmMain extends JFrame {
private static final long serialVersionUID = 2634383304749703669L;
private JPanel contentPane;
private JTextField txtSearch;
public static JTextField txtEdTitle;
public static JTextField txtEdTitle;
public static JTextField txtTags;
private JButton btnSave;
private JButton btnCancel;
@ -93,8 +94,6 @@ public class FrmMain extends JFrame {
lblRecipeTitle.setVisible(false);
recipesList.setEnabled(false);
imgRecipe.setIcon(imgDefaultRecipe);
//czyszczenie pól formularza
txtDescription.setText("");
txtEdTitle.setText("");
txtIngredients.setText("");
@ -287,14 +286,12 @@ public class FrmMain extends JFrame {
btnLoadImg.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
//otwórz okno dialogowe
int returnVal = fcImg.showOpenDialog(FrmMain.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fcImg.getSelectedFile();
try {
BufferedImage srcImg = ImageIO.read(file); //czytaj plik
BufferedImage srcImg = ImageIO.read(file);
//wyznacz szerokość obrazka jako stosunek (przy maksymalizacji wysokości
int w = (int)Math.ceil(srcImg.getWidth()/(double)srcImg.getHeight()*imgRecipe.getHeight());
BufferedImage resizedImg = new BufferedImage(w, imgRecipe.getHeight(), BufferedImage.TYPE_INT_ARGB);

Loading…
Cancel
Save