Example #1
0
 /** Create and add Clippy's output text */
 public void addClippyTxt() {
   clippyTxt.setLineWrap(true);
   clippyTxt.setWrapStyleWord(true);
   clippyTxt.setEditable(false);
   clippyTxt.setFont(txtFont);
   clippyTxt.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
   clippyTxt.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
   clippyTxt.setBorder(null);
   clippyTxt.setSize(105, 35);
   clippyTxt.setLocation(25, 45);
   clippyTxt.setOpaque(false);
   lpane.add(clippyTxt, new Integer(1), 0);
 }
  public int createField(JPanel panel, int x, int y, int width) {
    JTextArea l = new JTextArea(this.getLabel());
    l.setEditable(false);
    l.setLineWrap(true);
    l.setBackground(this.getOwner().getBackground());
    l.setWrapStyleWord(true);
    l.setSize(
        new Dimension(
            this.getOwner().getWidth(), this.height * (l.getFontMetrics(l.getFont())).getHeight()));
    this.setLabelControl(null);
    l.setLocation(new Point(0, y));
    panel.add(l);

    return y + 100;
  }
Example #3
0
  private void initializeFrame() {
    int padding = 5;
    // double ratio = 16.0/9.0;
    double ratio = (1.0 + Math.sqrt(5.0)) / 2.0;
    Dimension screenDims = Toolkit.getDefaultToolkit().getScreenSize();
    // setLocation((screenDims.width - getWidth())/2,(screenDims.height -
    // getHeight())/2);
    // TODO add server/client closing functionality on close

    JPanel panel = new JPanel();
    panel.setLayout(null);
    double height = screenDims.height / 2;
    Dimension panelDims = new Dimension((int) (height * ratio), (int) height);
    panel.setPreferredSize(panelDims);
    panel.setMaximumSize(panelDims);
    panel.setMinimumSize(panelDims);

    int textMargin = 3;
    textArea = new JTextArea();
    textArea.setMargin(new Insets(textMargin, textMargin, textMargin, textMargin));
    textArea.setSize(panelDims.width - 2 * padding, panelDims.height - 2 * padding);
    textArea.setLocation(padding, padding);
    textArea.setEditable(false);
    scrollPane = new JScrollPane(textArea);
    scrollPane.setSize(textArea.getSize());
    scrollPane.setLocation(textArea.getLocation());
    scrollPane
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {
              public void adjustmentValueChanged(AdjustmentEvent e) {
                isAtBottom = e.getAdjustable().getValue() == e.getAdjustable().getMaximum();
              }
            });
    panel.add(scrollPane);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout());
    add(panel, BorderLayout.CENTER);
    pack();
    setSize(getWidth() - 10, getHeight() - 10);
    setResizable(false);
    setLocationRelativeTo(null);
    this.setVisible(true);
  }
Example #4
0
  public GraphicsUI() {

    questionPool = new QuestionPool();

    setTitle("Question Pool");
    setSize(WIDTH, HEIGHT);

    fileL = new JLabel("Location of Question Pool File:");
    fileTF = new JTextField(10);

    checkB = new JButton("Check File");

    log = new JTextArea(6, 30);

    Container pane = getContentPane();
    pane.setLayout(null);

    // set locations and sizes for the elements
    fileL.setLocation(90, 15);
    fileL.setSize(ELEMENT_WIDTH, 30);
    fileTF.setLocation(90, 65);
    fileTF.setSize(ELEMENT_WIDTH, 30);
    checkB.setLocation(90, 105);
    checkB.setSize(300, 35);
    log.setLocation(90, 145);
    log.setSize(300, 30);

    // add listener to button
    CheckButtonHandler cbHandler = new CheckButtonHandler();
    checkB.addActionListener(cbHandler);
    fileTF.addActionListener(cbHandler);

    // add elements to pane
    pane.add(fileL);
    pane.add(fileTF);
    pane.add(checkB);
    pane.add(log);

    setLocation(100, 60);
    setVisible(true);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
Example #5
0
  private void initialize() {
    panel = new JPanel();
    frame = new JFrame();
    can.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            PointerInfo a = MouseInfo.getPointerInfo();
            Point b = a.getLocation();
            double x = b.getX();
            double y = b.getY();
            System.out.println("Entered x: " + x);
            System.out.println("Entered y: " + y);

            if (x == 950) {
              x = 0;
            } else if (x < 950) {
              x = (x / 950) - 1;
            } else if (x > 950) {
              x = (x / 950) - 1;
            }

            if (y == 563) {
              y = 0;
            } else if (y < 563) {
              y = 1 - (y / 563);
            } else if (y > 563) {
              y = 1 - (y / 563);
            }

            System.out.println("NEW NEW NEW NEW x: " + x);
            System.out.println("NEW NEW NEW NEW y: " + y);

            double inc = -2;
            var = new ArrayList<Double>();
            for (int i = -200; i < 200; i++) {
              var.add(new Equation(x, y).setEquationReturn(inc));
              inc = inc + .01;
            }

            double paintInc = -2;
            for (int dx = 0; dx < 200; dx++) {
              double dy = var.get(dx);
              theG.add(new Ellipse2D.Double(0 + paintInc, 540 - dy, 10, 10));
              paintInc = paintInc + 10;
            }

            /*This is to display the Y values for testing purposes
            Iterator<Double> it = var.iterator();
            while (it.hasNext()){
            	System.out.println(it.next());
            }*/

            can.repaint();
          }
        });
    JLabel xL = new JLabel();
    JLabel yL = new JLabel();
    JTextArea a = new JTextArea();
    a.setLocation(540, 540);
    a.setText("FFFFFFFFFFFUCK");
    a.setBackground(Color.white);
    yL.setText("Y");
    xL.setText("X");
    yL.setLocation(930, 10);
    yL.setSize(10, 10);
    yL.setBackground(Color.black);
    xL.setLocation(1900, 550);
    xL.setSize(10, 10);
    xL.setBackground(Color.black);
    xL.setOpaque(true);
    yL.setOpaque(true);

    panel.setBackground(Color.darkGray);
    can.setBackground(Color.black);
    can.setForeground(Color.black);
    frame.getContentPane().add(can);
    panel.setLayout(new GridLayout(1, 0, 0, 0));

    frame.add(xL);
    frame.add(yL);
    frame.add(can);
    frame.setBounds(0, 0, 1920, 1080);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Example #6
