Ejemplo n.º 1
0
  private void initPanel() {
    JLabel sizeLabel = new JLabel("capacity");
    sizeLabel.setBounds(5, 5, 900, 25);
    add(sizeLabel);
    roomSize = new RestrictedTextField(RestrictedTextField.RESTRICTION_INT, -1);
    roomSize.setBounds(sizeLabel.getX(), sizeLabel.getY() + sizeLabel.getHeight() + 5, 150, 25);
    roomSize.addKeyListener(
        new KeyListener() {
          @Override
          public void keyTyped(KeyEvent arg0) {
            room.setcapacity(Integer.parseInt(roomSize.getText()));
            editVector.add(new Wrapper<Room>(room, Edit.edited));
          }

          @Override
          public void keyPressed(KeyEvent e) {}

          @Override
          public void keyReleased(KeyEvent e) {}
        });
    add(roomSize);

    JLabel hardwareLabel = new JLabel("Harware");
    hardwareLabel.setBounds(roomSize.getX(), roomSize.getY() + 20, 900, 25);
    add(hardwareLabel);
    hardwarePanel = new HardwarePanel(hardwares, editVector);
    JScrollPane scroll = new JScrollPane(hardwarePanel);
    scroll.setBounds(
        hardwareLabel.getX(), hardwareLabel.getY() + hardwareLabel.getHeight() + 5, 320, 150);
    add(scroll);
  }
Ejemplo n.º 2
0
 public void run() {
   try {
     while (läuft) {
       Thread.sleep(1);
       if (verloren) {
         verloren();
       } else {
         if (intro) {
           rot.setIcon(new ImageIcon("files/Minigames/Senso/red_n.png"));
           gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_n.png"));
           blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_n.png"));
           gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_n.png"));
           lblVerloren.setText("");
           start.setText("3");
           Thread.sleep(1000);
           start.setText("2");
           Thread.sleep(1000);
           start.setText("1");
           Thread.sleep(1000);
           start.setLocation(start.getX() - 20, start.getY());
           start.setText("Los!");
           Thread.sleep(250);
           start.setText("");
           start.setLocation(start.getX() + 20, start.getY());
           rot.setIcon(new ImageIcon("files/Minigames/Senso/red_0.png"));
           gruen.setIcon(new ImageIcon("files/Minigames/Senso/green_0.png"));
           blau.setIcon(new ImageIcon("files/Minigames/Senso/blue_0.png"));
           gelb.setIcon(new ImageIcon("files/Minigames/Senso/yellow_0.png"));
           intro = false;
           neu = true;
         }
         if (wiedergeben && !verloren) {
           Thread.sleep(500);
           alteFarbe();
         } else if (neu && !verloren) neueFarbe();
         if (!wiedergeben && !neu) {
           String s = "Noch ";
           vKlicks = runde - klick;
           if (vKlicks >= 1) s = s + String.valueOf(vKlicks);
           else s = "";
           klicks.setText(s);
         } else klicks.setText("");
       }
     }
   } catch (Exception e) {
   }
 }
