Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- /**
- *
- * @author dubstep
- */
- public class Main extends javax.swing.JFrame {
- /**
- * Creates new form Main
- */
- public Main() {
- 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() {
- Prev = new javax.swing.JButton();
- Next = new javax.swing.JButton();
- ImgLab = new javax.swing.JLabel();
- iG = new IcoGen();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- Prev.setText("Prev");
- Prev.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- PrevActionPerformed(evt);
- }
- });
- Next.setText("Next");
- Next.setToolTipText("");
- Next.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- NextActionPerformed(evt);
- }
- });
- ImgLab.setText("Img here");
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(Prev, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
- .addComponent(Next, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addComponent(ImgLab, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(ImgLab, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(Prev, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(Next, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
- );
- pack();
- }// </editor-fold>
- public void nextSlide(int currentSlide) {
- if (currentSlide < iG.icons.length - 1) {
- currentSlide++;
- ImgLab.setIcon(iG.icons[currentSlide]);
- }
- }
- public void PrevSlide(int currentSlide) {
- if (currentSlide < iG.icons.length - 1) {
- currentSlide--;
- ImgLab.setIcon(iG.icons[currentSlide]);
- }
- }
- private void PrevActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- PrevSlide(currentSlide);
- }
- private void NextActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- nextSlide(currentSlide);
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) throws IOException {
- /* 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
- */
- IcoGen IcoG = new IcoGen();
- IcoG.ListFiles();
- IcoG.writeToFile();
- IcoG.icoRead();
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new Main().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JLabel ImgLab;
- private javax.swing.JButton Next;
- private javax.swing.JButton Prev;
- private int currentSlide = -1;
- private IcoGen iG;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment