Ejemplo n.º 1
0
 public GUI1() {
   JPanel jp = new JPanel(new BorderLayout());
   JPanel jNav = new JPanel(new BorderLayout());
   setTitle("SlideShow");
   setSize(1028, 850);
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   jp.add(jNav, BorderLayout.SOUTH);
   jNav.add(btnClick, BorderLayout.WEST);
   btnClick.addActionListener(this);
   jNav.add(btnClick2, BorderLayout.EAST);
   btnClick2.addActionListener(this);
   jNav.add(btnClick3, BorderLayout.CENTER);
   btnClick3.addActionListener(this);
   getContentPane().add(jp);
   JPanel jPic = new JPanel();
   jp.add(jPic, BorderLayout.CENTER);
 }
Ejemplo n.º 2
0
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g;
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   if (squares == null) {
     initSquares();
   }
   // Draw squares.
   g2.setPaint(Color.blue);
   int t = 0;
   for (int k = 0; k < ROW; k++) {
     for (int i = 0; i < 2; i++) {
       for (int j = 0; j < 4; j++) {
         s[t++] = squares[k][i][j];
         // squares[k][i][j].draw(g2);
         // System.out.println("K: "+k);
       }
     }
   }
   System.out.println("T: " + t);
   for (int b = 0; b < 16000; b++) s[b].draw(g2);
 }