コード例 #1
0
  public void fillWordList() {
    sf = new ScrollField(new Dimension(250, 300));
    sf.setBounds(20, 250, 250, 300);

    ResultSet result =
        DatabaseController.getInstance()
            .runQuery("SELECT woord FROM woordenboek where status='Pending'");
    try {

      // Onderstaande if(); word al in logics afgehandeld
      // if(result.next()==false)
      // {
      // this.getGui().showMessage("No words in pending list");
      // }
      result.beforeFirst();
      while (result.next()) {
        // System.out.println(result.next());
        // create word panel
        ColoredRectangle wordPanel =
            new ColoredRectangle(new Rectangle(sf.getWidth(), 50), Color.gray);
        // create word label
        JLabel wordLabel = new JLabel(result.getString("woord"));
        wordLabel.setForeground(Color.white);
        wordLabel.setBounds(0, 0, 550, 50);
        wordLabel.setFont(FontController.getInstance().getFont("segoeuil"));
        wordLabel.setFont(new Font(wordLabel.getFont().getName(), Font.BOLD, 20));
        // add label to panel
        wordPanel.add(wordLabel);

        // create edit buttonimage
        ImageIcon editLogo = new ImageIcon(getClass().getResource("/Assets/Images/edit.png"));
        JButton editButton = new JButton(editLogo);
        editButton.setBackground(Color.gray);
        editButton.setBounds(
            wordPanel.getWidth() - (editLogo.getIconWidth() + 10),
            wordPanel.getHeight() - 15 - editLogo.getIconHeight(),
            editLogo.getIconWidth() + 3,
            editLogo.getIconHeight() + 3);
        editButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
        editButton.setName("btnWordOutList#" + result.getString("woord"));
        // addclickevent
        editButton.addActionListener(logics);

        // add editlabel to wordpanel
        wordPanel.add(editButton);
        wordPanel.setLayout(null);

        // add wordpanel to scollfield
        sf.addElement(wordPanel);
      }

    } catch (Exception e1) {
      // TODO Auto-generated catch block

      e1.printStackTrace();
    }

    this.add(sf);
  }
コード例 #2
0
 public void showNextWord(String word) {
   // Layed word label
   // remove old before make a new one.
   try {
     this.remove(FirstWord);
   } catch (Exception e) {
   }
   FirstWord = new JLabel(word);
   FirstWord.setForeground(Color.white);
   FirstWord.setBounds(438, 300, 400, 100);
   // FirstWord.setFont(FontController.getInstance().getFont("seguisb"));
   FirstWord.setFont(FontController.getInstance().getFont("segoeuil"));
   FirstWord.setFont(new Font(FirstWord.getFont().getName(), Font.PLAIN, 40));
   FirstWord.setHorizontalAlignment(JLabel.CENTER);
   this.add(FirstWord);
 }
コード例 #3
0
  public CritisizeWords(Gui gui) {

    this.set_gui(gui);
    this.setBackground(null);
    this.setBounds(0, 0, gui.getWidth(), gui.getHeight());
    this.setLayout(null);

    // welkom tekst
    JLabel welkomText = new JLabel("Criticise words");
    welkomText.setForeground(Color.white);
    welkomText.setBounds(500, 120, 350, 55);
    welkomText.setFont(FontController.getInstance().getFont("segoeuil"));
    welkomText.setFont(new Font(welkomText.getFont().getName(), Font.PLAIN, 42));
    this.add(welkomText);

    // welkom tekst lbledit

    // wat is deze?
    // JLabel lblEditText = new JLabel("Edit");
    // lblEditText.setForeground(Color.white);
    // lblEditText.setBounds(400,200,200,55);
    // lblEditText.setFont(FontController.getInstance().getFont("segoeuil"));
    // lblEditText.setFont(new Font(lblEditText.getFont().getName(),
    // Font.BOLD, 20));
    // this.add(lblEditText);

    // Layed word label
    JLabel lblLayedWords = new JLabel("Words");
    lblLayedWords.setForeground(Color.white);
    lblLayedWords.setBounds(20, 200, 200, 55);
    lblLayedWords.setFont(FontController.getInstance().getFont("segoeuil"));
    lblLayedWords.setFont(new Font(lblLayedWords.getFont().getName(), Font.BOLD, 22));
    this.add(lblLayedWords);

    // Heart icon (button)
    ImageIcon likeLogo = new ImageIcon(getClass().getResource("/Assets/Images/like.png"));
    likeButton = new JButton(likeLogo);
    likeButton.setBackground(this.getBackground());
    likeButton.setBounds(560, 400, 70, 70);
    likeButton.setName("btnLike");
    likeButton.setBorder(null);
    likeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    // addclickevent
    likeButton.addActionListener(logics);
    this.add(likeButton);

    // Cross icon (dislike) (button)
    ImageIcon dislikeLogo = new ImageIcon(getClass().getResource("/Assets/Images/dislike.png"));
    dislikeButton = new JButton(dislikeLogo);
    dislikeButton.setBackground(this.getBackground());
    dislikeButton.setBounds(645, 400, 70, 70);
    dislikeButton.setName("btnDislike");
    dislikeButton.setBorder(null);
    dislikeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    // addclickevent
    dislikeButton.addActionListener(logics);
    this.add(dislikeButton);

    // Pass
    passBtn = new MyButton("Pass");
    passBtn.setBounds(600, 486, 80, 24);
    passBtn.setFont(FontController.getInstance().getFont("seguisb"));
    passBtn.setFont(new Font(passBtn.getFont().getName(), Font.BOLD, 12));
    passBtn.setName("btnPass");
    passBtn.addActionListener(logics);
    this.add(passBtn);

    // /edit word initialization

    // add label edit words (right side of screen)
    JLabel lblEditWord = new JLabel("Edit word");
    lblEditWord.setForeground(Color.white);
    lblEditWord.setBounds(1000, 205, 260, 55);
    lblEditWord.setFont(FontController.getInstance().getFont("segoeuil"));
    lblEditWord.setFont(new Font(lblEditWord.getFont().getName(), Font.BOLD, 20));
    this.add(lblEditWord);

    // create textfield for edit word (right side of screen)
    tfEditWord = new TextFieldSL("");
    tfEditWord.setBounds(1000, 250, 250, 30);
    tfEditWord.setFont(FontController.getInstance().getFont("seguisb"));
    tfEditWord.setBackground(Color.black);
    tfEditWord.setFont(new Font(tfEditWord.getFont().getName(), Font.BOLD, 12));
    tfEditWord.setFocusStatus(false);
    this.add(tfEditWord);

    // create edit word button update (right side of screen)
    MyButton btnUpdate = new MyButton("Update and approve");
    btnUpdate.setBounds(1000, 285, 250, 25);
    btnUpdate.setFont(FontController.getInstance().getFont("seguisb"));
    btnUpdate.setFont(new Font(btnUpdate.getFont().getName(), Font.BOLD, 12));
    btnUpdate.setName("btnUpdate");
    btnUpdate.addActionListener(logics);
    this.add(btnUpdate);

    // load pending wordlist
    fillWordList();

    logics.showNextWord();
  }