protected void _init() {
    super._init();

    if (_replacedObjects.objectForKey("_jRadioButton1") == null) {
      _setFontForComponent(_jRadioButton1, "Hiragino Kaku Gothic Pro", 13, Font.PLAIN);
    }

    if (_replacedObjects.objectForKey("_nsMatrix0") == null) {
      _jRadioButton1.setSize(77, 18);
      _jRadioButton1.setLocation(0, 0);
      _nsMatrix0.add(_jRadioButton1);
      _jRadioButton0.setSize(77, 18);
      _jRadioButton0.setLocation(81, 0);
      _nsMatrix0.add(_jRadioButton0);
      _setFontForComponent(_nsMatrix0, "Hiragino Kaku Gothic Pro", 13, Font.PLAIN);
    }

    if (_replacedObjects.objectForKey("_nsCustomView0") == null) {
      if (!(_nsCustomView0.getLayout() instanceof EOViewLayout)) {
        _nsCustomView0.setLayout(new EOViewLayout());
      }
      _nsMatrix0.setSize(158, 18);
      _nsMatrix0.setLocation(81, 7);
      ((EOViewLayout) _nsCustomView0.getLayout())
          .setAutosizingMask(_nsMatrix0, EOViewLayout.MinYMargin);
      _nsCustomView0.add(_nsMatrix0);
    }

    if (_replacedObjects.objectForKey("_jRadioButton0") == null) {
      _setFontForComponent(_jRadioButton0, "Hiragino Kaku Gothic Pro", 13, Font.PLAIN);
    }
  }
  public void initComponents() {
    Container c = this.getContentPane();
    this.setTitle("Login Choice");
    this.setSize(600, 500);
    this.setLayout(null);

    // button Vietnamese language
    btnVietnamese = new JButton("Tiếng Việt");
    btnVietnamese.setSize(100, 25);
    btnVietnamese.setLocation(50, 100);
    c.add(btnVietnamese);

    // title
    JLabel lblTile = new JLabel("Choose login");
    lblTile.setSize(200, 30);
    lblTile.setLocation(180, 100);
    lblTile.setFont(new Font("Arial", Font.BOLD, 30));
    c.add(lblTile);

    // button English language
    btnEnglish = new JButton("English");
    btnEnglish.setSize(100, 25);
    btnEnglish.setLocation(400, 100);
    c.add(btnEnglish);

    // radio button connect to database
    radConnect = new JRadioButton("Connect to Database");
    radConnect.setSize(200, 20);
    radConnect.setLocation(100, 200);
    // radio button not connect to database
    radNotConnect = new JRadioButton("Not connect to database");
    radNotConnect.setSize(200, 20);
    radNotConnect.setLocation(300, 200);
    // group radio buttons
    ButtonGroup group = new ButtonGroup();
    group.add(radConnect);
    group.add(radNotConnect);
    c.add(radConnect);
    c.add(radNotConnect);

    // button connect
    btnConnect = new JButton("Connect");
    btnConnect.setSize(100, 25);
    btnConnect.setLocation(50, 300);
    c.add(btnConnect);

    // button not connect
    btnNotConnect = new JButton("Not connect");
    btnNotConnect.setSize(120, 25);
    btnNotConnect.setLocation(200, 300);
    c.add(btnNotConnect);

    // button login
    btnLogin = new JButton("Login");
    btnLogin.setSize(100, 25);
    btnLogin.setLocation(370, 300);
    c.add(btnLogin);

    this.setVisible(true);
  }
  /**
   * Create a image according to the current state, simple and silly ...
   *
   * @param event the report event.
   */
  public void pageStarted(final ReportEvent event) {
    final BufferedImage image = new BufferedImage(150, 50, BufferedImage.TYPE_INT_ARGB);
    final Graphics2D g2 = image.createGraphics();
    final JButton bt = new JButton("A Button");
    bt.setSize(90, 20);
    final JRadioButton radio = new JRadioButton("A radio button");
    radio.setSize(100, 20);

    g2.setColor(Color.darkGray);
    bt.paint(g2);
    g2.setColor(Color.blue);
    g2.setTransform(AffineTransform.getTranslateInstance(20, 20));
    radio.paint(g2);
    g2.setTransform(AffineTransform.getTranslateInstance(0, 0));
    g2.setPaint(Color.green);
    g2.setFont(new Font("Serif", Font.PLAIN, 10));
    g2.drawString(
        "You are viewing a graphics of JFreeReport on index " + event.getState().getCurrentRow(),
        10,
        10);
    g2.dispose();
    try {
      functionValue = new DefaultImageReference(image);
    } catch (IOException e) {
      functionValue = null;
    }
  }