0
 // constructor
 public TextView() {
   // setup model
   g = new Game();
   // setup the mainframe for swing
   mainFrame = new JFrame("Hunt the Wumpus!");
   mainFrame.setSize(316, 530);
   mainFrame.setLocation(400, 200);
   mainFrame.setVisible(true);
   mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   mainFrame.setLayout(null);
   // layout aPanel as a JPanel to fill the mainframe
   aPanel = new JPanel();
   aPanel.setSize(300, 530);
   aPanel.setLocation(0, 0);
   aPanel.setLayout(null);
   mainFrame.add(aPanel);
   // create and add aTextArea to aPanel to fill with the textual view of the model
   aTextArea = new JTextArea(g.display());
   Font font1 = new Font("Consolas", Font.BOLD, 12);
   aTextArea.setFont(font1);
   aTextArea.setForeground(Color.WHITE);
   aTextArea.setBackground(Color.DARK_GRAY);
   aTextArea.setSize(300, 310);
   aTextArea.setLocation(0, 0);
   aTextArea.setEditable(false); // we don't want the hunter to mess with Mother Nature
   aPanel.add(aTextArea);
   // stick on some labels to tell user how to play
   deathNote.setSize(300, 40);
   deathNote.setLocation(0, 310);
   deathNote.setEditable(false);
   deathNote.setWrapStyleWord(true);
   deathNote.setLineWrap(true);
   aTextArea.setForeground(Color.BLACK);
   aTextArea.setBackground(Color.LIGHT_GRAY);
   aPanel.add(deathNote);
   moveLabel.setSize(100, 20);
   moveLabel.setLocation(52, 360);
   aPanel.add(moveLabel);
   shootLabel.setSize(100, 20);
   shootLabel.setLocation(215, 360);
   aPanel.add(shootLabel);
   // setup showButton
   showButton.setSize(200, 20);
   showButton.setLocation(60, 495);
   aPanel.add(showButton);
   // setup movement buttons
   moveU.setSize(45, 45);
   moveU.setLocation(45, 385);
   aPanel.add(moveU);
   moveD.setSize(45, 45);
   moveD.setLocation(45, 430);
   aPanel.add(moveD);
   moveL.setSize(45, 45);
   moveL.setLocation(0, 430);
   aPanel.add(moveL);
   moveR.setSize(45, 45);
   moveR.setLocation(90, 430);
   aPanel.add(moveR);
   // setup shooting buttons
   shootU.setSize(45, 45);
   shootU.setLocation(210, 385);
   aPanel.add(shootU);
   shootD.setSize(45, 45);
   shootD.setLocation(210, 430);
   aPanel.add(shootD);
   shootL.setSize(45, 45);
   shootL.setLocation(165, 430);
   aPanel.add(shootL);
   shootR.setSize(45, 45);
   shootR.setLocation(255, 430);
   aPanel.add(shootR);
   // register the listeners
   showButton.addActionListener(new ShowListener());
   moveU.addActionListener(new MoveListener());
   moveD.addActionListener(new MoveListener());
   moveL.addActionListener(new MoveListener());
   moveR.addActionListener(new MoveListener());
   shootU.addActionListener(new ShootListener());
   shootD.addActionListener(new ShootListener());
   shootL.addActionListener(new ShootListener());
   shootR.addActionListener(new ShootListener());
 }
Example #7
0
  MovieAdd() {
    setTitle("Dodaj Film");
    setSize(300, 355);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    this.setResizable(false);
    setLayout(null);
    frame = this;

    /** ***************************************************** */
    Mov = DataBase.getInstance().getMoviesDao();
    Cat = DataBase.getInstance().getCategoriesDao();
    CatMov = DataBase.getInstance().getCatMovDao();
    Vector<String> catNamesList = DataBase.returnCategoriesList();
    /** ******************************************************* */
    categories = new JComboBox(catNamesList);

    label1.setLocation(10, 10);
    label1.setSize(60, 25);
    categories.setLocation(80, 10);
    categories.setSize(200, 25);

    label2.setLocation(10, 50);
    label2.setSize(60, 25);
    name.setLocation(80, 50);
    name.setSize(200, 25);

    label3.setLocation(10, 90);
    label3.setSize(60, 25);
    desc.setLocation(80, 90);
    desc.setSize(200, 150);
    desc.setFont(new Font("Dialog", Font.PLAIN, 12));

    label4.setLocation(10, 250);
    label4.setSize(60, 25);
    fileButton.setLocation(80, 250);
    fileButton.setSize(200, 25);

    button.setLocation(220, 290);
    button.setSize(60, 25);

    add(label1);
    add(categories);
    add(label2);
    add(name);
    add(label3);
    add(desc);
    add(label4);
    add(fileButton);
    add(button);

    fileButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int returnVal = fileChooser.showOpenDialog(frame);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              choosenFileName = fileChooser.getSelectedFile().getAbsolutePath();
            }
          }
        });

    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Movies newMovie = new Movies();
            newMovie.setName(name.getText());
            newMovie.setContent(desc.getText());
            newMovie.setFile(choosenFileName);
            newMovie.setCreated(new Date());
            try {
              Mov.create(newMovie);
            } catch (SQLException ex) {
              System.out.println("Błąd przy zapisywaniu nowego filmu... MovieAdd " + ex);
            }

            String catName = (String) categories.getSelectedItem();
            Categories category = new Categories();
            try {
              category = Cat.queryForEq("name", catName).get(0);
            } catch (SQLException ex) {
              System.out.println("Błąd przy szukaniu kategorii... MovieAdd " + ex);
            }

            CatMovies catMovLink = new CatMovies();
            catMovLink.setMovie(newMovie);
            catMovLink.setCategory(category);
            try {
              CatMov.create(catMovLink);
            } catch (SQLException ex) {
              System.out.println("Błąd przy zapisywaniu kategoria-film... MovieAdd " + ex);
            }

            frame.setVisible(false);
          }
        });
  }
