Documente Academic
Documente Profesional
Documente Cultură
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
*
* @author Riska
*/
public class citra1 extends javax.swing.JFrame {
/**
* Creates new form citra1
*/
BufferedImage image=null;
BufferedImage image4=null;
BufferedImage image5=null;
BufferedImage image6=null;
BufferedImage image7=null;
BufferedImage image8=null;
int width;
int height;
String scrIm = "dora.jpg";
private Object grayScale;
public citra1() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Load");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Copy");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Flip H");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Grayscale");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("Flip V");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setText("Rotate 90'");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton7.setText("Rotate 180'");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 190,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(290, 290, 290))
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 371,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(42, 42, 42)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 91,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 86,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 86,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 83,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton7))
.addGroup(layout.createSequentialGroup()
pack();
}// </editor-fold>
ImageIcon imageIcon6;
imageIcon6 = new ImageIcon(imageFlip);
jLabel3.setIcon(imageIcon6);
} catch (IOException ex) {
Logger.getLogger(citra1.class.getName()).log(Level.SEVERE,null, ex);
}
}
try {
image4 = ImageIO.read(input);
width = image4.getWidth();
height = image4.getHeight();
ImageIcon imageIcon4;
imageIcon4 = new ImageIcon(imageFlip);
jLabel3.setIcon(imageIcon4);
} catch (IOException ex) {
Logger.getLogger(citra1.class.getName()).log(Level.SEVERE,null, ex);
}
}
}
ImageIcon imageIcon8;
imageIcon8 = new ImageIcon(grayScale);
jLabel3.setIcon(imageIcon8);
} catch (IOException ex) {
Logger.getLogger(citra1.class.getName()).log(Level.SEVERE,null, ex);
}
}
height = image5.getHeight();
ImageIcon imageIcon5;
imageIcon5 = new ImageIcon(imageFlip);
jLabel3.setIcon(imageIcon5);
} catch (IOException ex) {
Logger.getLogger(citra1.class.getName()).log(Level.SEVERE,null, ex);
}
}
ImageIcon imageIcon7;
imageIcon7 = new ImageIcon(imageFlip);
jLabel3.setIcon(imageIcon7);
} catch (IOException ex) {
Logger.getLogger(citra1.class.getName()).log(Level.SEVERE,null, ex);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}