Beispiel #4
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 static void main(String args[]) {
    JRadioButton rb = new JRadioButton();
    rb.getAccessibleContext();
    rb.isFocusTraversable();
    rb.setEnabled(false);
    rb.setEnabled(true);
    rb.requestFocus();
    rb.requestFocusInWindow();
    rb.getPreferredSize();
    rb.getMaximumSize();
    rb.getMinimumSize();
    rb.contains(1, 2);
    Component c1 = rb.add(new Component() {});
    Component c2 = rb.add(new Component() {});
    Component c3 = rb.add(new Component() {});
    Insets ins = rb.getInsets();
    rb.getAlignmentY();
    rb.getAlignmentX();
    rb.getGraphics();
    rb.setVisible(false);
    rb.setVisible(true);
    rb.setForeground(Color.red);
    rb.setBackground(Color.red);
    for (String font : Toolkit.getDefaultToolkit().getFontList()) {
      for (int j = 8; j < 17; j++) {
        Font f1 = new Font(font, Font.PLAIN, j);
        Font f2 = new Font(font, Font.BOLD, j);
        Font f3 = new Font(font, Font.ITALIC, j);
        Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);

        rb.setFont(f1);
        rb.setFont(f2);
        rb.setFont(f3);
        rb.setFont(f4);

        rb.getFontMetrics(f1);
        rb.getFontMetrics(f2);
        rb.getFontMetrics(f3);
        rb.getFontMetrics(f4);
      }
    }
    rb.enable();
    rb.disable();
    rb.reshape(10, 10, 10, 10);
    rb.getBounds(new Rectangle(1, 1, 1, 1));
    rb.getSize(new Dimension(1, 2));
    rb.getLocation(new Point(1, 2));
    rb.getX();
    rb.getY();
    rb.getWidth();
    rb.getHeight();
    rb.isOpaque();
    rb.isValidateRoot();
    rb.isOptimizedDrawingEnabled();
    rb.isDoubleBuffered();
    rb.getComponentCount();
    rb.countComponents();
    rb.getComponent(1);
    rb.getComponent(2);
    Component[] cs = rb.getComponents();
    rb.getLayout();
    rb.setLayout(new FlowLayout());
    rb.doLayout();
    rb.layout();
    rb.invalidate();
    rb.validate();
    rb.remove(0);
    rb.remove(c2);
    rb.removeAll();
    rb.preferredSize();
    rb.minimumSize();
    rb.getComponentAt(1, 2);
    rb.locate(1, 2);
    rb.getComponentAt(new Point(1, 2));
    rb.isFocusCycleRoot(new Container());
    rb.transferFocusBackward();
    rb.setName("goober");
    rb.getName();
    rb.getParent();
    rb.getGraphicsConfiguration();
    rb.getTreeLock();
    rb.getToolkit();
    rb.isValid();
    rb.isDisplayable();
    rb.isVisible();
    rb.isShowing();
    rb.isEnabled();
    rb.enable(false);
    rb.enable(true);
    rb.enableInputMethods(false);
    rb.enableInputMethods(true);
    rb.show();
    rb.show(false);
    rb.show(true);
    rb.hide();
    rb.getForeground();
    rb.isForegroundSet();
    rb.getBackground();
    rb.isBackgroundSet();
    rb.getFont();
    rb.isFontSet();
    Container c = new Container();
    c.add(rb);
    rb.getLocale();
    for (Locale locale : Locale.getAvailableLocales()) rb.setLocale(locale);

    rb.getColorModel();
    rb.getLocation();

    boolean exceptions = false;
    try {
      rb.getLocationOnScreen();
    } catch (IllegalComponentStateException e) {
      exceptions = true;
    }
    if (!exceptions)
      throw new RuntimeException("IllegalComponentStateException did not occur when expected");

    rb.location();
    rb.setLocation(1, 2);
    rb.move(1, 2);
    rb.setLocation(new Point(1, 2));
    rb.getSize();
    rb.size();
    rb.setSize(1, 32);
    rb.resize(1, 32);
    rb.setSize(new Dimension(1, 32));
    rb.resize(new Dimension(1, 32));
    rb.getBounds();
    rb.bounds();
    rb.setBounds(10, 10, 10, 10);
    rb.setBounds(new Rectangle(10, 10, 10, 10));
    rb.isLightweight();
    rb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    rb.getCursor();
    rb.isCursorSet();
    rb.inside(1, 2);
    rb.contains(new Point(1, 2));
    rb.isFocusable();
    rb.setFocusable(true);
    rb.setFocusable(false);
    rb.transferFocus();
    rb.getFocusCycleRootAncestor();
    rb.nextFocus();
    rb.transferFocusUpCycle();
    rb.hasFocus();
    rb.isFocusOwner();
    rb.toString();
    rb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    rb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    rb.setComponentOrientation(ComponentOrientation.UNKNOWN);
    rb.getComponentOrientation();
  }
  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);
  }
