예제 #1
0
  private void displayPanel(MouseEvent e) { // steruunt anzeige der panles
    hidePanels(); // alle pnl ausblenen
    disselectRdbtn(); // alle rbtn zurücksetzen

    if (cardtypeFlag) { // true = Whitecard false = Blackcard
      if (e.getSource().equals(rdbtnAdd)) {
        pnlAddWhitecards.setVisible(true);
        rdbtnAdd.setSelected(true);
        setBounds(100, 100, 440, 300);
      } else if (e.getSource().equals(rdbtnEdit)) {
        pnlEditWhitecards.setVisible(true);
        rdbtnEdit.setSelected(true);
        setBounds(100, 100, 440, 600);
      } else if (e.getSource().equals(rdbtnDel)) {
        pnlDelWhitecards.setVisible(true);
        rdbtnDel.setSelected(true);
        setBounds(100, 100, 440, 600);
      }
    } else {
      if (e.getSource().equals(rdbtnAdd)) {
        pnlAddBlackcards.setVisible(true);
        rdbtnAdd.setSelected(true);
        setBounds(100, 100, 440, 300);
      } else if (e.getSource().equals(rdbtnEdit)) {
        pnlEditBlackcards.setVisible(true);
        rdbtnEdit.setSelected(true);
        setBounds(100, 100, 440, 600);
      } else if (e.getSource().equals(rdbtnDel)) {
        pnlDelBlackcards.setVisible(true);
        rdbtnDel.setSelected(true);
        setBounds(100, 100, 440, 600);
      }
    }
  }
예제 #2
0
 private void hidePanels() { // alle pnls ausblenen
   pnlAddWhitecards.setVisible(false);
   pnlAddBlackcards.setVisible(false);
   pnlEditWhitecards.setVisible(false);
   pnlEditBlackcards.setVisible(false);
   pnlDelWhitecards.setVisible(false);
   pnlDelBlackcards.setVisible(false);
 }
예제 #3
0
  public DBModify() {
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 440, 300);
    setVisible(true);
    setResizable(false);

    bg = new JPanel();
    setContentPane(bg);
    bg.setLayout(null);

    pnlOperation = new JPanel();
    pnlOperation.setBounds(10, 10, 415, 30);
    bg.add(pnlOperation);
    pnlOperation.setLayout(null);

    rdbtnAdd = new JRadioButton("ADD");
    rdbtnAdd.setBounds(5, 5, 55, 20);
    rdbtnAdd.addMouseListener(this);
    pnlOperation.add(rdbtnAdd);

    rdbtnDel = new JRadioButton("DEL");
    rdbtnDel.setBounds(200, 5, 55, 20);
    rdbtnDel.addMouseListener(this);
    pnlOperation.add(rdbtnDel);

    rdbtnEdit = new JRadioButton("EDIT");
    rdbtnEdit.setBounds(100, 5, 55, 20);
    rdbtnEdit.addMouseListener(this);
    pnlOperation.add(rdbtnEdit);

    tglbtnCards = new JToggleButton("Blackcard");
    tglbtnCards.setBounds(285, 5, 120, 25);
    tglbtnCards.addMouseListener(this);
    pnlOperation.add(tglbtnCards);

    btnConfirm = new JButton("Confirm Changes");
    btnConfirm.setBounds(10, 45, 415, 25);
    btnConfirm.addMouseListener(this);
    bg.add(btnConfirm);

    getContentPane().add(pnlAddWhitecards);
    pnlAddWhitecards.setVisible(false);
    getContentPane().add(pnlAddBlackcards);
    pnlAddBlackcards.setVisible(false);

    getContentPane().add(pnlEditWhitecards);
    pnlEditWhitecards.setVisible(false);
    getContentPane().add(pnlEditBlackcards);
    pnlEditBlackcards.setVisible(false);

    getContentPane().add(pnlDelWhitecards);
    pnlDelWhitecards.setVisible(false);
    getContentPane().add(pnlDelBlackcards);
    pnlDelBlackcards.setVisible(false);

    // listener auf objekte seteztebn
    pnlAddBlackcards.getBtnAdd().addMouseListener(this);
    pnlAddWhitecards.getBtnAdd().addMouseListener(this);
    pnlDelBlackcards.getBtnDelete().addMouseListener(this);
    pnlDelBlackcards.getTxtCardID().addKeyListener(this);
    pnlDelWhitecards.getBtnDelete().addMouseListener(this);
    pnlDelWhitecards.getTxtCardID().addKeyListener(this);
    pnlEditBlackcards.getBtnChange().addMouseListener(this);
    pnlEditBlackcards.getTxtCardID().addKeyListener(this);
    pnlEditWhitecards.getBtnChange().addMouseListener(this);
    pnlEditWhitecards.getTxtCardID().addKeyListener(this);
  }