Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package proiect_individual_0;
- import java.awt.*;
- import java.awt.event.*;
- import java.util.ArrayList;
- public class GUI{
- TextField t1, t2;
- Frame f = new Frame("Rute");
- Button a1, a2, a3, a4, a5, a6, a7;
- //Constructorul care se apeleaza in main si in care sunt incluse elementele principale
- GUI(){
- initiateAll();
- f.setSize(700, 400);
- f.setLayout(null);
- f.setVisible(true);
- }
- //initierea fiecarui buton aparte
- void initiateA1(){
- a1 = new Button ("Task (a)");
- //marimile butonului
- a1.setBounds(100, 100, 225, 70);
- //actiunea butonului
- a1.addActionListener ( new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- void initiateA2(){
- a2 = new Button ("Task (b)");
- //marimile butonului
- a2.setBounds(375, 100, 200, 70);
- //actiunea butonului
- a2.addActionListener ( new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- void initiateA3(){
- a3 = new Button ("Task (c)");
- //marimile butonului
- a3.setBounds(100, 220, 100, 70);
- //actiunea butonului
- a3.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- void initiateA4(){
- a4 = new Button ("Task (d)");
- //marimile butonului
- a4.setBounds(200, 220, 100, 70);
- //actiunea butonului
- a4.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- void initiateA5(){
- a5 = new Button ("Task (e)");
- //marimile butonului
- a5.setBounds(300, 220, 100, 70);
- //actiunea butonului
- a5.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- void initiateA6(){
- a6 = new Button ("Task (f)");
- //marimile butonului
- a6.setBounds(400, 220, 100, 70);
- //actiunea butonului
- a6.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- void initiateA7(){
- a7 = new Button ("Task (g)");
- //marimile butonului
- a7.setBounds(500, 220, 100, 70);
- //actiunea butonului
- a7.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- dialogA();
- }
- });
- }
- //unirea initierilor intr-o functie si adaugarea lor in fereastra principala
- void initiateAll(){
- initiateA1();
- initiateA2();
- initiateA3();
- initiateA4();
- initiateA5();
- initiateA6();
- initiateA7();
- f.add(a1);
- f.add(a2);
- f.add(a3);
- f.add(a4);
- f.add(a5);
- f.add(a6);
- f.add(a7);
- }
- void dialogA(){
- Dialog d;
- Frame f = new Frame();
- d = new Dialog(f , "Introducerea a date noi", true);
- d.setLayout(null);
- TextField tf0, tf1, tf2, tf3, tf4, tf5, tf6, tf7, tf8, tf9, tf10;
- tf0 = new TextField(); tf0.setBounds(125, 100, 150, 20);
- tf1 = new TextField(); tf1.setBounds(125, 140, 150, 20);
- tf2 = new TextField(); tf2.setBounds(125, 160, 150, 20);
- tf3 = new TextField(); tf3.setBounds(125, 180, 150, 20);
- tf4 = new TextField(); tf4.setBounds(125, 200, 150, 20);
- tf5 = new TextField(); tf5.setBounds(125, 200, 150, 20);
- tf6 = new TextField(); tf6.setBounds(125, 200, 150, 20);
- /*b0.addActionListener(new ActionListener()
- {
- public void actionPerformed( ActionEvent e )
- {
- d.setVisible(false);
- }
- }); */
- d.add(tf0);
- String text = tf0.getText().toString();
- d.setSize(300, 500);
- d.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement