import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame {
JLabel l = new JLabel("zz");
public Main() {
Container c = getContentPane();
setSize(1000, 1000);
setVisible(true);
c.addKeyListener(new MyKeyListener());
c.setLayout(new FlowLayout());
c.add(l);
c.setFocusable(true);
c.requestFocus();
}
class MyKeyListener extends KeyAdapter {
public void keyPressed(KeyEvent e) {
int size = l.getFont().getSize();
if(e.getKeyCode() == 107) {
l.setFont( new Font("Arial", Font.PLAIN, size+5) );
}
else if(e.getKeyCode() == 109) {
if(size-5>5) l.setFont(new Font("Arial", Font.PLAIN, size-5));
}
}
}
public static void main(String[] args) {
new Main();
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
JLabel l = new JLabel("사라하 자바");
public Main() {
setSize(700,700);
setVisible(true);
Container c = getContentPane();
l.addMouseWheelListener(new MyMouseWheelListener());
c.setLayout(new FlowLayout());
c.add(l);
}
class MyMouseWheelListener implements MouseWheelListener{
public void mouseWheelMoved(MouseWheelEvent e) {
int n = e.getWheelRotation();
int size = l.getFont().getSize();
if(n < 0) {
l.setFont( new Font("고딕", Font.PLAIN, size+5) );
}
else {
if(size-5>5) l.setFont(new Font("고딕", Font.CENTER_BASELINE, size-5));
}
}
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
public Main() {
setLayout(new FlowLayout());
Container c = getContentPane();
c.setLayout(new FlowLayout());
JButton b1 = new JButton("Magenta/yellow button");
JButton b2 = new JButton(" disabled butten ");
JButton b3 = new JButton("getx(),gety()");
JButton b4 = new JButton(new ImageIcon("hearts.png"));
JLabel la1 = new JLabel(new ImageIcon("hearts.png"));
b1.setBackground(Color.yellow);
b1.setForeground(Color.magenta);
b1.setFont( new Font("Arial", Font.ITALIC, 20) );
b2.setEnabled(false);
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JButton b = (JButton) e.getSource();
String str =b.getX() + "," + b.getY();
b3.setText(str);
}
});
c.add(b1);
c.add(b2);
c.add(b3);
c.add(b4);
c.add(la1);
setSize(700,700);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame{
public Main() {
setSize(1000,1000);
setLayout(new BorderLayout());
JPanel pd = new JPanel();
pd.setLayout(new FlowLayout());
JButton b2 = new JButton(new ImageIcon("free-icon-right-arrow-109617.png"));
JButton b1 = new JButton(new ImageIcon("free-icon-left-arrow-8167741.png"));
pd.add(b1); pd.add(b2);
add(pd,BorderLayout.SOUTH);
JPanel pc = new JPanel();
pc.setLayout(new FlowLayout());
JLabel l1 = new JLabel(new ImageIcon("free-icon-avatar-1752681.png"));
JLabel l2 = new JLabel(new ImageIcon("free-icon-psyduck-189000.png"));
JLabel l3= new JLabel(new ImageIcon("free-icon-eevee-188995.png"));
JLabel l4 = new JLabel(new ImageIcon("free-icon-pikachu-188939.png"));
pc.add(l1);
add(pc,BorderLayout.CENTER);
setVisible(true);
}
class
public static void main(String[] args) {
new Main();
}
}