示例#1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
示例#2
0
  /**
   * Init JWhiteBoard interface
   *
   * @throws Exception
   */
  public void go() throws Exception {
    if (!noChannel && !useState) channel.connect(groupName);
    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    drawPanel = new DrawPanel(useState);
    drawPanel.setBackground(backgroundColor);
    subPanel = new JPanel();
    mainFrame.getContentPane().add("Center", drawPanel);
    clearButton = new JButton("Clean");
    clearButton.setFont(defaultFont);
    clearButton.addActionListener(this);
    leaveButton = new JButton("Exit");
    leaveButton.setFont(defaultFont);
    leaveButton.addActionListener(this);
    subPanel.add("South", clearButton);
    subPanel.add("South", leaveButton);
    mainFrame.getContentPane().add("South", subPanel);
    mainFrame.setBackground(backgroundColor);
    clearButton.setForeground(Color.blue);
    leaveButton.setForeground(Color.blue);
    mainFrame.pack();
    mainFrame.setLocation(15, 25);
    mainFrame.setBounds(new Rectangle(250, 250));

    if (!noChannel && useState) {
      channel.connect(groupName, null, stateTimeout);
    }
    mainFrame.setVisible(true);
  }
示例#3
0
    public void actionPerformed(ActionEvent e) {
      JButton source = (JButton) e.getSource();
      _usrVotes[_index] = source.getText();

      for (JButton b : _candidateButtons) {
        b.setForeground(Color.BLACK);
      }
      source.setForeground(Color.RED);

      System.out.println("Vote for " + _title + " is " + _usrVotes[_index]);
    }
示例#4
0
 @Override
 public Component getListCellRendererComponent(
     JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
   label.setText(Objects.toString(value, ""));
   this.list = list;
   this.index = index;
   if (isSelected) {
     setBackground(list.getSelectionBackground());
     label.setForeground(list.getSelectionForeground());
   } else {
     setBackground(index % 2 == 0 ? EVEN_COLOR : list.getBackground());
     label.setForeground(list.getForeground());
   }
   MutableComboBoxModel m = (MutableComboBoxModel) list.getModel();
   if (index < 0 || m.getSize() - 1 <= 0) {
     setOpaque(false);
     deleteButton.setVisible(false);
     label.setForeground(list.getForeground());
   } else {
     boolean f = index == rolloverIndex;
     setOpaque(true);
     deleteButton.setVisible(true);
     deleteButton.getModel().setRollover(f);
     deleteButton.setForeground(f ? Color.WHITE : list.getForeground());
   }
   return this;
 }
  private JButton createButton(final Commontags commontag) {

    if (mapButtons.containsKey(commontag)) {
      OPDE.debug("shortcut");
      return mapButtons.get(commontag);
    }

    final JButton jButton =
        new JButton(
            commontag.getText(),
            editmode ? SYSConst.icon16tagPurpleDelete2 : SYSConst.icon16tagPurple);
    jButton.setFont(SYSConst.ARIAL12);
    jButton.setBorder(new RoundedBorder(10));
    jButton.setHorizontalTextPosition(SwingConstants.LEADING);
    jButton.setForeground(SYSConst.purple1[SYSConst.dark3]);

    if (editmode) {

      jButton.addActionListener(
          e -> {
            listSelectedTags.remove(commontag);
            mapButtons.remove(commontag);
            SwingUtilities.invokeLater(
                () -> {
                  removeAll();

                  add(txtTags);
                  if (btnPickTags != null) {
                    add(btnPickTags);
                  }
                  int tagnum = 1;

                  for (JButton btn : mapButtons.values()) {
                    if (tagnum % MAXLINE == 0) {
                      add(btn, RiverLayout.LINE_BREAK);
                    } else {
                      add(btn, RiverLayout.LEFT);
                    }
                    tagnum++;
                  }

                  remove(jButton);
                  revalidate();
                  repaint();
                  notifyListeners(commontag);
                });
          });
    }
    mapButtons.put(commontag, jButton);

    return jButton;
  }
示例#6
0
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }
示例#7
0
 private JButton createCopyToClipboardButton() {
   JButton button = new JButton("COPY TO CLIPBOARD");
   button.setBackground(Color.BLACK);
   button.setForeground(Color.GRAY);
   button.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             copyOverviewToClipboard();
           } catch (InsufficientDataException ex) {
             ex.printStackTrace();
             JOptionPane.showMessageDialog(
                 ReviewDialog.this,
                 "Failed to copy the overview to clipboard: " + ex.getMessage());
           }
         }
       });
   return button;
 }
示例#8
0
 public void addRow(Component... components) {
   remove(puff);
   final JPanel row = new JPanel();
   row.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent event) {
           gui.notifyObserver("/use " + rows.indexOf(event.getSource()));
         }
       });
   row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
   // row.add(Box.createHorizontalStrut(3));
   row.setMinimumSize(new Dimension(10, 30));
   row.setMaximumSize(new Dimension(250, 30));
   for (Component component : components) {
     row.add(component);
   }
   JButton red = new JButton("x");
   red.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
           int deleted = rows.indexOf(row);
           gui.notifyObserver("/use " + deleted);
           gui.notifyObserver("/disconnect");
         }
       });
   red.setBackground(Color.PINK.darker());
   red.setForeground(Color.WHITE);
   row.add(Box.createHorizontalGlue());
   row.add(red);
   rows.add(row);
   Component strut = Box.createVerticalStrut(5);
   struts.add(strut);
   add(row);
   add(strut);
   add(puff);
   repaint();
   updateUI();
 }
