package alphabet;
import alphabet.frame.MyFrame;
/**
*
* @author Сергей
*/
public class Alphabet {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
MyFrame frame = new MyFrame();
frame.setVisible(true);
}
}
package alphabet.frame;
import alphabet.panel.MyPanel;
import java.awt.*;
import javax.swing.*;
/**
*
* @author Сергей
*/
public final class MyFrame extends JFrame {
private final MyPanel mypanel = new MyPanel();
public MyFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension dimension = toolkit.getScreenSize();
setBounds(dimension.width / 2 - 800, dimension.height / 2 - 400, 1600, 800);
setResizable(false);
add(mypanel);
}
}
package alphabet.panel;
import java.awt.*;
import javax.swing.*;
/**
*
* @author Сергей
*/
public final class MyPanel extends JPanel {
private MyButton button = new MyButton();
public MyPanel() {
setCursor(new Cursor(Cursor.HAND_CURSOR));
setBackground(Color.MAGENTA);
add(button);
}
}
package alphabet.panel;
import java.awt.*;
import javax.swing.*;
/**
*
* @author Сергей
*/
class MyButton extends JButton {
public MyButton() {
setLayout(new BorderLayout());
setPreferredSize(new Dimension(170, 145));
setIcon(MyImage.IMAGE_A);
}
}
package alphabet.panel;
import javax.swing.*;
/**
*
* @author Сергей
*/
public class MyImage extends ImageIcon {
static final ImageIcon IMAGE_A = new ImageIcon("src\\alphabet\\A.jpg");
}