Exemplo n.º 1
0
  public DragDraw() {

    setTitle("Draw");
    setBackground(Color.WHITE);
    setResizable(true);
    setVisible(true);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(0, 0, screenSize.width, screenSize.height);

    setDefaultCloseOperation(EXIT_ON_CLOSE);

    panel = new DragDrawPanel(screenSize);
    panel.addMouseListener(panel);
    panel.addKeyListener(panel);

    pertBut = new JButton("Pert");
    ganttBut = new JButton("Gantt");
    wbtBut = new JButton("WBT");
    addNewTaskBut = new JButton("Add New Task");

    pertBut.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            pertActionPerformed(evt);
          }
        });

    ganttBut.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ganttActionPerformed(evt);
          }
        });

    wbtBut.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            wbtActionPerformed(evt);
          }
        });

    addNewTaskBut.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            addNewTaskActionPerformed(evt);
            System.out.println("addnew");
          }
        });

    panel.setFocusable(true);
    add(panel);
    panel.add(pertBut);
    panel.add(ganttBut);
    panel.add(wbtBut);
    panel.add(addNewTaskBut);
    panel.setLayout(null);
    requestFocus();

    pertBut.setBounds(new Rectangle(screenSize.width - 600, 50, 95, 25));
    ganttBut.setBounds(new Rectangle(screenSize.width - 500, 50, 95, 25));
    wbtBut.setBounds(new Rectangle(screenSize.width - 400, 50, 95, 25));
    addNewTaskBut.setBounds(new Rectangle(50, 50, 150, 25));
  }
Exemplo n.º 2
0
 private void addNewTaskActionPerformed(java.awt.event.ActionEvent evt) {
   new NewJFrame(panel.getNodes());
 }