PRO_gramer

ffffff

Nov 29th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.68 KB | None | 0 0
  1. import javax.swing.JButton;
  2. import javax.swing.JFrame;
  3. import javax.swing.JPanel;
  4. import java.awt.*;
  5.  
  6.  
  7. public class EMULATOR {
  8.     public static void main(String[] args){
  9.         JFrame frame = new JFrame();
  10.         Container west = new JPanel(new BorderLayout());
  11.         JPanel p =new JPanel();
  12.         JPanel p2 = new JPanel();
  13.         JPanel p3 = new JPanel();
  14.         west.add(p,BorderLayout.WEST);
  15.         west.add(p2,BorderLayout.EAST);
  16.         west.add(p3,BorderLayout.CENTER);
  17.         frame.getContentPane().add(west);
  18.        
  19.        
  20.         /*teclas de direção*/
  21.         JButton botão = new JButton("A");
  22.         botão.setBackground(Color.gray);
  23.         JButton botão2 = new JButton("V");
  24.         botão2.setBackground(Color.red);
  25.         JButton botão3 = new JButton("<");
  26.         botão3.setBackground(Color.blue);
  27.         JButton botão4 = new JButton(">");
  28.         botão4.setBackground(Color.green);
  29.         /*##########################################*/
  30.         /*outras teclas*/
  31.         JButton botão5 = new JButton("X");
  32.         botão5.setBackground(Color.red);
  33.         JButton botão6 = new JButton("O");
  34.         botão6.setBackground(Color.green);
  35.         JButton botão7 = new JButton("H");
  36.         botão7.setBackground(Color.gray);
  37.         JButton botão8 =  new JButton("A");
  38.         botão8.setBackground(Color.blue);
  39.         /*adicionando os de direção*/
  40.         p.setLayout(new BorderLayout());
  41.         p.add(botão,BorderLayout.NORTH);
  42.         p.add(botão2,BorderLayout.SOUTH);
  43.         p.add(botão3,BorderLayout.WEST);
  44.         p.add(botão4,BorderLayout.EAST);
  45.         /*novos botões*/
  46.         p2.setLayout(new BorderLayout());
  47.         p2.add(botão5,BorderLayout.NORTH);
  48.         p2.add(botão6,BorderLayout.SOUTH);
  49.         p2.add(botão7,BorderLayout.WEST);
  50.         p2.add(botão8,BorderLayout.EAST);
  51.        
  52.        
  53.         frame.pack();
  54.        
  55.         frame.setVisible(true);
  56.        
  57.        
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment