コード例 #1
0
ファイル: Counterl.java プロジェクト: hulibal/JavaLearning
 public void init() {
   add(t);
   start.addActionListener(new StartL());
   add(start);
   onOff.addActionListener(new OnOffL());
   add(onOff);
 }
コード例 #2
0
ファイル: First_GUI.java プロジェクト: head1km/CMU-Coursework
  // TextArea Text;
  public void init() {

    // Tell the applet not to use a layout manager.
    setSize(500, 500);
    setLayout(null);

    // initialze the button and give it a text.
    Rubric = new Button("Rubric Editor");
    GradeSheet = new Button("Grade Sheet Editor");
    TextArea text = new TextArea("Please Choose one of the following");

    // now we will specify the positions of the GUI components.
    // this is done by specifying the x and y coordinate and
    // the width and height.
    Rubric.setBounds(100, 275, 100, 30);
    GradeSheet.setBounds(230, 275, 150, 30);
    text.setBounds(100, 225, 300, 50);
    text.setEditable(false);
    (text).getScrollbarVisibility();
    // now that all is set we can add these components to the applet
    add(text);
    add(Rubric);
    add(GradeSheet);
    Rubric.addActionListener(this);
    GradeSheet.addActionListener(this);
  }
コード例 #3
0
ファイル: ButtonPressed.java プロジェクト: UniconTextLab/JAVA
  // Label lyes,lno;
  public void init() {
    byes = new Button("Yes");
    bno = new Button("No");
    add(byes);
    add(bno);

    bno.addActionListener(this);
    byes.addActionListener(this);
  }
コード例 #4
0
 public void init() {
   tekstvak = new TextField("", 30);
   knop = new Button("Ok");
   knop2 = new Button("Reset");
   knop.addActionListener(new KnopListener2());
   knop2.addActionListener(new KnopListener());
   add(tekstvak);
   add(knop);
   add(knop2);
 }
コード例 #5
0
  /** Method declaration */
  private void initGUI() {

    Panel pQuery = new Panel();
    Panel pCommand = new Panel();

    pResult = new Panel();

    pQuery.setLayout(new BorderLayout());
    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new TextArea(5, 40);

    txtCommand.addKeyListener(this);

    txtResult = new TextArea(20, 40);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

    butExecute = new Button("Execute");
    butClear = new Button("Clear");

    butExecute.addActionListener(this);
    butClear.addActionListener(this);
    pCommand.add("East", butExecute);
    pCommand.add("West", butClear);
    pCommand.add("Center", txtCommand);

    gResult = new Grid();

    setLayout(new BorderLayout());
    pResult.add("Center", gResult);
    pQuery.add("North", pCommand);
    pQuery.add("Center", pResult);
    fMain.add("Center", pQuery);

    tTree = new Tree();

    // (ulrivo): screen with less than 640 width
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

    if (d.width >= 640) {
      tTree.setMinimumSize(new Dimension(200, 100));
    } else {
      tTree.setMinimumSize(new Dimension(80, 100));
    }

    gResult.setMinimumSize(new Dimension(200, 300));
    fMain.add("West", tTree);
    doLayout();
    fMain.pack();
  }
コード例 #6
0
 //
 // Constructor.
 //
 public ReloginPanel(VncViewer v) {
   viewer = v;
   setLayout(new FlowLayout(FlowLayout.CENTER));
   reloginButton = new Button("Login again");
   add(reloginButton);
   reloginButton.addActionListener(this);
   if (viewer.inSeparateFrame) {
     closeButton = new Button("Close window");
     add(closeButton);
     closeButton.addActionListener(this);
   }
 }
コード例 #7
0
  public void init() {
    barka = new TextField("", 6);
    add(barka);
    knop = new Button("OK");
    add(knop);
    knop.addActionListener(new Bountalinstener());
    barka.addActionListener(new Bountalinstener());

    mitchelendaniel = new Button("resest");
    add(mitchelendaniel);
    mitchelendaniel.addActionListener(new Barkalistener());
  }
コード例 #8
0
ファイル: H801.java プロジェクト: sergio102/h8
 {
   tekstvak = new TextField("", 30);
   knop = new Button("ok");
   knop.addActionListener(new KnopListener());
   add(tekstvak);
   add(knop);
 }
コード例 #9
0
  {
    removeFromContactList.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            try {
              String cl = contactList.getText();
              for (; ; ) {
                int pos = cl.indexOf(contactListEntry.getText());
                if (pos == -1) break;
                cl = cl.substring(0, pos) + cl.substring(pos + contactListEntry.getText().length());
              }
              for (; ; ) {
                int pos = cl.indexOf("\n\n");
                if (pos == -1) break;
                cl = cl.substring(0, pos) + cl.substring(pos + "\n\n".length());
              }
              if (cl.startsWith("\n")) cl = cl.substring("\n".length());
              if (cl.endsWith("\n")) cl = cl.substring(0, cl.length() - "\n".length());
              contactList.setText(cl);

              //
              plugin.removeFromContactList(getMyLoginId(), contactListEntry.getText());
            } catch (Throwable tr) {
              printException(tr);
            }
          }
        });
  }