Ejemplo n.º 3
0
  /**
   * Realiza el movimiento grafico del bomberman, dado una direccion
   *
   * @param indice int direccion
   */
  public void movimientoGrafico(int indice) {
    int velo = MovPix / MovBomb;
    try {
      if (indice == 0) // arriba
      {
        for (int i = 0, arg = 0; i < velo; i++, arg = (arg + 1) % 3) {
          BomberLabel.setLocation(BomberLabel.getX(), BomberLabel.getY() - MovBomb);
          BomberLabel.setIcon(BombermanArriba[arg]);
          BT.sleep(velocidadSleep);
        }
      } else if (indice == 1) // abajo
      {
        for (int i = 0, arg = 0; i < velo; i++, arg = (arg + 1) % 3) {
          BomberLabel.setLocation(BomberLabel.getX(), BomberLabel.getY() + MovBomb);
          BomberLabel.setIcon(BombermanAbajo[arg]);
          BT.sleep(velocidadSleep);
        }
      } else if (indice == 2) // izq
      {
        for (int i = 0, arg = 0; i < velo; i++, arg = (arg + 1) % 3) {
          BomberLabel.setLocation(BomberLabel.getX() - MovBomb, BomberLabel.getY());
          BomberLabel.setIcon(BombermanIzquierda[arg]);
          BT.sleep(velocidadSleep);
        }
      } else if (indice == 3) // der
      {
        for (int i = 0, arg = 0; i < velo; i++, arg = (arg + 1) % 3) {
          BomberLabel.setLocation(BomberLabel.getX() + MovBomb, BomberLabel.getY());
          BomberLabel.setIcon(BombermanDerecha[arg]);
          BT.sleep(velocidadSleep);
        }
      }

    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Ejemplo n.º 4
0
  @Override
  public void paintComponent(Graphics g) {
    final JLabel lbl = CHomeUI.SINGLETON_INSTANCE.getLblSelected();
    int yTop = (lbl.getY() + lbl.getParent().getY());

    // super.paintComponent(g);
    final Graphics2D g2d = (Graphics2D) g.create();
    final int w = getWidth();
    final int h = getHeight();

    FSkin.setGraphicsColor(g2d, d20);

    // Selected in this group, don't draw background under selected label.
    if (getY() < yTop && yTop < getY() + h) {
      g2d.fillRect(0, 0, w, lbl.getY());
      g2d.fillRect(0, lbl.getY() + lbl.getHeight(), w, h);

      FSkin.setGraphicsGradientPaint(g2d, w - 8, 0, l00, w, 0, d80);
      g2d.fillRect(w - 6, 0, w, lbl.getY());
      g2d.fillRect(w - 6, lbl.getY() + lbl.getHeight(), w, h);
    }
    // Selected not in this group; draw full background.
    else {
      g2d.fillRect(0, 0, w, h);

      FSkin.setGraphicsGradientPaint(g2d, w - 8, 0, l00, w, 0, d80);
      g2d.fillRect(w - 6, 0, w, h);
    }

    FSkin.setGraphicsColor(g2d, l10);
    g2d.drawLine(0, h - 1, w - 1, h - 1);

    FSkin.setGraphicsColor(g2d, d60);
    g2d.drawLine(0, 0, w - 1, 0);

    g2d.dispose();
  }
Ejemplo n.º 5
0
  // Used to change cell states manually when game isn't running
  private void manualCell(java.awt.event.MouseEvent e) {
    // Gets coordinates of clicked cell
    JLabel cell = (JLabel) e.getSource();
    int x = cell.getX() / 18;
    int y = cell.getY() / 18;

    // Changes state of the cell
    if (alive[x][y]) {
      alive[x][y] = false;
      cells[x][y].setIcon(white);
    } else {
      alive[x][y] = true;
      cells[x][y].setIcon(black);
    }
  }
Ejemplo n.º 6
0
  private void resizeCantor(int width, int height) {
    int cantorEWidth = (width - 200) / 3;
    int cantorJtaHeight = 18;
    int cantorYList = 300;

    int cantorBWidth = 100;
    int cantorBHeight = 25;
    cantorPay.setBounds(10, 10, 150, cantorJtaHeight);
    cantorCurrL1.setBounds(10, 10, 150, 18);
    cantorScrollPane.setBounds(
        cantorCurrL1.getX() + cantorCurrL1.getWidth() + 40, cantorYList - 270, 500, 230);
    cantorBuyLabel.setBounds(
        cantorScrollPane.getX(), cantorScrollPane.getY() - 20, cantorEWidth, 18);
    cantorCurrBox1.setBounds(10, cantorCurrL1.getY() + 20, 100, 20);
    cantorCurrL2.setBounds(10, cantorCurrBox1.getY() + 20, cantorEWidth, 18);
    cantorCurrBox2.setBounds(cantorCurrBox1.getX(), cantorCurrL2.getY() + 20, 100, 20);
    cantorPrice.setBounds(cantorCurrBox2.getX(), cantorCurrBox2.getY() + 30, 150, cantorJtaHeight);
    cantorAmountJta.setBounds(cantorPrice.getX(), cantorPrice.getY() + 20, 100, cantorJtaHeight);
    cantorResButton.setBounds(
        cantorAmountJta.getX(), cantorAmountJta.getY() + 22, cantorBWidth, cantorBHeight);
    cantorCostLabel.setBounds(
        cantorResButton.getX(), cantorResButton.getY() + 28, 150, cantorJtaHeight);
    cantorCostJta.setBounds(
        cantorCostLabel.getX(), cantorCostLabel.getY() + 22, 100, cantorJtaHeight);
    cantorClientL.setBounds(10, cantorCostJta.getY() + 80, cantorEWidth, 18);
    cantorPESJta.setBounds(cantorClientL.getX(), cantorClientL.getY() + 22, 100, cantorJtaHeight);
    cantorPESButton.setBounds(
        cantorPESJta.getX(), cantorPESJta.getY() + 22, cantorBWidth, cantorBHeight);
    cantorScrollClientPane.setBounds(
        cantorScrollPane.getX(),
        cantorScrollPane.getY() + cantorScrollPane.getHeight() + 30,
        550,
        230);
    cantorDoIt.setBounds(
        cantorCostJta.getX(), cantorCostJta.getY() + 300, cantorBWidth + 50, cantorBHeight);
  }
Ejemplo n.º 7
0
  /** Diese Methode extrahiert die Daten den Kontakts und zeigt sie auf der Gui an. */
  private void initContactInfo() {
    lblValid.setText("" + contact.getId());
    lblVallasttime.setText("" + (new Date(contact.getLast_time_contacted())));
    lblValname.setText(contact.getDisplay_name());
    if (contact.getOrganisationName() != null) lblValorga.setText(contact.getOrganisationName());
    if (contact.getOrganisationStatus() != null)
      lblValstatus.setText(contact.getOrganisationStatus());
    lblValtimes.setText("" + contact.getTimes_contacted());

    String temp = "";
    if (contact.getEmails() != null) {
      for (String s : contact.getEmails()) temp += s + "\n";
    }
    areaEmails.setText(temp);

    temp = "";
    if (contact.getEmails() != null) {
      for (String s : contact.getNotes()) temp += s + "\n";
    }
    areaNotes.setText(temp);

    temp = "";
    if (contact.getEmails() != null) {
      for (String s : contact.getMessaging()) temp += s + "\n";
    }
    areaMessaging.setText(temp);

    temp = "";
    if (contact.getEmails() != null) {
      for (String s : contact.getPhones()) temp += s + "\n";
    }
    areaPhones.setText(temp);

    temp = "";
    if (contact.getStreet() != null) temp += contact.getStreet() + "\n";
    if (contact.getCity() != null) temp += contact.getCity() + "\n";
    if (contact.getRegion() != null) temp += contact.getRegion() + " ";
    if (contact.getCountry() != null) temp += contact.getCountry();
    areaAdress.setText(temp);

    if (contact.getPhoto() != null) {
      ImageIcon image = new ImageIcon(contact.getPhoto());
      Image img = image.getImage();
      Image newimg = img.getScaledInstance(145, 145, java.awt.Image.SCALE_SMOOTH);
      lblPicture.setIcon(new ImageIcon(newimg));
      lblPicture.setBounds(lblPicture.getX(), lblPicture.getY(), 145, 145);
    }
  }
  public void content() {
    Font font00 = new Font("宋体", Font.BOLD, 20);
    Font font0 = new Font("宋体", Font.BOLD, 16);
    Font font = new Font("宋体", Font.BOLD, 15);
    line1 = new JLabel("————————————————————————");
    line1.setFont(font0);
    line1.setBounds(
        listpanel.getX() - panel.getWidth() / 15,
        listpanel.getY() - panel.getHeight() / 20,
        panel.getWidth() * 3 / 5,
        panel.getHeight() / 10);

    line2 = new JLabel("——————————————————————");
    line2.setFont(font0);
    line2.setForeground(Color.GRAY);
    line2.setBounds(
        listpanel.getX() - panel.getWidth() / 30,
        listpanel.getY() + panel.getHeight() / 36,
        panel.getWidth() * 3 / 5,
        panel.getHeight() / 10);

    line3 = new JLabel("——————————————————————");
    line3.setFont(font0);
    line3.setForeground(Color.GRAY);
    line3.setBounds(
        listpanel.getX() - panel.getWidth() / 30,
        listpanel.getY() + panel.getHeight() / 100 * 75,
        panel.getWidth() * 3 / 5,
        panel.getHeight() / 10);

    ok = new JButton("提交");
    ok.setFont(font);
    ok.setBounds(
        listpanel.getX() + panel.getWidth() * 2 / 5,
        listpanel.getY() + panel.getHeight() * 30 / 40,
        panel.getWidth() / 10,
        panel.getHeight() / 20);

    cancel = new JButton("取消");
    cancel.setFont(font);
    cancel.setBounds(
        ok.getX() - panel.getWidth() / 7, ok.getY(), panel.getWidth() / 10, panel.getHeight() / 20);

    outList = new JLabel("出库单");
    outList.setFont(font00);
    outList.setBounds(
        listpanel.getX() - panel.getWidth() / 15,
        listpanel.getY() - panel.getHeight() / 13,
        panel.getWidth() / 10,
        panel.getHeight() / 10);

    cargoinfo = new JLabel("货物信息");
    cargoinfo.setFont(font0);
    cargoinfo.setBounds(
        listpanel.getX() - panel.getWidth() / 30,
        listpanel.getY(),
        panel.getWidth() / 10,
        panel.getHeight() / 10);

    bar = new JLabel("订单号");
    bar.setFont(font);
    bar.setBounds(
        cargoinfo.getX(),
        cargoinfo.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    /*		code=new JLabel("出库单号:");
    	code.setFont(font);
    	code.setBounds(cargoinfo.getX(),bar.getY()+panel.getHeight()/13,panel.getWidth()/5, panel.getHeight()/10);
    */
    outDate = new JLabel("出库日期:");
    outDate.setFont(font);
    outDate.setBounds(
        cargoinfo.getX(),
        bar.getY() + panel.getHeight() / 14,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    distination = new JLabel("目的地:");
    distination.setFont(font);
    distination.setBounds(
        cargoinfo.getX(),
        outDate.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    damageCondition = new JLabel("损坏情况");
    damageCondition.setFont(font);
    damageCondition.setBounds(
        cargoinfo.getX(),
        distination.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    good = new JCheckBox("完好");
    good.setFont(font);
    good.setBounds(
        damageCondition.getX() + panel.getWidth() / 8,
        damageCondition.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);

    damage = new JCheckBox("损坏");
    damage.setFont(font);
    damage.setBounds(
        good.getX() + panel.getWidth() / 8,
        damageCondition.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);

    loadingtype = new JLabel("装运形式:");
    loadingtype.setFont(font);
    loadingtype.setBounds(
        damageCondition.getX(),
        damageCondition.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    tB = new JCheckBox("火车");
    tB.setFont(font);
    tB.setBounds(
        loadingtype.getX() + panel.getWidth() / 8,
        loadingtype.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    pB = new JCheckBox("飞机");
    pB.setFont(font);
    pB.setBounds(
        tB.getX() + panel.getWidth() / 8,
        loadingtype.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    bB = new JCheckBox("汽车");
    bB.setFont(font);
    bB.setBounds(
        pB.getX() + panel.getWidth() / 8,
        loadingtype.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);

    //		transfercode=new JLabel("中转单编号:");
    //		transfercode.setFont(font);
    //		transfercode.setBounds(cargoinfo.getX(),bB.getY()+panel.getHeight()/14,panel.getWidth()/5,
    // panel.getHeight()/10);

    //	codetext = new JTextField();
    //	codetext.setBounds(code.getX()+panel.getWidth()/8,code.getY()+panel.getWidth()/50,panel.getWidth()/6, panel.getHeight()/20);

    /*	tip1 = new JLabel("*请输入10位有效出库单号");
    tip1.setFont(new Font("宋体", Font.BOLD, 12));
    tip1.setForeground(Color.GRAY);
    tip1.setBounds(codetext.getX()+codetext.getWidth()+panel.getWidth()/50,code.getY(),panel.getWidth()/3, panel.getHeight()/10);
    */
    vehicleCode = new JLabel("汽运编号:");
    vehicleCode.setFont(font);
    vehicleCode.setBounds(
        cargoinfo.getX(),
        bB.getY() + panel.getHeight() / 14,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    bartext = new JTextField();
    bartext.setBounds(
        bar.getX() + panel.getWidth() / 8,
        bar.getY() + panel.getWidth() / 50,
        panel.getWidth() / 6,
        panel.getHeight() / 20);

    distext = new JTextField();
    distext.setBounds(
        distination.getX() + panel.getWidth() / 8,
        distination.getY() + panel.getWidth() / 50,
        panel.getWidth() / 6,
        panel.getHeight() / 20);

    //	transtext = new JTextField();
    //	transtext.setBounds(transfercode.getX()+panel.getWidth()/7,transfercode.getY()+panel.getWidth()/50,panel.getWidth()/6, panel.getHeight()/20);

    vehtext = new JTextField();
    vehtext.setBounds(
        distination.getX() + panel.getWidth() / 7,
        vehicleCode.getY() + panel.getWidth() / 50,
        panel.getWidth() / 6,
        panel.getHeight() / 20);

    /*		tip2 = new JLabel("*请输入14位有效中转单编号");
    	tip2.setFont(new Font("宋体", Font.BOLD, 12));
    	tip2.setForeground(Color.GRAY);
    	tip2.setBounds(transtext.getX()+transtext.getWidth()+panel.getWidth()/50,transfercode.getY(),panel.getWidth()/3, panel.getHeight()/10);
    */

    year = new JComboBox();
    month = new JComboBox();
    day = new JComboBox();
    String[] arr1 = new String[1000]; // 数组时个对象,对象在使用前要初始化
    for (int i = 0; i < 1000; i++) {
      arr1[i] = i + 2000 + "年";
    }

    year = new JComboBox(arr1);
    Calendar calendar = Calendar.getInstance();

    String y = String.valueOf(calendar.get(Calendar.YEAR)) + "年";
    for (String y1 : arr1) {
      if (y1.equals(y)) {
        year.setSelectedItem(y);
      }
    }
    year.setBounds(
        outDate.getX() + panel.getWidth() / 8,
        outDate.getY() + panel.getWidth() / 50,
        panel.getWidth() / 11,
        panel.getHeight() / 20);

    String[] arr2 = new String[12];
    for (int i = 0; i < 12; i++) {
      arr2[i] = i + 1 + "月";
    }

    month = new JComboBox(arr2);
    String m = String.valueOf(calendar.get(Calendar.MONTH) + 1) + "月";
    for (String m1 : arr2) {
      if (m1.equals(m)) {
        month.setSelectedItem(m1);
      }
    }

    month.setBounds(
        year.getX() + year.getWidth() + panel.getWidth() / 100,
        outDate.getY() + panel.getWidth() / 50,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    String[] arr30 = new String[31];
    for (int i = 0; i < 31; i++) {
      arr30[i] = i + 1 + "日";
    }

    day = new JComboBox(arr30);

    String d = String.valueOf(calendar.get(Calendar.DATE)) + "日";
    for (String d1 : arr30) {
      if (d1.equals(d)) {
        day.setSelectedItem(d1);
      }
    }
    day.setBounds(
        month.getX() + month.getWidth() + panel.getWidth() / 100,
        outDate.getY() + panel.getWidth() / 50,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    listpanel.add(day);

    month.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent arg0) {
            // TODO Auto-generated method stub
            listpanel.remove(day);
            switch (month.getSelectedItem().toString()) {
              case "1月":
              case "3月":
              case "5月":
              case "7月":
              case "8月":
              case "10月":
              case "12月":
                String[] arr31 = new String[31];
                for (int i = 0; i < 31; i++) {
                  arr31[i] = i + 1 + "日";
                }

                day = new JComboBox(arr31);
                day.setBounds(
                    month.getX() + month.getWidth() + panel.getWidth() / 100,
                    outDate.getY() + panel.getWidth() / 50,
                    panel.getWidth() / 12,
                    panel.getHeight() / 20);
                listpanel.add(day);
                break;
              case "4月":
              case "6月":
              case "9月":
              case "11月":
                String[] arr3 = new String[30];
                for (int i = 0; i < 30; i++) {
                  arr3[i] = i + 1 + "日";
                }

                day = new JComboBox(arr3);
                day.setBounds(
                    month.getX() + month.getWidth() + panel.getWidth() / 100,
                    outDate.getY() + panel.getWidth() / 50,
                    panel.getWidth() / 12,
                    panel.getHeight() / 20);
                listpanel.add(day);
                break;
              case "2月":
                if (isLeap(year.getSelectedItem().toString())) {
                  String[] arr33 = new String[29];
                  for (int i = 0; i < 29; i++) {
                    arr33[i] = i + 1 + "日";
                  }

                  day = new JComboBox(arr33);
                  day.setBounds(
                      month.getX() + month.getWidth() + panel.getWidth() / 100,
                      outDate.getY() + panel.getWidth() / 50,
                      panel.getWidth() / 12,
                      panel.getHeight() / 20);
                  listpanel.add(day);
                } else {
                  String[] arr333 = new String[28];
                  for (int i = 0; i < 28; i++) {
                    arr333[i] = i + 1 + "日";
                  }

                  day = new JComboBox(arr333);
                  day.setBounds(
                      month.getX() + month.getWidth() + panel.getWidth() / 100,
                      outDate.getY() + panel.getWidth() / 50,
                      panel.getWidth() / 12,
                      panel.getHeight() / 20);
                  listpanel.add(day);
                }
                break;
              default:
                break;
            }
          }
        });

    listpanel.add(year);
    listpanel.add(month);
    listpanel.add(day);
    listpanel.add(line1);
    listpanel.add(line2);
    listpanel.add(line3);
    //	listpanel.add(tip1);
    //	listpanel.add(tip2);
    listpanel.add(outList);
    listpanel.add(ok);
    listpanel.add(cancel);
    listpanel.add(bar);
    //	listpanel.add(code);
    listpanel.add(cargoinfo);
    listpanel.add(outDate);
    listpanel.add(distination);
    listpanel.add(loadingtype);
    listpanel.add(damageCondition);
    listpanel.add(good);
    listpanel.add(damage);
    listpanel.add(pB);
    listpanel.add(bB);
    listpanel.add(tB);
    //	listpanel.add(transfercode);
    listpanel.add(vehicleCode);
    listpanel.add(vehtext);
    listpanel.add(bartext);
    //	listpanel.add(codetext);
    listpanel.add(distext);
    //	listpanel.add(transtext);

    ok.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {

            String date =
                ((year.getSelectedIndex() + 2000) + "/")
                    + ((month.getSelectedIndex() + 1) + "/")
                    + ((day.getSelectedIndex() + 1 + ""));

            String damageCondition = null;
            if (good.isSelected()) {
              damageCondition = "完好";
            }
            if (damage.isSelected()) {
              damageCondition = "损坏";
            }

            TransType transtype = TransType.BUS;
            if (tB.isSelected()) {
              transtype = TransType.TRAIN;
            }
            if (bB.isSelected()) {
              transtype = TransType.BUS;
            }
            if (pB.isSelected()) {
              transtype = TransType.PLANE;
            }

            WarehouseMemory memory = (WarehouseMemory) ((WritePanel) panel).getMemory();
            String code = memory.getWarehouseOutCode();
            ReceiptCode cal = ConstructFactory.calculateCode();
            code = cal.calculCode(code, memory.getUserName());
            System.out.println(code);

            // code出库单号、bar为订单号

            WarehouseOutVO warehouseOutVO =
                new WarehouseOutVO(
                    bartext.getText(),
                    code,
                    distext.getText(),
                    date,
                    transtype,
                    ((WritePanel) panel).getBelong(),
                    vehtext.getText(),
                    damageCondition);

            WarehouseBLService service = ConstructFactory.WarehouseFactory();
            boolean key = service.WarehouseOut(warehouseOutVO);
            if (key) {
              WarehouseReceipt wr = ConstructFactory.WarehouseReceiptFactory();
              wr.saveWarehouseOutCode(code, memory.getUserName());
              memory.setWarehouseOutCode(memory.getWarehouseOutCode() + " " + code);
              memory.setWarehouseOutDate(memory.getWarehouseOutDate() + " " + date);
            }
          }
        });

    cancel.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            remove();
            panel.repaint();
          }
        });
  }
Ejemplo n.º 9
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == start) {
      t.start();

      result.setVisible(false);
      scoreValue = 0;
      speed.setText("SPEED " + 40); // this is starting speeed
    }

    if (count % 10 == 0) {
      carNo = CarRace.randInt();

      if (carNo == 1 && flag1 == 0) {
        one.setVisible(true);
        one.setBounds(120, 100, 120, 70);
        pos1 = 100;
        flag1 = 1;
      }
      if (carNo == 2 && flag2 == 0) {
        two.setVisible(true);
        two.setBounds(240, 100, 120, 70);
        pos2 = 100;
        flag2 = 1;
      }

      if (carNo == 3 && flag3 == 0) {
        three.setVisible(true);
        three.setBounds(360, 100, 120, 70);
        pos3 = 100;
        flag3 = 1;
      }
    }

    count++;
    if (count >= 1000) count = 0;

    if (one.isVisible() == true) {
      one.setBounds(120, pos1, 120, 70);
      pos1 += 10;
      if (pos1 > 520) {
        flag1 = 0;
        one.setVisible(false);
      }
    }

    if (two.isVisible() == true) {
      two.setBounds(240, pos2, 120, 70);
      pos2 += 10;
      if (pos2 > 520) {
        flag2 = 0;
        two.setVisible(false);
      }
    }

    if (three.isVisible() == true) {
      three.setBounds(360, pos3, 120, 70);
      pos3 += 10;
      if (pos3 > 520) {
        flag3 = 0;
        three.setVisible(false);
      }
    }

    if (one.getY() + 70 == car.getY() && car.getX() == 120) {
      t.stop();
      result.setText(" SCORE " + scoreValue);
      result.setVisible(true);
    } else if (two.getY() + 70 == car.getY() && car.getX() == 240) {
      t.stop();
      result.setText(" SCORE " + scoreValue);
      result.setVisible(true);
    } else if (three.getY() + 70 == car.getY() && car.getX() == 360) {
      t.stop();
      result.setText(" SCORE " + scoreValue);
      result.setVisible(true);
    }

    scoreValue += 1;
    score.setText("score " + scoreValue);

    int m = 160 - x;
    if (m < 0) m = 0;
    speed.setText("SPEED " + m);
  }
  private void jbInit() throws Exception {

    this.setJMenuBar(menuBar);
    this.getContentPane().setLayout(layoutMain);
    panelCenter.setLayout(null);

    this.setTitle("Facturas Taxi. Mariano y Conchi");
    menuFile.setText("Archivo");
    menuFileExit.setText("Salir");
    menuFileExit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            fileExit_ActionPerformed(ae);
          }
        });
    menuHelp.setText("Ayuda");
    menuHelpAbout.setText("Sobre");
    menuHelpAbout.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            helpAbout_ActionPerformed(ae);
          }
        });
    statusBar.setText("");
    buttonOpen.setToolTipText("Abrir Ficha Cliente");
    buttonOpen.setIcon(imageOpen);
    buttonOpen.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            abrirFicheroExpediente();
          }
        });

    buttonClose.setToolTipText("Guardar Ficha Cliente");
    buttonClose.setIcon(imageClose);
    buttonClose.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {

            if (validarMinimosRellenos()) {
              preguntarGuardar();
            }
          }
        });

    buttonHelp.setToolTipText("About");
    buttonHelp.setIcon(imageHelp);
    jPanel1.setBounds(new Rectangle(-5, 0, 530, 165));
    jPanel1.setLayout(null);
    jTable1.setShowGrid(true);
    jScrollPane1.setBounds(new Rectangle(0, 135, 490, 135));
    jScrollPane1.setBounds(new Rectangle(125, 135, 2, 2));

    jButton1.setText("Imprimir");
    jButton1.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            imprimirjButton_mouseClicked(e);
          }
        });
    insertarjButton.setText("Insertar Fila");

    insertarjButton.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            insertarjButton_mouseClicked(e);
          }
        });

    ponerTextoLabel(jLabelNombreCompanyia, nombreCompanyiajTextField1, "Nombre Compañía");
    jLabelNombreCompanyia.setBounds(new Rectangle(10, 5, 95, 20));

    nombreCompanyiajTextField1.setBounds(
        jLabelNombreCompanyia.getX() + jLabelNombreCompanyia.getWidth(),
        jLabelNombreCompanyia.getY(),
        270,
        jLabelNombreCompanyia.getHeight());

    ponerTextoLabel(jLabelNumeroFactura, numeroFacturajTextField1, "Nº Factura");
    jLabelNumeroFactura.setBounds(
        new Rectangle(
            nombreCompanyiajTextField1.getX()
                + nombreCompanyiajTextField1.getWidth()
                + SEPARACION_X,
            nombreCompanyiajTextField1.getY(),
            60,
            jLabelNombreCompanyia.getHeight()));

    numeroFacturajTextField1.setBounds(
        new Rectangle(
            jLabelNumeroFactura.getX() + jLabelNumeroFactura.getWidth(),
            nombreCompanyiajTextField1.getY(),
            65,
            jLabelNombreCompanyia.getHeight()));

    ponerTextoLabel(jLabelDireccion, direccionCompnanyia, "Dirección");
    jLabelDireccion.setBounds(
        new Rectangle(
            jLabelNombreCompanyia.getX(),
            jLabelNombreCompanyia.getHeight() + SEPARACION_Y,
            155,
            jLabelNombreCompanyia.getHeight()));
    // direccionCompnanyia.setBounds(new
    // Rectangle(nombreCompanyiajTextField1.getX(), jLabelDireccion.getY(),
    // 350, 40));
    scrollPane.setBounds(nombreCompanyiajTextField1.getX(), jLabelDireccion.getY(), 155, 60);

    ponerTextoLabel(jLabel6Ciudad, ciudadjTextField, "Ciudad");
    jLabel6Ciudad.setBounds(
        new Rectangle(
            jLabelDireccion.getX(),
            scrollPane.getY() + scrollPane.getHeight() + SEPARACION_Y,
            50,
            jLabelNombreCompanyia.getHeight()));
    ciudadjTextField.setBounds(
        new Rectangle(
            jLabel6Ciudad.getX() + jLabel6Ciudad.getWidth(),
            jLabel6Ciudad.getY(),
            110,
            jLabelNombreCompanyia.getHeight()));

    ponerTextoLabel(jLabel7CP, codigoPostaljTextField, "CP");
    jLabel7CP.setBounds(
        new Rectangle(
            ciudadjTextField.getX() + ciudadjTextField.getWidth() + SEPARACION_X,
            ciudadjTextField.getY(),
            45,
            jLabelNombreCompanyia.getHeight()));
    codigoPostaljTextField.setBounds(
        new Rectangle(
            jLabel7CP.getX() + jLabel7CP.getWidth(),
            jLabel7CP.getY(),
            85,
            jLabelNombreCompanyia.getHeight()));

    ponerTextoLabel(jLabelFecha, fechajTextField, "Fecha de Facturación");
    jLabelFecha.setBounds(
        new Rectangle(
            codigoPostaljTextField.getX() + codigoPostaljTextField.getWidth() + SEPARACION_X,
            codigoPostaljTextField.getY(),
            110,
            jLabelNombreCompanyia.getHeight()));
    fechajTextField.setBounds(
        new Rectangle(
            jLabelFecha.getX() + jLabelFecha.getWidth(),
            jLabelFecha.getY(),
            70,
            jLabelNombreCompanyia.getHeight()));

    ponerTextoLabel(jLabel8Telefono, telefonojTextField, "Teléfono");
    jLabel8Telefono.setBounds(
        new Rectangle(
            jLabel6Ciudad.getX(),
            jLabel6Ciudad.getY() + jLabel6Ciudad.getHeight() + SEPARACION_Y,
            jLabel6Ciudad.getWidth(),
            jLabel6Ciudad.getHeight()));
    telefonojTextField.setBounds(
        new Rectangle(
            jLabel8Telefono.getX() + jLabel8Telefono.getWidth(),
            jLabel8Telefono.getY(),
            ciudadjTextField.getWidth(),
            jLabelNombreCompanyia.getHeight()));
    // telefonojTextField.setDocument( new VentanaPrincipal(13));

    ponerTextoLabel(jLabelCIF, cifjTextField2, "CIF/NIF");
    jLabelCIF.setBounds(
        new Rectangle(
            telefonojTextField.getX() + telefonojTextField.getWidth() + SEPARACION_X,
            jLabel8Telefono.getY(),
            45,
            jLabelNombreCompanyia.getHeight()));
    cifjTextField2.setBounds(
        new Rectangle(
            jLabelCIF.getX() + jLabelCIF.getWidth(),
            jLabelCIF.getY(),
            codigoPostaljTextField.getWidth(),
            jLabelNombreCompanyia.getHeight()));

    jScrollPaneTabla.setBounds(
        new Rectangle(
            jLabel8Telefono.getX(),
            jLabelCIF.getY() + jLabelCIF.getHeight() + SEPARACION_Y,
            505,
            175));

    insertarjButton.setBounds(
        new Rectangle(
            200, jScrollPaneTabla.getY() + jScrollPaneTabla.getHeight() + SEPARACION_Y, 130, 20));

    this.setSize(new Dimension(531, 451));

    menuFile.add(menuFileExit);
    menuBar.add(menuFile);
    menuHelp.add(menuHelpAbout);
    menuBar.add(menuHelp);
    this.getContentPane().add(statusBar, BorderLayout.SOUTH);
    toolBar.add(buttonOpen);
    toolBar.add(buttonClose);
    toolBar.add(buttonHelp);
    toolBar.add(jButton1, null);
    this.getContentPane().add(toolBar, BorderLayout.NORTH);
    this.getContentPane().add(panelCenter, BorderLayout.CENTER);

    jPanel1.add(jLabel8Telefono, null);
    jPanel1.add(codigoPostaljTextField, null);
    jPanel1.add(jLabel7CP, null);
    jPanel1.add(jLabel6Ciudad, null);
    jPanel1.add(ciudadjTextField, null);
    jPanel1.add(jScrollPane1, null);
    jPanel1.add(cifjTextField2, null);
    jPanel1.add(jLabelCIF, null);
    jPanel1.add(fechajTextField, null);
    jPanel1.add(jLabelFecha, null);
    jPanel1.add(numeroFacturajTextField1, null);
    jPanel1.add(jLabelNumeroFactura, null);
    jPanel1.add(jLabelNombreCompanyia, null);
    jPanel1.add(nombreCompanyiajTextField1, null);

    jPanel1.add(jLabelDireccion, null);

    // jTable1
    // _panelScroll.add(jTable1);

    // jPanel1.add(scrollPane, new GridBagConstraints(3, 0, 1, 1, 1.0, 1.0,
    // GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0,
    // 140, 70), 0, 0));
    // scrollPane.setBounds(nombreCompanyiajTextField1.getX(), 30, 155, 40);
    jPanel1.add(scrollPane, null);
    jPanel1.add(telefonojTextField, null);
    panelCenter.add(jScrollPane1, null);
    jScrollPaneTabla.getViewport().add(jTable1, null);
    panelCenter.add(insertarjButton, null);
    panelCenter.add(jScrollPaneTabla, null);
    panelCenter.add(jPanel1, null);

    ajustarCamposTable(jTable1);
  }