Beispiel #7
0
    /**
     * Vytvori dotazovaci dialog s prednastavenym layoutem, nastavi jeho pozici a vykresli jej na
     * obrazovku.
     *
     * @param owner Nadrazene okno {@code java.awt.Frame}.
     * @param title Jmeno dialogoveho okna.
     */
    CheckDialog(Frame owner, String title) {
      this.setTitle(title);
      this.setPreferredSize(new Dimension(200, 200));

      jdCont = new JPanel();
      jdCont.setPreferredSize(new Dimension(200, 200));

      bg = new ButtonGroup();

      ActionListener change =
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
              chngInfo(evt);
            }
          };

      opt1 = new JRadioButton("Sidlo");
      opt1.setBounds(10, 5, 10, 10);
      opt1.setSize(10, 10);
      opt1.setLocation(10, 5);
      opt1.setSelected(true);
      opt1.setOpaque(true);
      opt1.setActionCommand("settle");
      opt1.addActionListener(change);

      opt2 = new JRadioButton("Vrtulnik");
      opt2.setBounds(30, 5, 10, 10);
      opt2.setOpaque(true);
      opt2.setActionCommand("helicop");
      opt2.addActionListener(change);

      opt3 = new JRadioButton("Auto");
      opt3.setBounds(50, 5, 10, 10);
      opt3.setOpaque(true);
      opt3.setActionCommand("car");
      opt3.addActionListener(change);

      bg.add(opt1);
      bg.add(opt2);
      bg.add(opt3);

      info = new JLabel("ID musi byt v danem rozmezi!", JLabel.CENTER);

      line = new JTextField(10);
      // line.setBounds(10,20,100,20);
      // line.setSize(100, 20);
      // line.setAlignmentX(100);
      line.setEnabled(true);
      line.setOpaque(true);

      sender = new JButton();
      sender.setBounds(50, 50, 100, 20);
      sender.setBackground(new Color(200, 200, 200));
      sender.setEnabled(true);
      sender.setFont(new Font("sansserif", 0, 12));
      sender.setText("Zjistit!");
      sender.setVisible(true);
      sender.setOpaque(true);
      sender.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              send();
            }
          });

      jdCont.add(opt1);
      jdCont.add(opt2);
      jdCont.add(opt3);
      jdCont.add(info);
      jdCont.add(line);
      jdCont.add(sender);

      this.setContentPane(jdCont);
      // this.setPreferredSize(new Dimension(200,200));
      this.setLocationRelativeTo(owner);
      this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      this.pack();
      this.setVisible(true);
    }