|
|
@ -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); |
|
|
|