Example #8
0
  public BurtgehHuudas() {

    super("Бүртгэл хуудас");

    Container con = getContentPane();
    con.setLayout(null);

    // haryalagdah tenhim
    JLabel lbl1 = new JLabel("Харъяалагдах тэнхим:");
    lbl1.setLocation(30, 30);
    lbl1.setSize(200, 30);
    con.add(lbl1);

    JComboBox combo1 = new JComboBox();
    try {
      String s = "SELECT * FROM tenhim";
      ResultSet rs = DatabaseTools.runQuery(s);
      while (rs.next()) {
        combo1.addItem(rs.getString(2));
      }
    } catch (Exception e) {
    }

    combo1.setLocation(200, 30);
    combo1.setSize(200, 30);
    con.add(combo1);

    JLabel lb1 = new JLabel("Сонгоно уу?");
    lb1.setLocation(450, 30);
    lb1.setSize(200, 30);
    con.add(lb1);

    // oyutanii code
    JLabel lbl2 = new JLabel("Код:");
    lbl2.setLocation(30, 70);
    lbl2.setSize(200, 30);
    con.add(lbl2);

    JTextField txt1 = new JTextField();
    txt1.setLocation(200, 70);
    txt1.setSize(200, 30);

    con.add(txt1);

    JLabel lb2 = new JLabel("Жишээ нь:SW001");
    lb2.setLocation(450, 70);
    lb2.setSize(200, 30);
    con.add(lb2);

    // oyutanii ovog
    JLabel lbl3 = new JLabel("Овог:");
    lbl3.setLocation(30, 110);
    lbl3.setSize(200, 30);
    con.add(lbl3);

    JTextField txt2 = new JTextField();
    txt2.setLocation(200, 110);
    txt2.setSize(200, 30);
    con.add(txt2);

    JLabel lb3 = new JLabel("18 тэмдэгт");
    lb3.setLocation(450, 110);
    lb3.setSize(200, 30);
    con.add(lb3);

    // oyutanii ner
    JLabel lbl4 = new JLabel("Нэр:");
    lbl4.setLocation(30, 150);
    lbl4.setSize(200, 30);
    con.add(lbl4);

    JTextField txt3 = new JTextField();
    txt3.setLocation(200, 150);
    txt3.setSize(200, 30);
    con.add(txt3);

    JLabel lb4 = new JLabel("18 тэмдэгт");
    lb4.setLocation(450, 150);
    lb4.setSize(200, 30);
    con.add(lb4);

    // nuuts ug
    JLabel lbl5 = new JLabel("Нууц үг:");
    lbl5.setLocation(30, 190);
    lbl5.setSize(200, 30);
    con.add(lbl5);

    JPasswordField pass1 = new JPasswordField();
    pass1.setLocation(200, 190);
    pass1.setSize(200, 30);
    con.add(pass1);

    JLabel lb5 = new JLabel("Ихдээ 10 тэмдэгт");
    lb5.setLocation(450, 190);
    lb5.setSize(200, 30);
    con.add(lb5);

    // nuuts ug davtalt
    JLabel lbl6 = new JLabel("Нууц үг давталт:");
    lbl6.setLocation(30, 230);
    lbl6.setSize(200, 30);
    con.add(lbl6);

    JPasswordField pass2 = new JPasswordField();
    pass2.setLocation(200, 230);
    pass2.setSize(200, 30);
    con.add(pass2);

    // huis
    JLabel lbl7 = new JLabel("Хүйс:");
    lbl7.setLocation(30, 270);
    lbl7.setSize(200, 30);
    con.add(lbl7);

    JRadioButton rd1 = new JRadioButton("Эр");
    rd1.setLocation(200, 270);
    rd1.setSize(50, 30);
    con.add(rd1);

    JRadioButton rd2 = new JRadioButton("Эм");
    rd2.setLocation(260, 270);
    rd2.setSize(50, 30);
    con.add(rd2);

    ButtonGroup huisGroup = new ButtonGroup();
    huisGroup.add(rd1);
    huisGroup.add(rd2);

    JLabel lb7 = new JLabel("Сонгодог байх");
    lb7.setLocation(450, 270);
    lb7.setSize(200, 30);
    con.add(lb7);

    // elssen on
    JLabel lbl8 = new JLabel("Элссэн он:");
    lbl8.setLocation(30, 310);
    lbl8.setSize(200, 30);
    con.add(lbl8);

    JTextField txt5 = new JTextField();
    txt5.setLocation(200, 310);
    txt5.setSize(200, 30);
    con.add(txt5);

    JLabel lb8 = new JLabel("Жишээ:2011");
    lb8.setLocation(450, 310);
    lb8.setSize(200, 30);
    con.add(lb8);

    // tsagiin/undsen
    JLabel lbl9 = new JLabel("Цагийн/Үндсэн:");
    lbl9.setLocation(30, 350);
    lbl9.setSize(200, 30);
    con.add(lbl9);

    JCheckBox ch1 = new JCheckBox("Цаг");
    ch1.setLocation(200, 340);
    ch1.setSize(50, 50);
    con.add(ch1);

    JCheckBox ch2 = new JCheckBox("Үндсэн");
    ch2.setLocation(250, 340);
    ch2.setSize(80, 50);
    con.add(ch2);

    ButtonGroup checkgroup = new ButtonGroup();
    checkgroup.add(ch1);
    checkgroup.add(ch2);

    JLabel lb9 = new JLabel("Олныг сонгож болох");
    lb9.setLocation(450, 350);
    lb9.setSize(200, 30);
    con.add(lb9);

    // zereg
    JLabel lbl10 = new JLabel("Зэрэг:");
    lbl10.setLocation(30, 390);
    lbl10.setSize(200, 30);
    con.add(lbl10);

    JComboBox combo2 = new JComboBox();

    try {
      String s = "SELECT * FROM zereg";
      ResultSet rs = DatabaseTools.runQuery(s);
      while (rs.next()) {
        combo2.addItem(rs.getString(2));
      }
    } catch (Exception e) {
    }
    combo2.setLocation(200, 390);
    combo2.setSize(200, 30);
    con.add(combo2);

    // torol
    JLabel lbl11 = new JLabel("Төрөл:");
    lbl11.setLocation(30, 430);
    lbl11.setSize(200, 30);
    con.add(lbl11);

    String str3[] = {
      "Захирал", "Бакалавр1", "Бакалавр2", "Бакалавр3", "Бакалавр4",
    };
    JComboBox combo3 = new JComboBox(str3);
    combo3.setLocation(200, 430);
    combo3.setSize(200, 30);
    con.add(combo3);

    // geriin utas
    JLabel lbl12 = new JLabel("Гэрийн утас:");
    lbl12.setLocation(30, 470);
    lbl12.setSize(200, 30);
    con.add(lbl12);

    JTextField txt6 = new JTextField();
    txt6.setLocation(200, 470);
    txt6.setSize(200, 30);
    con.add(txt6);

    JLabel lb12 = new JLabel("Ихдээ 20 тэмдэгт");
    lb12.setLocation(450, 470);
    lb12.setSize(200, 30);
    con.add(lb12);

    // gar utas
    JLabel lbl13 = new JLabel("Гар утас:");
    lbl13.setLocation(30, 510);
    lbl13.setSize(200, 30);
    con.add(lbl13);

    JTextField txt7 = new JTextField();
    txt7.setLocation(200, 510);
    txt7.setSize(200, 30);
    con.add(txt7);

    JLabel lb13 = new JLabel("Ихдээ 20 тэмдэгт");
    lb13.setLocation(450, 510);
    lb13.setSize(200, 30);
    con.add(lb13);

    // geriin hayag
    JLabel lbl14 = new JLabel("Гэрийн хаяг:");
    lbl14.setLocation(30, 550);
    lbl14.setSize(200, 30);
    con.add(lbl14);

    JTextArea ta1 = new JTextArea();
    ta1.setLocation(200, 550);
    ta1.setSize(250, 90);
    con.add(ta1);

    JLabel lb14 = new JLabel("Ихдээ 200 тэмдэгт");
    lb14.setLocation(500, 550);
    lb14.setSize(200, 30);
    con.add(lb14);

    // mail hayag
    JLabel lbl15 = new JLabel("Майл хаяг:");
    lbl15.setLocation(30, 650);
    lbl15.setSize(200, 30);
    con.add(lbl15);

    JTextField txt8 = new JTextField();
    txt8.setLocation(200, 650);
    txt8.setSize(200, 30);
    con.add(txt8);

    JLabel lb15 = new JLabel("Ихдээ 100 тэмдэгт");
    lb15.setLocation(450, 650);
    lb15.setSize(200, 30);
    con.add(lb15);

    // torson odor
    JLabel lbl16 = new JLabel("Төрсөн өдөр:");
    lbl16.setLocation(30, 690);
    lbl16.setSize(200, 30);
    con.add(lbl16);

    String year1[] = new String[116];
    for (int on = 0; on < 116; on++) {
      year1[on] = Integer.toString(1900 + on);
    }
    JComboBox year = new JComboBox(year1);
    year.setMaximumRowCount(8);
    year.setLocation(200, 690);
    year.setSize(60, 30);
    con.add(year);

    JLabel lbl161 = new JLabel("Он");
    lbl161.setLocation(265, 690);
    lbl161.setSize(30, 30);
    con.add(lbl161);

    String month1[] = new String[12];
    for (int sar = 0; sar < 12; sar++) {
      month1[sar] = Integer.toString(1 + sar);
    }
    JComboBox month = new JComboBox(month1);
    month.setMaximumRowCount(8);
    month.setLocation(290, 690);
    month.setSize(60, 30);
    con.add(month);

    JLabel lbl162 = new JLabel("Сар");
    lbl162.setLocation(355, 690);
    lbl162.setSize(30, 30);
    con.add(lbl162);

    String day1[] = new String[31];
    for (int odor = 0; odor < 31; odor++) {
      day1[odor] = Integer.toString(1 + odor);
    }
    JComboBox day = new JComboBox(day1);
    day.setLocation(385, 690);
    day.setSize(60, 30);
    con.add(day);

    JLabel lbl163 = new JLabel("Өдөр");
    lbl163.setLocation(450, 690);
    lbl163.setSize(50, 30);
    con.add(lbl163);

    JLabel lb16 = new JLabel("3-н combobox байх");
    lb16.setForeground(Color.red);
    lb16.setLocation(550, 690);
    lb16.setSize(200, 30);
    con.add(lb16);

    // nemeh
    JButton bt1 = new JButton("Нэмэх");
    bt1.setForeground(Color.blue);
    bt1.setLocation(600, 30);
    bt1.setSize(100, 40);
    bt1.addActionListener(
        ae -> {
          String stuLastName = txt2.getText();
          String stuFirstName = txt3.getText();
          String huis;
          if (rd1.isSelected()) huis = "эр";
          else huis = "эм";
          String elssenOn = txt5.getText();
          String address = ta1.getText();
          String phone = txt7.getText();
          String mail = txt8.getText();
          String code = txt1.getText();

          String query1 =
              "insert into student(stu_lastname, stu_firstname,stu_sex,stu_elssenOn,stu_address,stu_phone,stu_mail,stu_code)"
                  + "values('"
                  + stuLastName
                  + "','"
                  + stuFirstName
                  + "','"
                  + huis
                  + "','"
                  + elssenOn
                  + "','"
                  + address
                  + "','"
                  + phone
                  + "','"
                  + mail
                  + "','"
                  + code
                  + "')";
          DatabaseTools.runQuery(query1);
          JOptionPane.showMessageDialog(null, "Амжилттай нэмэгдлээ.");
          this.dispose();
        });
    con.add(bt1);

    // tseverleh
    JButton bt4 = new JButton("Цэвэрлэх");
    bt4.setForeground(Color.blue);
    bt4.setLocation(600, 180);
    bt4.setSize(100, 40);
    con.add(bt4);

    setLocation(800, 350);
    setSize(750, 800);
    setVisible(true);
    setResizable(false);
  }
  public BoundaryVenditoreModificaPrenotazione()
      throws DAOException, MapException, SQLException, DataException, OraException,
          CatalogoException {

    this.controlloreVenditore = ControlloreVenditore.getInstance();
    this.boundaryVenditoreModificaPrenotazione = this;
    pannelloVenditoreModificaPrenotazione = new JPanel();

    pannelloVenditoreModificaPrenotazione.setSize(
        AABoundaryAvvio.Frame.getWidth(), AABoundaryAvvio.Frame.getHeight());
    AABoundaryAvvio.Frame.add(pannelloVenditoreModificaPrenotazione);
    pannelloVenditoreModificaPrenotazione.setLayout(null);

    panelTitolo.setLayout(null);
    panelTitolo.setSize(AABoundaryAvvio.Frame.getWidth(), 45);
    panelTitolo.setLocation(5, 5);
    panelTitolo.add(titolo);

    titolo.setFont(new Font("Arial", 0, 30));
    titolo.setLocation(border, border);
    titolo.setSize(panelTitolo.getWidth(), 35);
    titolo.setHorizontalAlignment(JLabel.CENTER);
    titolo.setVerticalAlignment(JLabel.CENTER);
    titolo.setText("Gestore Venditore");

    pannelloVenditoreModificaPrenotazione.add(panelTitolo);

    labelIdOfferta = new JLabel();

    prenotazione = new JTextField("", 20);

    // Bottone back
    back = new JButton("back");
    back.setLocation(500, 350);
    back.setSize(panelTitolo.getWidth() / 4, 50);
    back.setFont(new Font("Arial", 0, 20));

    aggiuntaBiglietti = new JButton("Aggiunta Biglietti");
    aggiuntaBiglietti.setLocation(100, 150);
    aggiuntaBiglietti.setSize(300, 50);
    aggiuntaBiglietti.setFont(new Font("Arial", 0, 20));

    rimozioneBiglietti = new JButton("Rimozione Biglietti");
    rimozioneBiglietti.setLocation(100, 250);
    rimozioneBiglietti.setSize(300, 50);
    rimozioneBiglietti.setFont(new Font("Arial", 0, 20));

    // Setting Label
    labelModifica.setFont(new Font("Arial", 0, 30));
    labelModifica.setLocation(border, 30);
    labelModifica.setSize(pannelloVenditoreModificaPrenotazione.getWidth(), 35);
    labelModifica.setHorizontalAlignment(JLabel.CENTER);
    labelModifica.setVerticalAlignment(JLabel.CENTER);
    labelModifica.setText("Inserisci l'id dell'prenotazione da modificare.");

    // Setting Label
    labelIdOfferta.setFont(new Font("Arial", 0, 18));
    labelIdOfferta.setLocation(100, 100);
    labelIdOfferta.setSize(150, 35);
    labelIdOfferta.setText("Prenotazione:");

    // Setting area
    areaVisualizzazione = new JTextArea();
    areaVisualizzazione.setLocation(10, 500);
    areaVisualizzazione.setSize(
        AABoundaryAvvio.Frame.getWidth(), AABoundaryAvvio.Frame.getHeight());

    // Setting delle textBox
    prenotazione.setLocation(300, 100);
    prenotazione.setSize(200, 35);
    prenotazione.setFont(new Font("Arial", 0, 18));

    panelButtons.setLayout(null);
    panelButtons.setSize(AABoundaryAvvio.Frame.getWidth(), AABoundaryAvvio.Frame.getHeight());
    panelButtons.setLocation(5, altezzaTitolo);

    panelButtons.add(labelIdOfferta);

    panelButtons.add(prenotazione);

    panelButtons.add(labelModifica);

    panelButtons.add(areaVisualizzazione);

    panelButtons.add(aggiuntaBiglietti);

    panelButtons.add(rimozioneBiglietti);

    panelButtons.add(back);

    pannelloVenditoreModificaPrenotazione.add(panelButtons);

    // Istanziazione dei Listeners
    buttonsListener = new GestoreButtons();
    backListener = new GestoreBack();

    // Listener dei bottoni
    aggiuntaBiglietti.addActionListener(buttonsListener);
    rimozioneBiglietti.addActionListener(buttonsListener);
    back.addActionListener(backListener);
  }
  private void initComponent() {
    // 最基本按钮
    close = new MyButton(30, 30, Img.CLOSE_0, Img.CLOSE_1, Img.CLOSE_2);
    close.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            System.exit(0);
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    min = new MyButton(30, 30, Img.MINI_0, Img.MINI_1, Img.MINI_2);
    min.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            frame.setExtendedState(JFrame.ICONIFIED);
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    _return = new MyButton(30, 30, Img.RETURN_0, Img.RETURN_1, Img.RETURN_2);
    _return.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            frame.dispose();
            new MainFrame();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    // 功能按钮
    goto_AccountManage =
        new MyButton(frame.getWidth() / 6, 30, Img.GOZHANGHU_0, Img.GOZHANGHU_1, Img.GOZHANGHU_2);
    goto_AccountManage.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(1);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_CostManage =
        new MyButton(
            frame.getWidth() / 6, 30, Img.GOCHENGBEN_2, Img.GOCHENGBEN_2, Img.GOCHENGBEN_2);
    goto_CostManage.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(2);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_SettlementManage =
        new MyButton(frame.getWidth() / 6, 30, Img.GOJIESUAN_0, Img.GOJIESUAN_1, Img.GOJIESUAN_2);
    goto_SettlementManage.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(3);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_Statistic =
        new MyButton(
            frame.getWidth() / 6,
            30,
            Img.GOTONGJIBAOBIAO_0,
            Img.GOTONGJIBAOBIAO_1,
            Img.GOTONGJIBAOBIAO_2);
    goto_Statistic.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(4);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_BaseDataSetting =
        new MyButton(frame.getWidth() / 6, 30, Img.GOQICHU_0, Img.GOQICHU_1, Img.GOQICHU_2);
    goto_BaseDataSetting.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(5);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    goto_SystemLog =
        new MyButton(frame.getWidth() / 6, 30, Img.GOXITONG_0, Img.GOXITONG_1, Img.GOXITONG_2);
    goto_SystemLog.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            clear();
            frame.setStated(frame.getState());
            frame.setState(6);
            frame.change();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });
    // 详细操作按钮
    confirm = new MyButton(90, 30, Img.CONFIRM_0, Img.CONFIRM_1, Img.CONFIRM_2);
    confirm.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent arg0) {
            _create();
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });

    // 最基本元素
    JLabel titleLabel = new JLabel("物流信息管理系统");
    titleLabel.setSize((int) (50 * 8 * 1.07f), 50);
    titleLabel.setFont(new Font("宋体", Font.BOLD, 50));
    titleLabel.setForeground(Color.BLACK);
    titleLabel.setLocation(596 - (int) (50 * 8 * 1.07f) / 2, 20);

    String func = "成本管理";
    JLabel funLabel = new JLabel(func);
    funLabel.setSize((int) (40 * func.length() * 1.07f), 40);
    funLabel.setFont(new Font("宋体", Font.BOLD, 40));
    funLabel.setLocation(596 - (int) (40 * func.length() * 1.07f) / 2, 128 + 10);

    JLabel currentuserAgencyNameLabel = new JLabel(currentUser.getAgencyName());
    currentuserAgencyNameLabel.setSize(
        (int) (30 * currentUser.getAgencyName().length() * 1.07f), 30);
    currentuserAgencyNameLabel.setFont(new Font("宋体", Font.BOLD, 30));
    currentuserAgencyNameLabel.setForeground(Color.DARK_GRAY);
    currentuserAgencyNameLabel.setLocation(170, 128 - 30);

    String s = "财务人员";
    JLabel currentuserLabel = new JLabel(s);
    currentuserLabel.setSize((int) (30 * s.length() * 1.07f), 30);
    currentuserLabel.setFont(new Font("宋体", Font.BOLD, 30));
    currentuserLabel.setLocation(
        170 + (int) (30 * currentUser.getAgencyName().length() * 1.07f), 128 - 30);

    JLabel currentusernameLabel = new JLabel(currentUser.getname());
    currentusernameLabel.setSize((int) (30 * currentUser.getname().length() * 1.07f), 30);
    currentusernameLabel.setFont(new Font("宋体", Font.BOLD, 30));
    currentusernameLabel.setForeground(Color.DARK_GRAY);
    currentusernameLabel.setLocation(
        170
            + (int) (30 * currentUser.getAgencyName().length() * 1.07f)
            + (int) (30 * s.length() * 1.07f),
        128 - 30);
    // 最基本按钮
    close.setLocation(FinacialStaffHighFrame.w - 30, 0);
    min.setLocation(FinacialStaffHighFrame.w - 80, 0);
    _return.setLocation(20, 50);
    // 功能按钮
    goto_AccountManage.setLocation(0, 150);
    goto_CostManage.setLocation(0, 200);
    goto_SettlementManage.setLocation(0, 250);
    goto_Statistic.setLocation(0, 300);
    goto_BaseDataSetting.setLocation(0, 350);
    goto_SystemLog.setLocation(0, 400);

    // 其他组件
    id = new JLabel("付款单单号:   " + bl.createMoneyOutListId());
    id.setSize((int) (16 * 20 * 1.07f), 16);
    id.setFont(new Font("宋体", Font.BOLD, 15));
    id.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 30);

    JLabel l1 = new JLabel("付款人:");
    l1.setSize((int) (16 * 4 * 1.07f), 16);
    l1.setFont(new Font("宋体", Font.BOLD, 15));
    l1.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80);
    pay_man = new JTextField();
    pay_man.setSize(150, 20);
    pay_man.setLocation(FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 - 3);

    JLabel l2 = new JLabel("付款日期:");
    l2.setSize((int) (16 * 5 * 1.07f), 16);
    l2.setFont(new Font("宋体", Font.BOLD, 15));
    l2.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 50);
    Date date_ = new Date();
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String time = format.format(date_);
    pay_date = new JTextField(time);
    pay_date.setSize(150, 20);
    pay_date.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 50 - 3);

    JLabel l3 = new JLabel("付款金额:");
    l3.setSize((int) (16 * 5 * 1.07f), 16);
    l3.setFont(new Font("宋体", Font.BOLD, 15));
    l3.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 100);
    money = new JTextField();
    money.setSize(150, 20);
    money.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 100 - 3);

    JLabel l4 = new JLabel("付款账号:");
    l4.setSize((int) (16 * 5 * 1.07f), 16);
    l4.setFont(new Font("宋体", Font.BOLD, 15));
    l4.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 150);
    bankcard = new JTextField();
    bankcard.setSize(150, 20);
    bankcard.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 150 - 3);

    JLabel l5 = new JLabel("备注:");
    l5.setSize((int) (16 * 3 * 1.07f), 16);
    l5.setFont(new Font("宋体", Font.BOLD, 15));
    l5.setLocation(FinacialStaffHighFrame.w / 6 + 40, 128 + 80 + 200);
    note = new JTextArea();
    note.setSize(200, 100);
    note.setBorder(BorderFactory.createEtchedBorder());
    note.setLocation(
        FinacialStaffHighFrame.w / 6 + 40 + (int) (16 * 5 * 1.07f), 128 + 80 + 200 - 3);

    JLabel l6 = new JLabel("付款条目:");
    l6.setSize((int) (16 * 5 * 1.07f), 16);
    l6.setFont(new Font("宋体", Font.BOLD, 15));
    l6.setLocation(600, 128 + 80);

    rent = new JRadioButton("租金", true);
    rent.setSize((int) (20 * 3 * 1.07f), 20);
    rent.setFont(new Font("宋体", Font.BOLD, 16));
    rent.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80);
    rent.setOpaque(false);

    deli_price = new JRadioButton("运费", false);
    deli_price.setSize((int) (20 * 3 * 1.07f), 20);
    deli_price.setFont(new Font("宋体", Font.BOLD, 16));
    deli_price.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80 + 30);
    deli_price.setOpaque(false);

    salary = new JRadioButton("人员工资", false);
    salary.setSize((int) (20 * 5 * 1.07f), 20);
    salary.setFont(new Font("宋体", Font.BOLD, 16));
    salary.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80 + 60);
    salary.setOpaque(false);

    reward = new JRadioButton("奖励", false);
    reward.setSize((int) (20 * 3 * 1.07f), 20);
    reward.setFont(new Font("宋体", Font.BOLD, 16));
    reward.setLocation(600 + (int) (16 * 5 * 1.07f), 128 + 80 + 90);
    reward.setOpaque(false);

    buttonGroup = new ButtonGroup();
    buttonGroup.add(rent);
    buttonGroup.add(deli_price);
    buttonGroup.add(salary);
    buttonGroup.add(reward);

    JLabel l7 = new JLabel("新建付款单:");
    l7.setSize((int) (16 * 6 * 1.07f), 16);
    l7.setFont(new Font("宋体", Font.BOLD, 15));
    l7.setLocation(596 - 30 / 2 - (int) (16 * 6 * 1.07f), 600 + 5);
    confirm.setLocation(596 - 30 / 2, 600);

    add(titleLabel);
    add(funLabel);
    add(currentuserAgencyNameLabel);
    add(currentuserLabel);
    add(currentusernameLabel);

    add(close);
    add(min);
    add(_return);
    add(goto_AccountManage);
    add(goto_CostManage);
    add(goto_SettlementManage);
    add(goto_Statistic);
    add(goto_BaseDataSetting);
    add(goto_SystemLog);

    add(id);
    add(l1);
    add(pay_man);
    add(l2);
    add(pay_date);
    add(l3);
    add(money);
    add(l4);
    add(bankcard);
    add(l5);
    add(note);
    add(l6);

    add(rent);
    add(deli_price);
    add(salary);
    add(reward);

    add(l7);
    add(confirm);
  }