示例#9
0
 /**
  * The function creates a button, which opens a file chooser and writes a summary of the displayed
  * results into a user-selected file.
  *
  * @return The 'save to file' button.
  */
 private JButton createSaveToFileButton() {
   JButton b = new JButton("SAVE TO FILE");
   b.setBackground(Color.BLACK);
   b.setForeground(Color.GRAY);
   b.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           try {
             checkTotal();
             fileChooser.setSelectedFile(new File(getDefaultFilename()));
             int returnValue = fileChooser.showDialog(ReviewDialog.this, "Save");
             if (returnValue != JFileChooser.APPROVE_OPTION) return;
             writeToFile(fileChooser.getSelectedFile());
             ReviewDialog.this.setVisible(false);
           } catch (Exception ex) {
             JOptionPane.showMessageDialog(
                 ReviewDialog.this, ex.getMessage(), "Error occurred", JOptionPane.ERROR_MESSAGE);
           }
         }
       });
   return b;
 }
示例#10
0
  public void createGUI() {
    setLayout(new BorderLayout());
    toolBar = new JToolBar("options", JToolBar.HORIZONTAL);
    toolBar.setFloatable(false);
    toolBar.setOpaque(true);
    toolBar.setBackground(new Color(154, 12, 12));
    toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15));
    selectAllCB = new JCheckBox("Select All");
    selectAllCB.setVisible(false);
    selectAllCB.setForeground(Color.white);
    selectAllCB.addActionListener(this);
    refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png")));
    refreshBut.setVisible(false);
    refreshBut.setToolTipText("Refresh");
    refreshBut.setForeground(new Color(20, 88, 49));
    refreshBut.addActionListener(this);
    backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png")));
    backBut.setVisible(false);
    backBut.setToolTipText("Back");
    backBut.setForeground(new Color(20, 88, 49));
    backBut.addActionListener(this);
    deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png")));
    deleteBut.setToolTipText("Delete");
    deleteBut.setForeground(Color.red);
    deleteBut.setVisible(false);
    deleteBut.addActionListener(this);
    deleteBut.setBackground(Color.red);
    restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png")));
    restoreBut.setToolTipText("Restore");
    restoreBut.setForeground(Color.blue);
    restoreBut.setVisible(false);
    restoreBut.addActionListener(this);
    toolBar.addSeparator(new Dimension(10, 5));
    toolBar.add(selectAllCB);
    toolBar.add(backBut);
    toolBar.add(refreshBut);
    toolBar.add(deleteBut);
    toolBar.add(restoreBut);
    add(toolBar, "North");
    JPanel centPan = new JPanel(new GridBagLayout());
    centPan.setBackground(new Color(52, 86, 70));
    JLabel label = new JLabel("Select A Category From Left Pane");
    label.setFont(new Font("arial", Font.BOLD, 35));
    label.setForeground(Color.yellow);
    centPan.add(label);
    contentPan = new JScrollPane(centPan);
    contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    add(contentPan, "Center");
    contentPan.repaint();

    db = new Database();
    //        inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id
    // desc");
    //        sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id
    // desc");
    //        draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id
    // desc");
    //        outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id
    // desc");
    //        trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and
    // messages.msg_id=trash.msg_id ORDER BY deleted_at desc");

  }
示例#11
0
 public LogDateChooser(String label) {
   thisDialog = this;
   border = new EtchedBorder();
   setBorder(border);
   Font f = new Font("Helvetica", Font.PLAIN, 10);
   title = new JLabel(label);
   add(title);
   setLayout(new DateLayout());
   dfs = new DateFormatSymbols();
   months = dfs.getMonths();
   weekdays = dfs.getShortWeekdays();
   for (int i = 0; i < 7; i++) {
     days[i] = new JLabel(weekdays[i + 1]);
     days[i].setFont(f);
     add(days[i]);
   }
   gc = new GregorianCalendar();
   mDown = new JButton("<");
   mDown.setMargin(new Insets(0, 0, 0, 0));
   mDown.addActionListener(new MDownEar());
   mDown.setBorderPainted(false);
   mDown.setFont(f);
   mDown.setForeground(Color.BLUE);
   add(mDown);
   mUp = new JButton(">");
   mUp.setMargin(new Insets(0, 0, 0, 0));
   mUp.addActionListener(new MUpEar());
   mUp.setBorderPainted(false);
   mUp.setFont(f);
   mUp.setForeground(Color.BLUE);
   add(mUp);
   month = new JLabel(months[gc.get(Calendar.MONTH)]);
   month.setHorizontalAlignment(SwingConstants.CENTER);
   month.setFont(f);
   add(month);
   year = new JLabel(new Integer(gc.get(Calendar.YEAR)).toString());
   year.setFont(f);
   add(year);
   yDown = new JButton("<");
   yDown.setMargin(new Insets(0, 0, 0, 0));
   yDown.addActionListener(new YDownEar());
   yDown.setBorderPainted(false);
   yDown.setFont(f);
   yDown.setForeground(Color.BLUE);
   add(yDown);
   yUp = new JButton(">");
   yUp.setMargin(new Insets(0, 0, 0, 0));
   yUp.addActionListener(new YUpEar());
   yUp.setBorderPainted(false);
   yUp.setFont(f);
   yUp.setForeground(Color.BLUE);
   add(yUp);
   //    System.out.println(year.getText());
   NumberEar numberEar = new NumberEar();
   for (int i = 0; i < 31; i++) {
     number[i] = new JButton(new Integer(i + 1).toString());
     number[i].setMargin(new Insets(0, 0, 0, 0));
     number[i].addActionListener(numberEar);
     number[i].setBorderPainted(false);
     number[i].setContentAreaFilled(false);
     number[i].setFont(f);
     number[i].setForeground(Color.BLUE);
     add(number[i]);
   }
   number[0].setForeground(Color.CYAN);
 }