# data[].attributes.body
Introduction to Java

# data[].attributes.body
Java Basics

# data[].attributes.body
Java Data Structures

# data[].attributes.body
Methods

# data[].attributes.body
Code Bases

# data[].attributes.body
Object-Orientated Programming

# data[].attributes.body
Basics of Git

# data[].attributes.body
Deeper Dive into Git

# data[].attributes.body
Understanding Software Development Process

# data[].attributes.body
Inheritance in Object-Orientated Programming

# data[].attributes.body
Utilities to Read and Write Text Files in Java

# data[].attributes.body
Recursive in Java

# data[].attributes.body
Debugging and Correcting Common Errors Experienced in Java

# data[].attributes.body
Generation of Specific Types of Documentation Required in Software Development

# data[].attributes.body
Use of Design Patterns to Solve Specific Problems or to Perform Specific Tasks in Java

# data[].attributes.body
Agile Technique of Refactoring

# data[].attributes.body
Introduction to Java Swing Components

# data[].attributes.body
Java Swing Layouts

# data[].attributes.body
Using JFrames

# data[].attributes.attachment_link.readable_text
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;

public class JPictureBox extends JComponent {

    private Icon icon = null;
    private final Dimension dimension = new Dimension(100, 100);
    private Image image = null;
    private ImageIcon ii = null;
    private SizeMode sizeMode = SizeMode.STRETCH;
    private int newHeight, newWidth, originalHeight, originalWidth;

    public JPictureBox() {
        JPictureBox.this.setPreferredSize(dimension);
        JPictureBox.this.setOpaque(false);
        JPictureBox.this.setSizeMode(SizeMode.STRETCH);
    }

    @Override
    public void paintComponent(Graphics g) {
        if (ii != null) {
            switch (getSizeMode()) {
                case NORMAL:
                    g.drawImage(image, 0, 0, ii.getIconWidth(), ii.getIconHeight(), null);
                    break;
                case ZOOM:
                    aspectRatio();
                    g.drawImage(image, 0, 0, newWidth, newHeight, null);
                    break;
                case STRETCH:
                    g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), null);
                    break;
                case CENTER:
                    g.drawImage(image, (int) (this.getWidth() / 2) - (int) (ii.getIconWidth() / 2), (int) (this.getHeight() / 2) - (int) (ii.getIconHeight() / 2), ii.getIconWidth(), ii.getIconHeight(), null);
                    break;
                default:
                    g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), null);
            }
        }
    }

    public Icon getIcon() {
        return icon;
    }

    public void setIcon(Icon icon) {
        this.icon = icon;
        ii = (ImageIcon) icon;
        image = ii.getImage();
        originalHeight = ii.getIconHeight();
        originalWidth = ii.getIconWidth();
    }

    public SizeMode getSizeMode() {
        return sizeMode;
    }

    public void setSizeMode(SizeMode sizeMode) {
        this.sizeMode = sizeMode;
    }

    public enum SizeMode {
        NORMAL,
        STRETCH,
        CENTER,
        ZOOM
    }

    private void aspectRatio() {
        if (ii != null) {
            newHeight = this.getHeight();
            newWidth = (originalWidth * newHeight) / originalHeight;
        }
    }
    
    public static void main(String[] args) {
	
    	new JPictureBox();

	}
}

# data[].attributes.body
Interacting with JFrames

# data[].attributes.attachment_link.readable_text
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public abstract class SimpleGUI implements ActionListener {
	
	private int count = 0;
	private JLabel label;
	private JFrame frame;
	private JPanel panel;
	
	public SimpleGUI() {
		
		frame = new JFrame();
		 
		JButton button = new JButton("Click me");
		button.addActionListener(this);
		
		label = new JLabel("Number of clicks: " + count);
		
		panel = new JPanel();
		panel.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
		panel.setLayout(new GridLayout(0, 1));
		panel.add(button);
		panel.add(label);
		frame.add(panel, BorderLayout.CENTER);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setTitle("SimpleGUI");
		frame.pack();
		frame.setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		count ++;
		label.setText("Number of clicks: "+ count);
	}
	
	public static void main(String[] args) {
		
		new SimpleGUI();

	}

}


# data[].attributes.body
MySQL

# data[].attributes.body
Creating a MySQL Database

# data[].attributes.body
Java and Hibernate

# data[].attributes.body
More uses of Hibernate

# data[].attributes.body
Caching

# data[].attributes.body
Hibernate Query Language

# data[].attributes.body
Introduction to the Spring Framework

# data[].attributes.body
More About the Spring Framework

# data[].attributes.body
Spring Event Handling

# data[].attributes.body
The Spring Model-View-Controller Framework

# data[].attributes.body
Inserting Information into Table

# data[].attributes.body
Retrieving Information from a Table