Results 1 to 5 of 5

Thread: Eclipse

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Addicted To Cars opcbg's Avatar
    Join Date: Mar:2007
    Location:
    Posts: 201

    Eclipse

    import javax.swing.*;

    import java.awt.*;
    import java.awt.event.*;
    import java.util.ArrayList;
    public class Invoice extends JFrame implements ActionListener {
    private Invoice invoice;
    private JLabel cenaL,imeL,kolichestvoL,obshtoL,koshnica L;
    private JPanel panel1,panel2;
    private JTextField imeT,kolichestvoT,obshtoT;
    private JTextArea koshnicaA;
    private JButton izchisli,dobavi;
    private JTextField cenaT;
    public Invoice(){
    super("FAKTURA");
    invoice=new Invoice();
    setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE);
    Container container=getContentPane();
    panel1=new JPanel();
    GridLayout layoutPanel1 = new GridLayout(4, 2);
    panel1.setLayout(layoutPanel1);
    cenaL=new JLabel("Cena");
    imeL=new JLabel("Ime");
    kolichestvoL=new JLabel("Kolichestvo");
    obshtoL=new JLabel("Obshto");
    koshnicaL=new JLabel("Koshnica");
    cenaT=new JTextField(10);
    imeT=new JTextField(10);
    kolichestvoT=new JTextField(10);
    obshtoT=new JTextField(10);
    koshnicaA=new JTextArea(10,2);
    panel1.add(imeL);
    panel1.add(imeT);
    panel1.add(cenaL);
    panel1.add(cenaL);
    panel1.add(kolichestvoL);
    panel1.add(kolichestvoT);
    panel1.add(obshtoL);
    panel1.add(obshtoT);
    panel1.add(koshnicaL);
    panel1.add(koshnicaA);
    container.add(panel1, BorderLayout.PAGE_START);
    container.add(koshnicaA, BorderLayout.CENTER);
    panel2=new JPanel();
    izchisli=new JButton("Izchisli");
    dobavi=new JButton("Dobavi");
    panel2.add(izchisli);
    panel2.add(dobavi);
    container.add(panel2, BorderLayout.PAGE_END);
    izchisli.addActionListener(this);
    dobavi.addActionListener(this);
    imeT.addActionListener(this);
    kolichestvoT.addActionListener(this);
    setSize(300,300);
    setVisible(true);
    }
    public void actionPerformed(ActionEvent e){
    if(e.getSource()==dobavi){
    try{
    invoice.addProdukt(Integer.parseInt(imeT .getText(),cenaT.getText()));
    koshnicaA.append("Produkta e dobaven");
    }catch(Exception ex) {
    koshnicaA.append("Greshka pri vyvejdane");
    .....
    public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable(){
    public void run(){
    new Invoice();
    }
    });

    }

    }
    , , , "" , .
    !

  2. #2

    Join Date: Sep:2005
    Location: Sofia
    Posts: 18,517
    . . -
    Code:
    
    
    EventQueue- . .

    float, actionPerformed(...) , , . " ". ?
    Last edited by vvvlado; 18th May 2009 at 18:46.

  3. #3
    Addicted To Cars opcbg's Avatar
    Join Date: Mar:2007
    Location:
    Posts: 201
    . 6 , . . . . .

  4. #4

    Join Date: Sep:2005
    Location: Sofia
    Posts: 18,517
    Last edited by vvvlado; 19th May 2009 at 14:45.

  5. #5
    Addicted To Cars opcbg's Avatar
    Join Date: Mar:2007
    Location:
    Posts: 201
    ! .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |