Sanady

Untitled

Mar 16th, 2018
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javaapplication6;
  7. import java.awt.*;
  8. /**
  9.  *
  10.  * @author xrener
  11.  */
  12. public class JavaApplication6 {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args) {
  18.         Frame frame = new Frame();
  19.         frame.setSize(300, 300);
  20.        
  21.         Panel panel1 = new Panel(); // vytvaranie objektu
  22.         Panel panel2 = new Panel();
  23.         Panel panel3 = new Panel();
  24.    
  25.         Button tla1 = new Button("Tlacidlo 1");
  26.         Button tla2 = new Button("Tlacidlo 2");
  27.         Button tla3 = new Button("Tlacidlo 3");
  28.         Button tla4 = new Button("Tlacidlo 4");
  29.    
  30.         panel1.add(tla1);
  31.         panel1.add(tla2);
  32.         panel1.add(tla3);
  33.         panel1.add(tla4);
  34.        
  35.         Label label = new Label("Ahoj ako sa mas");
  36.         Canvas platno = new Canvas();
  37.         platno.setSize(200, 200);
  38.         panel2.add(platno, BorderLayout.NORTH);
  39.         panel2.add(label, BorderLayout.SOUTH);
  40.        
  41.         Button tla5 = new Button("OK");
  42.         Button tla6 = new Button("CANCEL");
  43.         panel3.setLayout(new GridLayout(1, 2));
  44.         panel3.add(tla5); //1. riadok 1.stlpca
  45.         panel3.add(tla6); //1. riadok, 2.stlpca
  46.        
  47.         frame.add(panel1, BorderLayout.NORTH);
  48.         frame.add(panel2, BorderLayout.CENTER);
  49.         frame.add(panel3, BorderLayout.SOUTH);
  50.        
  51.         frame.setVisible(true);
  52.     }
  53.    
  54. }
Advertisement
Add Comment
Please, Sign In to add comment