Example #11
0
  public static void main(String[] args) {
    f = new JFrame("Server");
    f.setVisible(true);
    f.setSize(500, 360);
    f.setLocation(100, 100);
    f.setLayout(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setBackground(Color.black);
    f.setAlwaysOnTop(true);

    a = new JTextArea();
    a.setVisible(true);
    a.setSize(f.getWidth(), f.getHeight() - 60);
    a.setLocation(0, 0);
    a.setEditable(false);
    a.setBackground(Color.black);
    a.setForeground(Color.white);
    DefaultCaret caret = (DefaultCaret) a.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

    b = new JTextField();
    b.setVisible(true);
    b.setSize(f.getWidth() - 110, 20);
    b.setLocation(5, f.getHeight() - 65);
    b.setBackground(Color.black);
    b.setForeground(Color.white);
    f.add(b);

    c = new JScrollPane(a);
    c.setVisible(true);
    c.setSize(f.getWidth() - 20, f.getHeight() - 70);
    c.setLocation(1, 1);
    c.setBackground(Color.black);
    c.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    c.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    c.setAutoscrolls(true);
    f.add(c);

    d = new JButton("INVIA");
    d.setVisible(true);
    d.setSize(90, 20);
    d.setLocation(f.getWidth() - 105, f.getHeight() - 65);
    f.add(d);

    f.repaint();

    f.addComponentListener(
        new ComponentListener() {

          @Override
          public void componentShown(ComponentEvent arg0) {}

          @Override
          public void componentResized(ComponentEvent arg0) {
            a.setSize(f.getWidth(), f.getHeight() - 60);
            b.setSize(f.getWidth() - 110, 20);
            b.setLocation(5, f.getHeight() - 65);
            c.setSize(f.getWidth() - 20, f.getHeight() - 70);
            d.setLocation(f.getWidth() - 100, f.getHeight() - 65);
          }

          @Override
          public void componentMoved(ComponentEvent arg0) {}

          @Override
          public void componentHidden(ComponentEvent arg0) {}
        });

    b.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            console();
          }
        });

    d.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            console();
          }
        });

    Thread t = new Thread(new restart());
    t.start();

    s = new Server();
    s.start(6677);
  }