コード例 #10
0
  public void init() {
    colorNo = 0;
    Button b = new Button("change");
    b.addActionListener(this);
    add(b);

    addMouseListener(this);
  }
コード例 #11
0
 public void init() {
   a = new TextArea("", 15, 50);
   add(a);
   Button t = new Button("Translate");
   add(t);
   b = new TextArea("", 15, 50);
   add(b);
   t.addActionListener(this);
 }
コード例 #12
0
 {
   closeBtn.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent ev) {
           try {
             quit();
           } catch (Throwable tr) {
             CAT.error("exception", tr);
           }
         }
       });
 }
コード例 #13
0
 private Button getSendContactsButton() {
   if (sendContactsButton == null) {
     sendContactsButton = new Button("send random contacts");
     sendContactsButton.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             sendContacts();
           }
         });
   }
   return sendContactsButton;
 }
コード例 #14
0
 {
   loginBtn.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent ev) {
           new Thread("icqtest/login button handler") {
             public void run() {
               try {
                 login();
               } catch (Throwable tr) {
                 CAT.error("exception", tr);
               }
             }
           }.start();
         }
       });
 }
コード例 #15
0
 private Button getUserDetailsButton() {
   if (userDetailsButton == null) {
     userDetailsButton = new Button("user info");
     userDetailsButton.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             try {
               fetchUserDetails();
             } catch (Throwable tr) {
               CAT.error("exception", tr);
             }
           }
         });
   }
   return userDetailsButton;
 }
コード例 #16
0
ファイル: Deta_Ventas_r.java プロジェクト: evangx/POS-store
  public Deta_Ventas_r() {
    setBackground(Color.gray);
    setLayout(null);
    setSize(400, 400);
    l1 = new Label(" clave ");
    t1 = new TextField(36);
    l2 = new Label("Vendedor");
    t2 = new TextField(20);

    l3 = new Label("Cliente");
    t3 = new TextField(20);
    l4 = new Label("Fechas");
    t4 = new TextField(5);
    l5 = new Label("monto_final");
    t5 = new TextField(5);
    t4.setEditable(false);
    t5.setEditable(false);
    b = new Button("Registrar");
    add(l1);
    add(t1);
    add(l2);
    add(t2);
    add(l3);
    add(t3);
    add(l4);
    add(t4);
    add(l5);
    add(t5);
    add(b);
    l1.setBounds(24, 75, 71, 23);
    l2.setBounds(24, 103, 90, 23);
    l3.setBounds(24, 131, 90, 23);
    l4.setBounds(24, 159, 90, 23);
    l5.setBounds(24, 185, 90, 23);
    t1.setBounds(114, 75, 270, 23);
    t2.setBounds(114, 103, 270, 23);
    t3.setBounds(114, 131, 270, 23);
    t4.setBounds(114, 159, 270, 23);
    t5.setBounds(114, 185, 270, 23);
    b.setBounds(167, 215, 65, 23);
    b.addActionListener(this);
    setUndecorated(true);
    setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - 200, 50);
    start();
  }
コード例 #17
0
ファイル: main.java プロジェクト: spiralcode/applet_bmi
 public void init() {
   setLayout(new GridLayout(4, 4));
   check = new Button("Check");
   height = new TextField();
   weight = new TextField();
   result = new TextField();
   l1 = new Label("Height in Centimeters ");
   l2 = new Label("Weight in Kilogram");
   l3 = new Label("Index Value");
   not = new Label("Status");
   not.setBackground(Color.black);
   Font notf = new Font("Arial", Font.BOLD, 30);
   not.setFont(notf);
   add(l1);
   add(height);
   add(l2);
   add(weight);
   add(l3);
   add(result);
   add(check);
   add(not);
   check.addActionListener(this);
 }
コード例 #18
0
import java.applet.*;
コード例 #19
0
ファイル: Tetris.java プロジェクト: akash-vartak/Tetris
  public void init() {
    sounds = new TetrisSound();
    installNewPiece();

    pause_resume_butt.setEnabled(false);
    start_newgame_butt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (start_newgame_butt.getLabel().equals("Start")) startGame();
            else newGame();
          }
        });
    pause_resume_butt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (pause_resume_butt.getLabel().equals("Pause")) pauseGame();
            else resumeGame();
          }
        });

    KeyListener key_listener =
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (timer.isPaused()) return;
            if (e.getKeyCode() == 37 || e.getKeyCode() == 39) {
              int dir = e.getKeyCode() == 37 ? -1 : 1;
              synchronized (timer) {
                cur_piece.cut();
                cur_piece.setX(cur_piece.getX() + dir);
                if (!cur_piece.canPaste()) cur_piece.setX(cur_piece.getX() - dir);
                cur_piece.paste();
              }
              game_grid.repaint();
            } else if (e.getKeyCode() == 38) {
              synchronized (timer) {
                cur_piece.cut();
                cur_piece.rotate();
                if (!cur_piece.canPaste()) cur_piece.rotateBack();
                cur_piece.paste();
              }
              game_grid.repaint();
            }
            if (e.getKeyCode() == 40) {
              timer.setFast(true);
            }
          }
        };

    start_newgame_butt.addKeyListener(key_listener);
    pause_resume_butt.addKeyListener(key_listener);

    Panel right_panel = new Panel(new GridLayout(3, 1));
    right_panel.setBackground(BACKGROUND_COLOR);

    Panel control_panel = new Panel();
    control_panel.add(start_newgame_butt);
    control_panel.add(pause_resume_butt);
    control_panel.setBackground(BACKGROUND_COLOR);
    right_panel.add(control_panel);

    Panel tmp = new Panel(new BorderLayout());
    tmp.add("North", new TetrisLabel("    Next Piece:"));
    tmp.add("Center", next_piece_canvas);
    tmp.setBackground(BACKGROUND_COLOR);
    right_panel.add(tmp);

    Panel stats_panel = new Panel(new GridLayout(4, 2));
    stats_panel.add(new TetrisLabel("    Rows Deleted: "));
    stats_panel.add(rows_deleted_label);
    stats_panel.add(new TetrisLabel("    Level: "));
    stats_panel.add(level_label);
    stats_panel.add(new TetrisLabel("    Score: "));
    stats_panel.add(score_label);
    stats_panel.add(new TetrisLabel("    High Score: "));
    stats_panel.add(high_score_label);
    tmp = new Panel(new BorderLayout());
    tmp.setBackground(BACKGROUND_COLOR);
    tmp.add("Center", stats_panel);
    right_panel.add(tmp);

    this.setLayout(new GridLayout(1, 2));
    this.add(game_grid);
    this.add(right_panel);
    this.setBackground(BACKGROUND_COLOR);
    this.validate();
  }
コード例 #20
0
  @Override
  public void init() {

    Label ex1, ex2, ex3, ex4, ex5, ex6, ex7;
    setLayout(new GridLayout(24, 2));
    setSize(500, 600);

    t1 = new TextField(10);
    t2 = new TextField(10);
    t3 = new TextField(10);
    t4 = new TextField(10);
    t5 = new TextField(10);
    t6 = new TextField(10);
    t7 = new TextField(10);
    t8 = new TextField(10);
    t9 = new TextField(10);
    t10 = new TextField(10);
    t11 = new TextField(10);
    t12 = new TextField(10);
    t13 = new TextField(10);
    net = new TextField(10);
    tp = new TextField(10);

    c1 = new Checkbox("Male(min taxable income:160000)", cbg, false);
    c2 = new Checkbox("Female(min taxable income:190000)", cbg, false);
    c3 = new Checkbox("Sr citizen(>65 yrs)(min taxable income:240000)", cbg, false);

    title = new Label("INCOME TAX CALCULATOR");
    ex1 = new Label("    ");
    ex2 = new Label("    ");
    ex3 = new Label("    ");
    ex4 = new Label("    ");
    ex5 = new Label("    ");
    ex6 = new Label("    ");
    ex7 = new Label("    ");
    l1 = new Label("Gross salary");
    l2 = new Label("Other Income");
    l3 = new Label("Other perks");
    lh1 = new Label("Deductions under 80C(min:100000)");
    l4 = new Label("PF&VPF");
    l5 = new Label("LIC premium");
    l6 = new Label("Housing Loan Repayment");
    l7 = new Label("Child1 Fee");
    l8 = new Label("Child2 Fee");
    l9 = new Label("Interest on securities");
    lh2 = new Label("Deductions under 80D");
    l10 = new Label("Medical premium(totally exempted)");
    lh3 = new Label("Deductions under 80E");
    l11 = new Label("Interest on Higher Education loan");
    lh4 = new Label("Deductions under 80G");
    l12 = new Label("Donations");
    l13 = new Label("Loss on House property");
    netinc = new Label("Net Income");
    taxpayable = new Label("Tax Payable");

    add(title);
    add(ex6);
    add(l1);
    add(t1);
    add(l2);
    add(t2);
    add(l3);
    add(t3);
    add(lh1);
    add(ex1);
    add(l4);
    add(t4);
    add(l5);
    add(t5);
    add(l6);
    add(t6);
    add(l7);
    add(t7);
    add(l8);
    add(t8);
    add(l9);
    add(t9);
    add(lh2);
    add(ex2);
    add(l10);
    add(t10);
    add(lh3);
    add(ex3);
    add(l11);
    add(t11);
    add(lh4);
    add(ex4);
    add(l12);
    add(t12);
    add(l13);
    add(t13);
    add(b1);
    add(ex5);
    add(netinc);
    add(net);
    add(c1);
    add(c2);
    add(c3);
    add(ex7);
    add(taxpayable);
    add(tp);

    b1.addActionListener(this);
    b1.addActionListener(this);
    c1.addItemListener(this);
    c2.addItemListener(this);
    c3.addItemListener(this);
  }
コード例 #21
0
 public void init() {
   setSize(300, 300);
   ok = new Button("ok");
   ok.addActionListener(new OkListener());
   add(ok);
 }