Example #12
0
  public Sale() {

    // 计算销售公司的总销售额和各销售员的佣金。

    // 设置字体
    button1.setFont(f2);
    button1.setBounds(350, 50, 150, 50);
    button2.setFont(f2);
    button2.setBounds(550, 50, 150, 50);
    text1.setText("00");
    text2.setText("00");
    text3.setText("00");
    ta1.setLocation(20, 20);
    ta1.setSize(300, 200);
    ta1.setText(" 输出结果!");
    ta1.setVisible(true);
    // text4.setEditable(false);
    ta1.setEnabled(false);
    ta2.setLocation(20, 20);
    ta2.setSize(300, 200);
    //		ta2.setForeground(Color.red);
    ta2.setText(
        "各销售员每月至少需售出 白酒50瓶, 红酒30瓶, 啤酒300瓶。\n每月的最高供应量:白酒为5000瓶,红酒为3000瓶,啤酒为30000瓶。\n白酒、红酒和啤酒的单价分别为168元/瓶、 120元/瓶、5元/瓶。");
    ta2.setVisible(true);
    // text4.setEditable(false);
    ta2.setEnabled(false);

    // 确定
    button1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // 判断是否是按钮
            if (e.getSource() == button1) {
              // 添加正则表达式 验证输入数据是否满足 XXXX-XX-XX的日期格式
              // 字符转整形??
              text1.setText(text1.getText());
              text2.setText(text2.getText());
              text3.setText(text3.getText());
              str1 = text1.getText();
              str2 = text2.getText();
              str3 = text3.getText();

              ta1.setText(ta1.getText());
              str4 = ta1.getText();

              if (((Integer.parseInt(str1) >= b1) && (Integer.parseInt(str1) <= a1))
                  && ((Integer.parseInt(str2) >= b2) && (Integer.parseInt(str2) <= a2))
                  && ((Integer.parseInt(str3) >= b3) && (Integer.parseInt(str3) <= a3))) {

                c1 = Integer.parseInt(str1) * x1;
                c2 = Integer.parseInt(str2) * x2;
                c3 = Integer.parseInt(str3) * x3;
                c4 = c1 + c2 + c3;
                str4 = ":" + c4;
                // 分别计算利润
                if (c4 < w1) {
                  str5 = "" + (c4 * 0.04);
                } else if ((c4 > w1) && (c4 < w2)) {
                  str5 = "" + (((c4 - 20000) * 0.01) + (20000 * 0.04));
                } else {
                  str5 = "" + (((c4 - 45000) * 0.005) + (25000 * 0.01) + (20000 * 0.04));
                }
                ta1.setFont(f2);
                ta1.setText(
                    "利润结果统计表:"
                        + "\n\t白酒销售额:"
                        + c1
                        + "\n\t红酒销售额:"
                        + c2
                        + "\n\t啤酒销售额:"
                        + c3
                        + "\n总销售额:"
                        + str4
                        + "\n总利润:"
                        + str5);

              } else {
                str4 = "出错了!";
                if (!((Integer.parseInt(str1) >= b1) && (Integer.parseInt(str1) <= a1))) {
                  text1.setText(str4);
                }
                if (!((Integer.parseInt(str2) >= b2) && (Integer.parseInt(str2) <= a2))) {
                  text2.setText(str4);
                }
                if (!((Integer.parseInt(str3) >= b3) && (Integer.parseInt(str3) <= a3))) {
                  text3.setText(str4);
                }
                ta1.setFont(f2);
                ta1.setText(str4);
              }
            }
          }
        });
    // 确定
    button2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // 判断是否是按钮
            if (e.getSource() == button2) {
              // 添加正则表达式 验证输入数据是否满足 XXXX-XX-XX的日期格式
              // 字符转整形??

              text1.setText("");
              text2.setText("");
              text3.setText("");
              ta1.setText("请输入数据!");
            }
          }
        });
    frame1.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(1);
          }
        });

    // 创建布局
    // GridLayout gl1 = new GridLayout(2, 3);// 设置网格布局(h,v)
    FlowLayout fl1 = new FlowLayout(FlowLayout.CENTER, 20, 12); // 对齐,H间距,V间距{设置流式布局(panel默认布局)从左到右
    // 依次}
    // 现在所有的内容都加入到了JPanel1之中
    panel1.add(label1);
    panel1.add(text1);
    panel1.add(label2);
    panel1.add(text2);
    panel1.add(label3);
    panel1.add(text3);
    panel1.add(ta2);

    panel1.setSize(770, 300); // panel1.setBounds(0, 0, 200, 100);
    panel1.setLocation(10, 10);
    panel1.setBackground(Color.green);
    panel1.setLayout(fl1);

    panel2.add(label4);
    panel2.add(ta1);
    panel2.add(button1);
    panel2.add(button2);

    panel2.setSize(770, 300);
    panel2.setLayout(null);
    panel2.setLocation(10, 320); //
    panel2.setBackground(Color.blue);
    //		panel2.setLayout(fl1);
    frame1.setResizable(false);
    frame1.add(panel1); // 将面板加入到窗体之上
    frame1.add(panel2); // 将面板加入到窗体之上
    // 设置属性
    frame1.setLayout(null); // 参数null可以取消frame布局,使用绝对布局
    frame1.setBounds(200, 30, 800, 670); // 绝对布局
    frame1.setFont(font2);
    frame1.setBackground(Color.RED); // 设置窗体的背景颜色?//frame1.setForeground(Color.BLUE);将前景色设置成蓝色
    frame1.setVisible(true); // 让组件可见
  }