Example #1
0
  private void initHexboard(int size) {

    hexboard = new Hexboard(size, this);

    GroupLayout hexboardLayout = new GroupLayout(hexboard);
    hexboard.setLayout(hexboardLayout);
    hexboardLayout.setHorizontalGroup(
        hexboardLayout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGap(0, 460, Short.MAX_VALUE));
    hexboardLayout.setVerticalGroup(
        hexboardLayout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGap(0, 496, Short.MAX_VALUE));

    GroupLayout layout = new GroupLayout(jPanel1);
    jPanel1.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                hexboard, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                hexboard, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
  }
 private void setLayout() {
   GroupLayout layout = new GroupLayout(dialog.getContentPane());
   dialog.getContentPane().setLayout(layout);
   dialog.setResizable(true);
   layout.setAutoCreateContainerGaps(true);
   layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane));
   layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane));
   layout.setHonorsVisibility(tabbedPane, true);
   // TODO set color here
   dialog.getContentPane().setBackground(new Color(0x132638));
   dialog.validate();
   dialog.repaint();
 }
  private void makeAndSetTabComponents() {
    final String[] tabTitles = {"Libraries", "Modes", "Tools", "Examples", "Updates"};
    tabLabels = new JLabel[4];

    for (int i = 0; i < 4; i++) {
      final int temp = i;
      tabLabels[i] =
          new JLabel(tabTitles[i]) {
            @Override
            protected void paintComponent(Graphics g) {
              g.setClip(
                  Toolkit.createRoundRect(
                      0, 0, getWidth(), getHeight(), temp == 0 ? 6 : 0, temp == 3 ? 6 : 0, 0, 0));
              super.paintComponent(g);
            }
          };
      tabLabels[i].setForeground(Color.WHITE);
      tabLabels[i].setBackground(new Color(0x2d4251));
      tabLabels[i].setOpaque(true);
      tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
      tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
      tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER);
      tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD));
      tabbedPane.setTabComponentAt(i, tabLabels[i]);
    }

    updateTabPanel =
        new JPanel() {
          @Override
          protected void paintComponent(Graphics g) {
            g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(), 6, 6, 0, 0));
            super.paintComponent(g);
          }
        };
    ;
    updateTabLabel = new JLabel("Updates");
    updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setVerticalTextPosition(SwingConstants.CENTER);
    numberLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setForeground(Color.WHITE);
    updateTabPanel.setOpaque(true);
    updateTabPanel.setBackground(new Color(0x2d4251));
    updateTabLabel.setForeground(Color.WHITE);
    updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
    tabbedPane.setTabComponentAt(4, updateTabPanel);

    GroupLayout tabLayout = new GroupLayout(updateTabPanel);
    tabLayout.setAutoCreateGaps(true);
    updateTabPanel.setLayout(tabLayout);
    tabLayout.setHorizontalGroup(
        tabLayout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(updateTabLabel)
            .addComponent(numberLabel)
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED,
                GroupLayout.PREFERRED_SIZE,
                Short.MAX_VALUE));
    tabLayout.setVerticalGroup(
        tabLayout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addComponent(numberLabel)
            .addComponent(updateTabLabel));

    numberLabel.setVisible(false);
  }
Example #4
0
  /**
   * Modified "Generated Code". Initialize the GUI Components of the program. THIS PART GETS
   * EXTREMELY CONFUSING.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Bull Excrements Code">
  private void initComponents() {
    // MainFrame = new JFrame();

    sb = new StringBuilder(64);

    sb.append(instructions2());

    MessageLabel = new JLabel(sb.toString());

    MainPanel = new JPanel();
    MainMenuBar = new JMenuBar();
    FileMenu = new JMenu();
    NewGameMenu = new JMenu();
    EasyButton = new JMenuItem();
    MediumButton = new JMenuItem();
    HardButton = new JMenuItem();
    QuitButton = new JMenuItem();
    HelpMenu = new JMenu();

    // frame things -- useless!
    /*
    GroupLayout mainFrameLayout = new GroupLayout(MainFrame.getContentPane());
    MainFrame.getContentPane().setLayout(mainFrameLayout);
    mainFrameLayout.setHorizontalGroup(
        mainFrameLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGap(0, 400, Short.MAX_VALUE)
    );
    mainFrameLayout.setVerticalGroup(
        mainFrameLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGap(0, 300, Short.MAX_VALUE)
    );
    */
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent evt) {
            formMouseReleased(evt);
          }
        });
    addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent evt) {
            formKeyPressed(evt);
          }
        });

    GroupLayout mainPanelLayout = new GroupLayout(MainPanel);
    MainPanel.setLayout(mainPanelLayout);
    mainPanelLayout.setHorizontalGroup(
        mainPanelLayout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                mainPanelLayout
                    .createSequentialGroup()
                    .addGap(40, 60, 80)
                    .addComponent(MessageLabel)
                    .addContainerGap(50, Short.MAX_VALUE)));
    mainPanelLayout.setVerticalGroup(
        mainPanelLayout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                mainPanelLayout
                    .createSequentialGroup()
                    .addGap(54, 54, 54)
                    .addComponent(MessageLabel)
                    .addContainerGap(200, Short.MAX_VALUE)));

    FileMenu.setText("File");
    FileMenu.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent evt) {
            FileMenuMouseClicked(evt);
          }
        });

    NewGameMenu.setText("New Game");

    EasyButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
    EasyButton.setText("Easy");
    EasyButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent evt) {
            EasyButtonMouseReleased(evt);
          }
        });
    NewGameMenu.add(EasyButton);

    MediumButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    MediumButton.setText("Medium");
    MediumButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent evt) {
            MediumButtonMouseReleased(evt);
          }
        });
    NewGameMenu.add(MediumButton);

    HardButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0));
    HardButton.setText("Hard");
    HardButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent evt) {
            HardButtonMouseReleased(evt);
          }
        });
    NewGameMenu.add(HardButton);

    FileMenu.add(NewGameMenu);

    QuitButton.setText("Quit");
    QuitButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent evt) {
            QuitButtonMouseReleased(evt);
          }
        });
    FileMenu.add(QuitButton);

    MainMenuBar.add(FileMenu);

    HelpMenu.setText("Help");
    MainMenuBar.add(HelpMenu);

    setJMenuBar(MainMenuBar);

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                MainPanel,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.DEFAULT_SIZE,
                GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                MainPanel,
                GroupLayout.DEFAULT_SIZE,
                GroupLayout.DEFAULT_SIZE,
                GroupLayout.PREFERRED_SIZE));

    // post everything
    this.setTitle("Arcade");

    JLabel label = new JLabel(sb.toString());
    add(label);

    setVisible(true);
    repaint();
    pack();
  } // </editor-fold>
Example #5
0
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    startPane = new JTabbedPane();
    arrivalListPanel = new JPanel();
    scrollPane2 = new JScrollPane();
    arrivalTable = new JTable();
    selectArrival = new JButton();
    searchListPanel = new JPanel();
    label5 = new JLabel();
    deliveryID = new JTextField();
    entruck = new JRadioButton();
    transfer = new JRadioButton();
    searchList = new JButton();
    arrivalVO = new JTabbedPane();
    panel1 = new JPanel();
    scrollPane1 = new JScrollPane();
    arrivalVOTable = new JTable();
    label1 = new JLabel();
    transferID = new JTextField();
    label2 = new JLabel();
    from = new JTextField();
    label3 = new JLabel();
    arrivalDate = new JTextField();
    status = new JComboBox();
    modifyStatus = new JButton();
    cancelArrival = new JButton();
    doArrive = new JButton();
    label4 = new JLabel();
    saveArrival = new JButton();
    entruckVO = new JTabbedPane();
    DeliveryListPanel = new JPanel();
    scrollPane3 = new JScrollPane();
    deliveryTable = new JTable();
    cancelLoad = new JButton();
    createArrival2 = new JButton();
    resultDialog = new JDialog();
    label6 = new JLabel();
    resultSureButton = new JButton();
    errorDialog = new JDialog();
    label7 = new JLabel();
    errorSure = new JButton();

    // ======== this ========
    setLayout(new BorderLayout());

    // ======== startPane ========
    {

      // ======== arrivalListPanel ========
      {

        // ======== scrollPane2 ========
        {
          scrollPane2.setViewportView(arrivalTable);
        }

        // ---- selectArrival ----
        selectArrival.setText("text");
        selectArrival.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                selectArrivalMouseClicked(e);
              }
            });

        GroupLayout arrivalListPanelLayout = new GroupLayout(arrivalListPanel);
        arrivalListPanel.setLayout(arrivalListPanelLayout);
        arrivalListPanelLayout.setHorizontalGroup(
            arrivalListPanelLayout
                .createParallelGroup()
                .addGroup(
                    arrivalListPanelLayout
                        .createSequentialGroup()
                        .addComponent(
                            scrollPane2,
                            GroupLayout.PREFERRED_SIZE,
                            686,
                            GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(selectArrival, GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                        .addContainerGap()));
        arrivalListPanelLayout.setVerticalGroup(
            arrivalListPanelLayout
                .createParallelGroup()
                .addComponent(
                    scrollPane2,
                    GroupLayout.Alignment.TRAILING,
                    GroupLayout.DEFAULT_SIZE,
                    346,
                    Short.MAX_VALUE)
                .addGroup(
                    GroupLayout.Alignment.TRAILING,
                    arrivalListPanelLayout
                        .createSequentialGroup()
                        .addContainerGap(304, Short.MAX_VALUE)
                        .addComponent(
                            selectArrival,
                            GroupLayout.PREFERRED_SIZE,
                            32,
                            GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));
      }
      startPane.addTab("\u5230\u8fbe\u5355\u5217\u8868", arrivalListPanel);

      // ======== searchListPanel ========
      {

        // ---- label5 ----
        label5.setText("\u8bf7\u8f93\u5165\u8fd0\u8f93\u5355\u53f7");

        // ---- entruck ----
        entruck.setText("\u88c5\u8f66\u5355");
        entruck.setSelected(true);
        entruck.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                entruckMouseClicked(e);
                entruckMouseClicked(e);
              }
            });

        // ---- transfer ----
        transfer.setText("\u4e2d\u8f6c\u5355");
        transfer.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                transferMouseClicked(e);
              }
            });

        // ---- searchList ----
        searchList.setText("\u67e5\u627e");
        searchList.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                searchListMouseClicked(e);
              }
            });

        GroupLayout searchListPanelLayout = new GroupLayout(searchListPanel);
        searchListPanel.setLayout(searchListPanelLayout);
        searchListPanelLayout.setHorizontalGroup(
            searchListPanelLayout
                .createParallelGroup()
                .addGroup(
                    searchListPanelLayout
                        .createSequentialGroup()
                        .addGap(128, 128, 128)
                        .addComponent(
                            label5, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(
                            searchListPanelLayout
                                .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                                .addGroup(
                                    searchListPanelLayout
                                        .createSequentialGroup()
                                        .addComponent(entruck)
                                        .addPreferredGap(
                                            LayoutStyle.ComponentPlacement.RELATED,
                                            GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE)
                                        .addComponent(transfer))
                                .addComponent(
                                    deliveryID,
                                    GroupLayout.PREFERRED_SIZE,
                                    157,
                                    GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(
                            searchList, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(314, Short.MAX_VALUE)));
        searchListPanelLayout.setVerticalGroup(
            searchListPanelLayout
                .createParallelGroup()
                .addGroup(
                    searchListPanelLayout
                        .createSequentialGroup()
                        .addGap(95, 95, 95)
                        .addGroup(
                            searchListPanelLayout
                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(label5)
                                .addComponent(
                                    deliveryID,
                                    GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                                .addComponent(searchList))
                        .addGap(18, 18, 18)
                        .addGroup(
                            searchListPanelLayout
                                .createParallelGroup()
                                .addComponent(transfer)
                                .addComponent(entruck))
                        .addContainerGap(187, Short.MAX_VALUE)));
      }
      startPane.addTab("searchList", searchListPanel);
    }
    add(startPane, BorderLayout.CENTER);

    // ======== arrivalVO ========
    {

      // ======== panel1 ========
      {

        // ======== scrollPane1 ========
        {
          scrollPane1.setViewportView(arrivalVOTable);
        }

        // ---- label1 ----
        label1.setText("\u8fd0\u8f6c\u5355\u7f16\u53f7");

        // ---- label3 ----
        label3.setText("\u65e5\u671f");

        // ---- modifyStatus ----
        modifyStatus.setText("text");

        // ---- cancelArrival ----
        cancelArrival.setText("\u53d6\u6d88");
        cancelArrival.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                cancelArrivalMouseClicked(e);
                cancelArrivalMouseClicked(e);
                cancelArrivalMouseClicked(e);
                cancelArrivalMouseClicked(e);
                cancelArrivalMouseClicked(e);
              }
            });

        // ---- doArrive ----
        doArrive.setText("\u786e\u8ba4\u5230\u8fbe");
        doArrive.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                doArriveMouseClicked(e);
              }
            });

        // ---- label4 ----
        label4.setText("\u51fa\u53d1\u5730");

        // ---- saveArrival ----
        saveArrival.setText("\u4fdd\u5b58");
        saveArrival.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                saveArrivalMouseClicked(e);
              }
            });

        GroupLayout panel1Layout = new GroupLayout(panel1);
        panel1.setLayout(panel1Layout);
        panel1Layout.setHorizontalGroup(
            panel1Layout
                .createParallelGroup()
                .addGroup(
                    panel1Layout
                        .createSequentialGroup()
                        .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(
                            panel1Layout
                                .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                .addGroup(
                                    panel1Layout
                                        .createSequentialGroup()
                                        .addComponent(
                                            status,
                                            GroupLayout.PREFERRED_SIZE,
                                            117,
                                            GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(
                                            modifyStatus,
                                            GroupLayout.PREFERRED_SIZE,
                                            105,
                                            GroupLayout.PREFERRED_SIZE))
                                .addGroup(
                                    panel1Layout
                                        .createParallelGroup()
                                        .addComponent(
                                            scrollPane1,
                                            GroupLayout.PREFERRED_SIZE,
                                            671,
                                            GroupLayout.PREFERRED_SIZE)
                                        .addGroup(
                                            panel1Layout
                                                .createSequentialGroup()
                                                .addGroup(
                                                    panel1Layout
                                                        .createParallelGroup()
                                                        .addGroup(
                                                            panel1Layout
                                                                .createParallelGroup(
                                                                    GroupLayout.Alignment.TRAILING,
                                                                    false)
                                                                .addComponent(
                                                                    label3,
                                                                    GroupLayout.Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                                .addGroup(
                                                                    GroupLayout.Alignment.LEADING,
                                                                    panel1Layout
                                                                        .createSequentialGroup()
                                                                        .addGap(30, 30, 30)
                                                                        .addComponent(
                                                                            label2,
                                                                            GroupLayout
                                                                                .DEFAULT_SIZE,
                                                                            GroupLayout
                                                                                .DEFAULT_SIZE,
                                                                            Short.MAX_VALUE))
                                                                .addComponent(
                                                                    label1,
                                                                    GroupLayout.Alignment.LEADING,
                                                                    GroupLayout.PREFERRED_SIZE,
                                                                    100,
                                                                    GroupLayout.PREFERRED_SIZE))
                                                        .addComponent(
                                                            label4,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            80,
                                                            GroupLayout.PREFERRED_SIZE))
                                                .addPreferredGap(
                                                    LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(
                                                    panel1Layout
                                                        .createParallelGroup(
                                                            GroupLayout.Alignment.LEADING, false)
                                                        .addComponent(
                                                            transferID,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            70,
                                                            Short.MAX_VALUE)
                                                        .addComponent(
                                                            from,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            70,
                                                            Short.MAX_VALUE)
                                                        .addComponent(
                                                            arrivalDate,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            70,
                                                            Short.MAX_VALUE)))))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(
                            panel1Layout
                                .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                                .addComponent(
                                    cancelArrival, GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
                                .addComponent(
                                    doArrive, GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
                                .addComponent(
                                    saveArrival, GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE))
                        .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        panel1Layout.setVerticalGroup(
            panel1Layout
                .createParallelGroup()
                .addGroup(
                    GroupLayout.Alignment.TRAILING,
                    panel1Layout
                        .createSequentialGroup()
                        .addContainerGap()
                        .addGroup(
                            panel1Layout
                                .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                .addGroup(
                                    panel1Layout
                                        .createSequentialGroup()
                                        .addGap(0, 168, Short.MAX_VALUE)
                                        .addComponent(
                                            saveArrival,
                                            GroupLayout.PREFERRED_SIZE,
                                            50,
                                            GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(
                                            doArrive,
                                            GroupLayout.PREFERRED_SIZE,
                                            48,
                                            GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(cancelArrival))
                                .addGroup(
                                    panel1Layout
                                        .createSequentialGroup()
                                        .addGroup(
                                            panel1Layout
                                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                                .addComponent(
                                                    transferID,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                                .addComponent(label1))
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(
                                            panel1Layout
                                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                                .addComponent(label2)
                                                .addComponent(
                                                    from,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                                .addComponent(label4))
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(
                                            panel1Layout
                                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                                .addComponent(label3)
                                                .addComponent(
                                                    arrivalDate,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE))
                                        .addGap(11, 11, 11)
                                        .addGroup(
                                            panel1Layout
                                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                                .addComponent(
                                                    status,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                                .addComponent(modifyStatus))
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(
                                            scrollPane1,
                                            GroupLayout.DEFAULT_SIZE,
                                            186,
                                            Short.MAX_VALUE)))
                        .addContainerGap()));
      }
      arrivalVO.addTab("\u5230\u8fbe\u5355", panel1);
    }

    // ======== entruckVO ========
    {

      // ======== DeliveryListPanel ========
      {

        // ======== scrollPane3 ========
        {
          scrollPane3.setViewportView(deliveryTable);
        }

        // ---- cancelLoad ----
        cancelLoad.setText("\u53d6\u6d88");
        cancelLoad.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                cancelLoadMouseClicked(e);
                cancelLoadMouseClicked(e);
                cancelLoadMouseClicked(e);
              }
            });

        // ---- createArrival2 ----
        createArrival2.setText("\u751f\u6210\u5230\u8fbe\u5355");
        createArrival2.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseClicked(MouseEvent e) {
                createArrivalMouseClicked(e);
              }
            });

        GroupLayout DeliveryListPanelLayout = new GroupLayout(DeliveryListPanel);
        DeliveryListPanel.setLayout(DeliveryListPanelLayout);
        DeliveryListPanelLayout.setHorizontalGroup(
            DeliveryListPanelLayout.createParallelGroup()
                .addGroup(
                    DeliveryListPanelLayout.createSequentialGroup()
                        .addComponent(
                            scrollPane3,
                            GroupLayout.PREFERRED_SIZE,
                            693,
                            GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(
                            DeliveryListPanelLayout.createParallelGroup()
                                .addComponent(
                                    cancelLoad,
                                    GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                                .addGroup(
                                    DeliveryListPanelLayout.createSequentialGroup()
                                        .addComponent(createArrival2)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        DeliveryListPanelLayout.setVerticalGroup(
            DeliveryListPanelLayout.createParallelGroup()
                .addGroup(
                    DeliveryListPanelLayout.createSequentialGroup()
                        .addGap(35, 135, Short.MAX_VALUE)
                        .addGroup(
                            DeliveryListPanelLayout.createParallelGroup()
                                .addComponent(
                                    scrollPane3,
                                    GroupLayout.Alignment.TRAILING,
                                    GroupLayout.PREFERRED_SIZE,
                                    186,
                                    GroupLayout.PREFERRED_SIZE)
                                .addGroup(
                                    GroupLayout.Alignment.TRAILING,
                                    DeliveryListPanelLayout.createSequentialGroup()
                                        .addComponent(
                                            createArrival2,
                                            GroupLayout.PREFERRED_SIZE,
                                            32,
                                            GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(cancelLoad)
                                        .addContainerGap()))));
      }
      entruckVO.addTab("\u8fd0\u8f6c\u5355", DeliveryListPanel);
    }

    // ======== resultDialog ========
    {
      resultDialog.setTitle("\u64cd\u4f5c\u7ed3\u679c");
      Container resultDialogContentPane = resultDialog.getContentPane();

      // ---- label6 ----
      label6.setText("\u64cd\u4f5c\u6210\u529f");

      // ---- resultSureButton ----
      resultSureButton.setText("\u786e\u5b9a");
      resultSureButton.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
              resultSureButtonMouseClicked(e);
            }
          });

      GroupLayout resultDialogContentPaneLayout = new GroupLayout(resultDialogContentPane);
      resultDialogContentPane.setLayout(resultDialogContentPaneLayout);
      resultDialogContentPaneLayout.setHorizontalGroup(
          resultDialogContentPaneLayout
              .createParallelGroup()
              .addGroup(
                  resultDialogContentPaneLayout
                      .createSequentialGroup()
                      .addGap(118, 118, 118)
                      .addGroup(
                          resultDialogContentPaneLayout
                              .createParallelGroup()
                              .addComponent(resultSureButton)
                              .addComponent(
                                  label6,
                                  GroupLayout.PREFERRED_SIZE,
                                  63,
                                  GroupLayout.PREFERRED_SIZE))
                      .addContainerGap(123, Short.MAX_VALUE)));
      resultDialogContentPaneLayout.setVerticalGroup(
          resultDialogContentPaneLayout
              .createParallelGroup()
              .addGroup(
                  resultDialogContentPaneLayout
                      .createSequentialGroup()
                      .addGap(51, 51, 51)
                      .addComponent(label6)
                      .addGap(28, 28, 28)
                      .addComponent(resultSureButton)
                      .addContainerGap(44, Short.MAX_VALUE)));
      resultDialog.setSize(320, 200);
      resultDialog.setLocationRelativeTo(null);
    }

    // ======== errorDialog ========
    {
      errorDialog.setTitle("\u5f02\u5e38");
      Container errorDialogContentPane = errorDialog.getContentPane();

      // ---- label7 ----
      label7.setText("\u7f51\u7edc\u8fde\u63a5\u4e2d\u65ad");

      // ---- errorSure ----
      errorSure.setText("\u786e\u5b9a");
      errorSure.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
              button1MouseClicked(e);
              errorSureMouseClicked(e);
            }
          });

      GroupLayout errorDialogContentPaneLayout = new GroupLayout(errorDialogContentPane);
      errorDialogContentPane.setLayout(errorDialogContentPaneLayout);
      errorDialogContentPaneLayout.setHorizontalGroup(
          errorDialogContentPaneLayout
              .createParallelGroup()
              .addGroup(
                  errorDialogContentPaneLayout
                      .createSequentialGroup()
                      .addContainerGap(95, Short.MAX_VALUE)
                      .addGroup(
                          errorDialogContentPaneLayout
                              .createParallelGroup()
                              .addGroup(
                                  GroupLayout.Alignment.TRAILING,
                                  errorDialogContentPaneLayout
                                      .createSequentialGroup()
                                      .addComponent(
                                          label7,
                                          GroupLayout.PREFERRED_SIZE,
                                          89,
                                          GroupLayout.PREFERRED_SIZE)
                                      .addGap(80, 80, 80))
                              .addGroup(
                                  GroupLayout.Alignment.TRAILING,
                                  errorDialogContentPaneLayout
                                      .createSequentialGroup()
                                      .addComponent(errorSure)
                                      .addGap(111, 111, 111)))));
      errorDialogContentPaneLayout.setVerticalGroup(
          errorDialogContentPaneLayout
              .createParallelGroup()
              .addGroup(
                  errorDialogContentPaneLayout
                      .createSequentialGroup()
                      .addGap(41, 41, 41)
                      .addComponent(label7)
                      .addGap(36, 36, 36)
                      .addComponent(errorSure)
                      .addContainerGap(46, Short.MAX_VALUE)));
      errorDialog.pack();
      errorDialog.setLocationRelativeTo(errorDialog.getOwner());
    }
    // //GEN-END:initComponents
  }
Example #6
0
  private void initComponents(String channel) {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Nick K
    searchBar = new JTextField();
    JScrollPane scrollPane2 = new JScrollPane();
    viewerTree = new JTree();

    // ======== this ========
    setTitle("Viewers");
    setIconImage(new ImageIcon(getClass().getResource("/image/icon.png")).getImage());
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(true);
    Container contentPane = getContentPane();

    // ---- searchBar ----
    searchBar.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            String text = searchBar.getText();
            if (text != null) {
              text = text.trim();
              if (text.length() > 0) {
                if (!isFiltering) {
                  isFiltering = true;
                }
                buildFilteredModel(text);
              } else {
                isFiltering = false;
                setViewerTreeModel(defaultModel);
              }
            } else {
              isFiltering = false;
              setViewerTreeModel(defaultModel);
            }
          }
        });

    // ======== scrollPane2 ========
    {
      // ---- viewerTree ---
      default_root = new DefaultMutableTreeNode(channel);
      defaultModel = new DefaultTreeModel(default_root);
      filtered_root = new DefaultMutableTreeNode(channel);
      viewerTree.setShowsRootHandles(true);
      staff = new DefaultMutableTreeNode("Staff");
      admins = new DefaultMutableTreeNode("Admins");
      global_mods = new DefaultMutableTreeNode("Global Moderators");
      mods = new DefaultMutableTreeNode("Moderators");
      viewers = new DefaultMutableTreeNode("Viewers");
      setViewerTreeModel(defaultModel);
      viewerTree.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseReleased(MouseEvent e) {
              if (e.isPopupTrigger()) {
                TreePath selPath = viewerTree.getPathForLocation(e.getX(), e.getY());
                if (selPath != null && selPath.getPathCount() == 3) {
                  // should be a name
                  DefaultMutableTreeNode nameNode =
                      (DefaultMutableTreeNode) selPath.getLastPathComponent();
                  ListenerName.createUserPopup(
                      channel, nameNode.getUserObject().toString(), viewerTree, e.getX(), e.getY());
                }
              }
            }
          });
      scrollPane2.setViewportView(viewerTree);
    }
    setMinimumSize(new Dimension(250, 490));
    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPane.setLayout(contentPaneLayout);
    contentPaneLayout.setHorizontalGroup(
        contentPaneLayout
            .createParallelGroup()
            .addComponent(searchBar, GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
            .addComponent(scrollPane2, GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE));
    contentPaneLayout.setVerticalGroup(
        contentPaneLayout
            .createParallelGroup()
            .addGroup(
                GroupLayout.Alignment.TRAILING,
                contentPaneLayout
                    .createSequentialGroup()
                    .addComponent(
                        searchBar,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(scrollPane2, GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE)));
    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            GUIMain.viewerLists.remove(channel);
          }
        });
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }
Example #7
0
  protected void buildErrorPanel() {
    errorPanel = new JPanel();
    GroupLayout layout = new GroupLayout(errorPanel);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    errorPanel.setLayout(layout);
    //    errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK));
    errorMessage = new JTextPane();
    errorMessage.setEditable(false);
    errorMessage.setContentType("text/html");
    errorMessage.setText(
        "<html><body>Could not connect to the Processing server.<br>"
            + "Contributions cannot be installed or updated without an Internet connection.<br>"
            + "Please verify your network connection again, then try connecting again.</body></html>");
    errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    errorMessage.setMaximumSize(new Dimension(550, 50));
    errorMessage.setOpaque(false);

    StyledDocument doc = errorMessage.getStyledDocument();
    SimpleAttributeSet center = new SimpleAttributeSet();
    StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
    doc.setParagraphAttributes(0, doc.getLength(), center, false);

    closeButton = new JButton("X");
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, false);
          }
        });
    tryAgainButton = new JButton("Try Again");
    tryAgainButton.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    tryAgainButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, true);
            contribDialog.downloadAndUpdateContributionListing(editor.getBase());
          }
        });
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(errorMessage)
                    .addComponent(
                        tryAgainButton,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH))
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(closeButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout.createParallelGroup().addComponent(errorMessage).addComponent(closeButton))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(tryAgainButton));
    errorPanel.setBackground(Color.PINK);
    errorPanel.validate();
  }
    private void launch() {

      head = new JLabel();
      pass = new JLabel();
      id = new JLabel();
      email = new JRoundButton(null, new ImageIcon("Bin\\img\\changemail.png"));
      pas = new JRoundButton(null, new ImageIcon("Bin\\img\\changepass.png"));

      head.setFont(new Font("Verdana", 1, 18));
      head.setText("Edit User's Account");

      pass.setFont(new Font("Serif", 1, 14));
      pass.setText("Change Password");

      id.setFont(new Font("Serif", 1, 14));
      id.setText("Change Email ID");

      pas.setToolTipText("Change Password");

      email.setToolTipText("Change Email ID");

      email.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              dispose();
              new email().setVisible(true);
            }
          });

      pas.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              dispose();
              new pas().setVisible(true);
            }
          });

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(95, 95, 95)
                                      .addComponent(head))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(72, 72, 72)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(
                                                  GroupLayout.Alignment.LEADING, false)
                                              .addGroup(
                                                  layout
                                                      .createSequentialGroup()
                                                      .addComponent(id)
                                                      .addPreferredGap(
                                                          javax.swing.LayoutStyle.ComponentPlacement
                                                              .RELATED,
                                                          javax.swing.GroupLayout.DEFAULT_SIZE,
                                                          Short.MAX_VALUE)
                                                      .addComponent(email))
                                              .addGroup(
                                                  layout
                                                      .createSequentialGroup()
                                                      .addComponent(pass)
                                                      .addGap(69, 69, 69)
                                                      .addComponent(pas)))))
                      .addContainerGap(79, Short.MAX_VALUE)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(39, 39, 39)
                      .addComponent(head)
                      .addGap(50, 50, 50)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(pass)
                              .addComponent(pas))
                      .addGap(42, 42, 42)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(id)
                              .addComponent(email))
                      .addContainerGap(100, Short.MAX_VALUE)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Edit Account");
      pack();
    }
    private void launch() {

      head = new JLabel();
      old = new JLabel();
      new1 = new JLabel();
      new2 = new JLabel();
      pas1 = new JPasswordField();
      JTextComponent.KeyBinding[] newBindings = {
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction)
      };

      Keymap k = pas1.getKeymap();
      JTextComponent.loadKeymap(k, newBindings, pas1.getActions());
      pas2 = new JPasswordField();

      Keymap k2 = pas2.getKeymap();
      JTextComponent.loadKeymap(k2, newBindings, pas2.getActions());
      pas3 = new JPasswordField();

      Keymap k3 = pas3.getKeymap();
      JTextComponent.loadKeymap(k3, newBindings, pas3.getActions());
      XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png"));

      sub.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (pas1.getText().equals(pwd)) {
                if ((pas1.getText().equalsIgnoreCase(""))
                    || (pas1.getText().equalsIgnoreCase(null))
                    || (pas2.getText().equalsIgnoreCase(""))
                    || (pas2.getText().equalsIgnoreCase(null))
                    || (pas3.getText().equalsIgnoreCase(""))
                    || (pas3.getText().equalsIgnoreCase(null))) {
                  JOptionPane.showMessageDialog(
                      null, "Please all the text fields", "Error", JOptionPane.ERROR_MESSAGE);
                } else {
                  if ((pas2.getText().equalsIgnoreCase(pas3.getText()))) {
                    String r = update(pas2.getText());
                    if (r.equalsIgnoreCase("ok")) {
                      JOptionPane.showMessageDialog(
                          null, "Updated....", "Alert", JOptionPane.INFORMATION_MESSAGE);
                    } else {
                      JOptionPane.showMessageDialog(
                          null,
                          "Encountered Error cant update..",
                          "Error",
                          JOptionPane.ERROR_MESSAGE);
                    }
                  } else {
                    JOptionPane.showMessageDialog(
                        null, "New password do not match", "Error", JOptionPane.ERROR_MESSAGE);
                  }
                }
              } else {
                JOptionPane.showMessageDialog(
                    null, "Incorrect old password", "Error", JOptionPane.ERROR_MESSAGE);
              }
              dispose();
            }
          });

      head.setFont(new Font("Verdana", 1, 16));
      head.setText("Change Password");

      old.setFont(new Font("Verdana", 0, 12));
      old.setText("Old Password");

      new1.setFont(new Font("Verdana", 0, 12));
      new1.setText("New Password");

      new2.setFont(new Font("Verdana", 0, 12));
      new2.setText("Confirm Password");

      sub.setToolTipText("Submit");

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(57, 57, 57)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(old)
                              .addComponent(new1)
                              .addComponent(new2))
                      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(
                                  pas1, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)
                              .addComponent(
                                  pas2, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)
                              .addComponent(
                                  pas3,
                                  GroupLayout.PREFERRED_SIZE,
                                  123,
                                  GroupLayout.PREFERRED_SIZE))
                      .addContainerGap(57, Short.MAX_VALUE))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(166, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(161, 161, 161))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(122, Short.MAX_VALUE)
                      .addComponent(head)
                      .addGap(119, 119, 119)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(31, 31, 31)
                      .addComponent(head)
                      .addGap(50, 50, 50)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(old)
                              .addComponent(
                                  pas1,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(30, 30, 30)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(new1)
                              .addComponent(
                                  pas2,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(28, 28, 28)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(new2)
                              .addComponent(
                                  pas3,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(22, 22, 22)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Change Password");
      pack();
    }
Example #10
0
  private void launch() {
    JRoundButton view;
    JRoundButton edit;
    JRoundButton print;
    JRoundButton mail;
    JLabel jLabel1;
    jLabel1 = new JLabel();
    view = new JRoundButton(null, new ImageIcon("Bin\\img\\view.png"));
    mail = new JRoundButton(null, new ImageIcon("Bin\\img\\mail.png"));
    print = new JRoundButton(null, new ImageIcon("Bin\\img\\viewcomp.png"));
    edit = new JRoundButton(null, new ImageIcon("Bin\\img\\edit.png"));

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("Choose Options");
    setResizable(false);
    setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
    jLabel1.setIcon(new ImageIcon("Bin\\img\\1960_Air_India.jpg"));
    edit.setToolTipText("Edit Account");
    mail.setToolTipText("Mail Pay Slip");
    view.setToolTipText("View Pay Slip without PLI");
    print.setActionCommand("Merge");
    edit.setActionCommand("Edit");
    mail.setActionCommand("Mail");
    view.setActionCommand("View");
    print.setToolTipText("View Pay Slip with PLI");
    print.addActionListener(this);
    edit.addActionListener(this);
    mail.addActionListener(this);
    view.addActionListener(this);
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(43, 43, 43) // 59,59,59
                                    .addComponent(jLabel1))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(24, 24, 24)
                                    .addComponent(print)
                                    .addGap(36, 36, 36)
                                    .addComponent(view)
                                    .addGap(35, 35, 35)
                                    .addComponent(mail)
                                    .addGap(29, 29, 29)
                                    .addComponent(edit)))
                    .addContainerGap(35, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(41, 41, 41)
                    .addComponent(jLabel1)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(print)
                            .addComponent(view)
                            .addComponent(mail)
                            .addComponent(edit))
                    .addContainerGap()));
    setLocation(h / 2, w / 14);
    pack();
  }
Example #11
0
    private void launch() {

      head = new JLabel();
      pas = new JPasswordField();
      JTextComponent.KeyBinding[] newBindings = {
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction)
      };

      Keymap k = pas.getKeymap();
      JTextComponent.loadKeymap(k, newBindings, pas.getActions());
      XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png"));

      head.setFont(new Font("Verdana", 1, 16));
      head.setText("Employee ID: " + emp + " please enter the password");

      sub.setFont(new Font("Verdana", 1, 12));
      sub.setToolTipText("Submit");

      sub.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              String pwd = new CheckQuery(emp).search(rav);
              if ((pas.getText().equalsIgnoreCase(null)) || (pas.getText().equalsIgnoreCase(""))) {
                JOptionPane.showMessageDialog(
                    null, "Please Enter the Password", "Error", JOptionPane.ERROR_MESSAGE);
              } else if (pas.getText().equalsIgnoreCase(pwd)) {
                dispose();
                merge();
              } else {
                JOptionPane.showMessageDialog(
                    null, "Oops Incorrect Password", "Error", JOptionPane.ERROR_MESSAGE);
              }
            }
          });

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(196, 196, 196)
                                      .addComponent(sub))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(31, 31, 31)
                                      .addComponent(head))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(126, 126, 126)
                                      .addComponent(
                                          pas,
                                          GroupLayout.PREFERRED_SIZE,
                                          216,
                                          GroupLayout.PREFERRED_SIZE)))
                      .addContainerGap(34, Short.MAX_VALUE)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(33, 33, 33)
                      .addComponent(head)
                      .addGap(45, 45, 45)
                      .addComponent(
                          pas,
                          GroupLayout.PREFERRED_SIZE,
                          GroupLayout.DEFAULT_SIZE,
                          GroupLayout.PREFERRED_SIZE)
                      .addGap(56, 56, 56)
                      .addComponent(sub)
                      .addContainerGap(42, Short.MAX_VALUE)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Authentication");
      pack();
    }
Example #12
0
  public void createGUI() {

    JButton submitButton = new JButton("Submit");
    submitButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {

            // get text from input fields
            inputPath = inputField.getText();
            outputPath = outputField.getText();

            buttonPressed = true;
          }
        });

    JPanel inputPanel = new JPanel();
    inputPanel.add(new JLabel("Input Path"));
    inputPanel.add(inputField);

    JLabel inputLabel = new JLabel("Input Path");
    JLabel outputLabel = new JLabel("Output Path");

    JPanel content = new JPanel();
    content.setLayout(new BorderLayout());

    JPanel textFieldsContent = new JPanel();
    GroupLayout layout = new GroupLayout(textFieldsContent);
    textFieldsContent.setLayout(layout);

    // setting to true creates gaps between components
    layout.setAutoCreateGaps(true);
    // setting to true creates gaps between components and edge of container
    layout.setAutoCreateContainerGaps(true);

    // horizontal axis
    GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup();
    // each sequential group contains two parallel groups.
    //  one will contain labels, other will contain text fields
    horizontalGroup.addGroup(
        layout.createParallelGroup().addComponent(inputLabel).addComponent(outputLabel));
    horizontalGroup.addGroup(
        layout.createParallelGroup().addComponent(inputField).addComponent(outputField));
    layout.setHorizontalGroup(horizontalGroup);

    // vertical axis
    GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup();
    verticalGroup.addGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(inputLabel)
            .addComponent(inputField));
    verticalGroup.addGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(outputLabel)
            .addComponent(outputField));
    layout.setVerticalGroup(verticalGroup);

    content.add(textFieldsContent, BorderLayout.CENTER);
    content.add(submitButton, BorderLayout.PAGE_END);

    window.setContentPane(content);
    window.setSize(350, 200);
    window.setLocation(100, 100);
    window.setVisible(true);
  }
Example #13
0
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    _tabPane = new JTabbedPane();
    JPanel paneCapture = new JPanel();
    _txtHotkey = new JTextField();
    _lblHotkey = new JLabel();
    _lblDelay = new JLabel();
    _spnDelay = new JSpinner();
    _lblDelaySecs = new JLabel();
    _lblNaming = new JLabel();
    _radTimestamp = new JRadioButton();
    _radOCR = new JRadioButton();
    _radOff = new JRadioButton();
    _paneTextEditing = new JPanel();
    _chkExpandTab = new JCheckBox();
    _lblTabWidth = new JLabel();
    _cmbFontName = new JComboBox();
    _lblFont = new JLabel();
    _titleAppearance = compFactory.createTitle("");
    _titleIndentation = compFactory.createTitle("");
    _spnTabWidth = new JSpinner();
    _lblFontSize = new JLabel();
    _spnFontSize = new JSpinner();
    JPanel paneGeneral = new JPanel();
    _chkAutoUpdate = new JCheckBox();
    _cmbLang = new JComboBox();
    _lblUpdates = new JLabel();
    _lblLanguage = new JLabel();
    JPanel paneOkCancel = new JPanel();
    JPanel hSpacer1 = new JPanel(null);
    _btnOk = new JButton();
    _btnApply = new JButton();
    _btnCancel = new JButton();

    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== _tabPane ========
    {
      _tabPane.setBorder(new EmptyBorder(10, 10, 0, 10));

      // ======== paneCapture ========
      {

        // ---- _txtHotkey ----
        _txtHotkey.setHorizontalAlignment(SwingConstants.RIGHT);
        _txtHotkey.addFocusListener(
            new FocusAdapter() {
              @Override
              public void focusGained(FocusEvent e) {
                txtHotkeyFocusGained(e);
              }
            });
        _txtHotkey.addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyPressed(KeyEvent e) {
                txtHotkeyKeyPressed(e);
              }
            });

        // ---- _lblHotkey ----
        _lblHotkey.setLabelFor(_txtHotkey);

        // ---- _lblDelay ----
        _lblDelay.setLabelFor(_spnDelay);

        // ---- _spnDelay ----
        _spnDelay.setModel(new SpinnerNumberModel(1.0, 0.0, null, 0.1));

        // ---- _radTimestamp ----
        _radTimestamp.setSelected(true);

        GroupLayout paneCaptureLayout = new GroupLayout(paneCapture);
        paneCapture.setLayout(paneCaptureLayout);
        paneCaptureLayout.setHorizontalGroup(
            paneCaptureLayout
                .createParallelGroup()
                .add(
                    paneCaptureLayout
                        .createSequentialGroup()
                        .add(26, 26, 26)
                        .add(
                            paneCaptureLayout
                                .createParallelGroup()
                                .add(GroupLayout.TRAILING, _lblDelay)
                                .add(GroupLayout.TRAILING, _lblHotkey)
                                .add(GroupLayout.TRAILING, _lblNaming))
                        .addPreferredGap(LayoutStyle.RELATED)
                        .add(
                            paneCaptureLayout
                                .createParallelGroup()
                                .add(_radTimestamp)
                                .add(_radOCR)
                                .add(_radOff)
                                .add(
                                    paneCaptureLayout
                                        .createSequentialGroup()
                                        .add(
                                            _spnDelay,
                                            GroupLayout.DEFAULT_SIZE,
                                            148,
                                            Short.MAX_VALUE)
                                        .addPreferredGap(LayoutStyle.RELATED)
                                        .add(
                                            _lblDelaySecs,
                                            GroupLayout.DEFAULT_SIZE,
                                            161,
                                            Short.MAX_VALUE))
                                .add(_txtHotkey, GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE))
                        .add(69, 69, 69)));
        paneCaptureLayout.setVerticalGroup(
            paneCaptureLayout
                .createParallelGroup()
                .add(
                    paneCaptureLayout
                        .createSequentialGroup()
                        .add(34, 34, 34)
                        .add(
                            paneCaptureLayout
                                .createParallelGroup(GroupLayout.BASELINE)
                                .add(
                                    _lblHotkey,
                                    GroupLayout.PREFERRED_SIZE,
                                    22,
                                    GroupLayout.PREFERRED_SIZE)
                                .add(
                                    _txtHotkey,
                                    GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.RELATED)
                        .add(
                            paneCaptureLayout
                                .createParallelGroup()
                                .add(
                                    _lblDelay,
                                    GroupLayout.PREFERRED_SIZE,
                                    28,
                                    GroupLayout.PREFERRED_SIZE)
                                .add(
                                    _spnDelay,
                                    GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                                .add(
                                    _lblDelaySecs,
                                    GroupLayout.PREFERRED_SIZE,
                                    28,
                                    GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.RELATED)
                        .add(
                            paneCaptureLayout
                                .createParallelGroup(GroupLayout.LEADING, false)
                                .add(
                                    paneCaptureLayout
                                        .createSequentialGroup()
                                        .add(
                                            paneCaptureLayout
                                                .createParallelGroup(GroupLayout.BASELINE)
                                                .add(
                                                    _lblNaming,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    22,
                                                    GroupLayout.PREFERRED_SIZE)
                                                .add(_radTimestamp))
                                        .add(18, 18, 18)
                                        .add(_radOff)
                                        .addPreferredGap(LayoutStyle.RELATED))
                                .add(
                                    GroupLayout.TRAILING,
                                    paneCaptureLayout
                                        .createSequentialGroup()
                                        .add(_radOCR)
                                        .add(21, 21, 21)))
                        .add(80, 80, 80)));
      }
      _tabPane.addTab(I18N._I("prefTabScreenCapturing"), paneCapture);

      // ======== _paneTextEditing ========
      {

        // ---- _lblTabWidth ----
        _lblTabWidth.setLabelFor(_spnTabWidth);

        // ---- _cmbFontName ----
        _cmbFontName.addItemListener(
            new ItemListener() {
              public void itemStateChanged(ItemEvent e) {
                fontNameItemStateChanged(e);
              }
            });

        // ---- _lblFont ----
        _lblFont.setLabelFor(_cmbFontName);

        // ---- _lblFontSize ----
        _lblFontSize.setLabelFor(_cmbFontName);

        // ---- _spnFontSize ----
        _spnFontSize.addChangeListener(
            new ChangeListener() {
              public void stateChanged(ChangeEvent e) {
                fontSizeStateChanged(e);
              }
            });

        GroupLayout _paneTextEditingLayout = new GroupLayout(_paneTextEditing);
        _paneTextEditing.setLayout(_paneTextEditingLayout);
        _paneTextEditingLayout.setHorizontalGroup(
            _paneTextEditingLayout
                .createParallelGroup()
                .add(
                    GroupLayout.TRAILING,
                    _paneTextEditingLayout
                        .createSequentialGroup()
                        .add(95, 95, 95)
                        .add(
                            _paneTextEditingLayout
                                .createParallelGroup()
                                .add(
                                    _titleIndentation,
                                    GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                                .add(
                                    _paneTextEditingLayout
                                        .createSequentialGroup()
                                        .add(
                                            _titleAppearance,
                                            GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(LayoutStyle.RELATED)
                                        .add(
                                            _paneTextEditingLayout
                                                .createParallelGroup()
                                                .add(
                                                    _paneTextEditingLayout
                                                        .createSequentialGroup()
                                                        .add(29, 29, 29)
                                                        .add(
                                                            _paneTextEditingLayout
                                                                .createParallelGroup()
                                                                .add(
                                                                    GroupLayout.TRAILING,
                                                                    _lblTabWidth)
                                                                .add(GroupLayout.TRAILING, _lblFont)
                                                                .add(
                                                                    GroupLayout.TRAILING,
                                                                    _lblFontSize))
                                                        .addPreferredGap(LayoutStyle.RELATED)
                                                        .add(
                                                            _paneTextEditingLayout
                                                                .createParallelGroup()
                                                                .add(
                                                                    _cmbFontName,
                                                                    0,
                                                                    218,
                                                                    Short.MAX_VALUE)
                                                                .add(
                                                                    _spnFontSize,
                                                                    GroupLayout.PREFERRED_SIZE,
                                                                    67,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                                .add(
                                                                    _spnTabWidth,
                                                                    GroupLayout.PREFERRED_SIZE,
                                                                    52,
                                                                    GroupLayout.PREFERRED_SIZE))
                                                        .addPreferredGap(
                                                            LayoutStyle.RELATED,
                                                            97,
                                                            Short.MAX_VALUE))
                                                .add(
                                                    _chkExpandTab,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    420,
                                                    Short.MAX_VALUE))))
                        .addContainerGap()));
        _paneTextEditingLayout.setVerticalGroup(
            _paneTextEditingLayout
                .createParallelGroup()
                .add(
                    _paneTextEditingLayout
                        .createSequentialGroup()
                        .add(21, 21, 21)
                        .add(
                            _titleIndentation,
                            GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                        .add(
                            _paneTextEditingLayout
                                .createParallelGroup()
                                .add(
                                    _paneTextEditingLayout
                                        .createSequentialGroup()
                                        .add(81, 81, 81)
                                        .add(
                                            _titleAppearance,
                                            GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                                .add(
                                    _paneTextEditingLayout
                                        .createSequentialGroup()
                                        .addPreferredGap(LayoutStyle.RELATED)
                                        .add(_chkExpandTab)
                                        .addPreferredGap(LayoutStyle.RELATED)
                                        .add(
                                            _paneTextEditingLayout
                                                .createParallelGroup()
                                                .add(
                                                    _lblTabWidth,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    16,
                                                    GroupLayout.PREFERRED_SIZE)
                                                .add(
                                                    _spnTabWidth,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE))
                                        .add(40, 40, 40)
                                        .add(
                                            _paneTextEditingLayout
                                                .createParallelGroup(GroupLayout.BASELINE)
                                                .add(_lblFont)
                                                .add(
                                                    _cmbFontName,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(LayoutStyle.RELATED)
                                        .add(
                                            _paneTextEditingLayout
                                                .createParallelGroup(GroupLayout.TRAILING)
                                                .add(
                                                    _lblFontSize,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    27,
                                                    GroupLayout.PREFERRED_SIZE)
                                                .add(
                                                    _spnFontSize,
                                                    GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap(154, Short.MAX_VALUE)));
        _paneTextEditingLayout.linkSize(
            new Component[] {_lblTabWidth, _spnTabWidth}, GroupLayout.VERTICAL);
        _paneTextEditingLayout.linkSize(
            new Component[] {_cmbFontName, _lblFont}, GroupLayout.VERTICAL);
      }
      _tabPane.addTab(I18N._I("PreferencesWin.paneTextEditing.tab.title"), _paneTextEditing);

      // ======== paneGeneral ========
      {

        // ---- _lblUpdates ----
        _lblUpdates.setFont(
            _lblUpdates.getFont().deriveFont(_lblUpdates.getFont().getStyle() | Font.BOLD));

        // ---- _lblLanguage ----
        _lblLanguage.setFont(
            _lblLanguage.getFont().deriveFont(_lblLanguage.getFont().getStyle() | Font.BOLD));

        GroupLayout paneGeneralLayout = new GroupLayout(paneGeneral);
        paneGeneral.setLayout(paneGeneralLayout);
        paneGeneralLayout.setHorizontalGroup(
            paneGeneralLayout
                .createParallelGroup()
                .add(
                    paneGeneralLayout
                        .createSequentialGroup()
                        .add(137, 137, 137)
                        .add(
                            paneGeneralLayout
                                .createParallelGroup()
                                .add(
                                    paneGeneralLayout
                                        .createSequentialGroup()
                                        .add(_lblLanguage)
                                        .add(185, 185, 185))
                                .add(
                                    paneGeneralLayout
                                        .createSequentialGroup()
                                        .add(38, 38, 38)
                                        .add(
                                            _cmbLang,
                                            GroupLayout.PREFERRED_SIZE,
                                            215,
                                            GroupLayout.PREFERRED_SIZE))
                                .add(
                                    paneGeneralLayout
                                        .createSequentialGroup()
                                        .add(_lblUpdates)
                                        .add(318, 318, 318))
                                .add(
                                    GroupLayout.TRAILING,
                                    paneGeneralLayout
                                        .createSequentialGroup()
                                        .add(38, 38, 38)
                                        .add(
                                            _chkAutoUpdate,
                                            GroupLayout.DEFAULT_SIZE,
                                            376,
                                            Short.MAX_VALUE)))
                        .addContainerGap()));
        paneGeneralLayout.setVerticalGroup(
            paneGeneralLayout
                .createParallelGroup()
                .add(
                    paneGeneralLayout
                        .createSequentialGroup()
                        .add(26, 26, 26)
                        .add(_lblUpdates)
                        .addPreferredGap(LayoutStyle.RELATED)
                        .add(_chkAutoUpdate)
                        .add(40, 40, 40)
                        .add(_lblLanguage)
                        .addPreferredGap(LayoutStyle.RELATED)
                        .add(
                            _cmbLang,
                            GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(196, Short.MAX_VALUE)));
      }
      _tabPane.addTab(I18N._I("prefTabGeneralSettings"), paneGeneral);
    }
    contentPane.add(_tabPane, BorderLayout.CENTER);

    // ======== paneOkCancel ========
    {
      paneOkCancel.setBorder(new EmptyBorder(5, 5, 5, 5));
      paneOkCancel.setLayout(new BoxLayout(paneOkCancel, BoxLayout.X_AXIS));
      paneOkCancel.add(hSpacer1);

      // ---- _btnOk ----
      _btnOk.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              btnOkActionPerformed(e);
            }
          });
      paneOkCancel.add(_btnOk);

      // ---- _btnCancel ----
      _btnCancel.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              btnCancelActionPerformed(e);
            }
          });
      paneOkCancel.add(_btnCancel);

      // ---- _btnApply ----
      _btnApply.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              btnApplyActionPerformed(e);
            }
          });
      paneOkCancel.add(_btnApply);
    }
    contentPane.add(paneOkCancel, BorderLayout.SOUTH);
    setSize(600, 475);
    setLocationRelativeTo(getOwner());

    // ---- btngrpNaming ----
    ButtonGroup btngrpNaming = new ButtonGroup();
    btngrpNaming.add(_radTimestamp);
    btngrpNaming.add(_radOCR);
    btngrpNaming.add(_radOff);

    initComponentsI18n();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }
Example #14
0
  public fileBackupProgram(JFrame frame) {
    super(new BorderLayout());
    this.frame = frame;

    errorDialog = new CustomDialog(frame, "Please enter a new name for the error log", this);
    errorDialog.pack();

    moveDialog = new CustomDialog(frame, "Please enter a new name for the move log", this);
    moveDialog.pack();

    printer = new FilePrinter();
    timers = new ArrayList<>();
    log = new JTextArea(5, 20);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);
    Object obj;
    copy = true;
    listModel = new DefaultListModel();
    // destListModel = new DefaultListModel();
    directoryList = new directoryStorage();

    // Create a file chooser
    fc = new JFileChooser();

    // Create the menu bar.
    menuBar = new JMenuBar();

    // Build the first menu.
    menu = new JMenu("File");
    menu.getAccessibleContext()
        .setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    editError = new JMenuItem("Save Error Log As...");
    editError
        .getAccessibleContext()
        .setAccessibleDescription("Change the name of the error log file");
    editError.addActionListener(new ErrorListener());
    menu.add(editError);

    editMove = new JMenuItem("Save Move Log As...");
    editMove
        .getAccessibleContext()
        .setAccessibleDescription("Change the name of the move log file");
    editMove.addActionListener(new MoveListener());
    menu.add(editMove);

    exit = new JMenuItem("Exit");
    exit.getAccessibleContext().setAccessibleDescription("Exit the Program");
    exit.addActionListener(new CloseListener());
    menu.add(exit);
    frame.setJMenuBar(menuBar);
    // Uncomment one of the following lines to try a different
    // file selection mode.  The first allows just directories
    // to be selected (and, at least in the Java look and feel,
    // shown).  The second allows both files and directories
    // to be selected.  If you leave these lines commented out,
    // then the default mode (FILES_ONLY) will be used.
    //
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    openButton = new JButton(openString);
    openButton.setActionCommand(openString);
    openButton.addActionListener(new OpenListener());

    destButton = new JButton(destString);
    destButton.setActionCommand(destString);
    destButton.addActionListener(new DestListener());

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    saveButton = new JButton(saveString);
    saveButton.setActionCommand(saveString);
    saveButton.addActionListener(new SaveListener());

    URL imageURL = getClass().getResource(greenButtonIcon);
    ImageIcon greenSquare = new ImageIcon(imageURL);
    startButton = new JButton("Start", greenSquare);
    startButton.setSize(60, 20);
    startButton.setHorizontalTextPosition(AbstractButton.LEADING);
    startButton.setActionCommand("Start");
    startButton.addActionListener(new StartListener());

    imageURL = getClass().getResource(redButtonIcon);
    ImageIcon redSquare = new ImageIcon(imageURL);
    stopButton = new JButton("Stop", redSquare);
    stopButton.setSize(60, 20);
    stopButton.setHorizontalTextPosition(AbstractButton.LEADING);
    stopButton.setActionCommand("Stop");
    stopButton.addActionListener(new StopListener());

    copyButton = new JRadioButton("Copy");
    copyButton.setActionCommand("Copy");
    copyButton.setSelected(true);
    copyButton.addActionListener(new RadioListener());

    moveButton = new JRadioButton("Move");
    moveButton.setActionCommand("Move");
    moveButton.addActionListener(new RadioListener());

    ButtonGroup group = new ButtonGroup();
    group.add(copyButton);
    group.add(moveButton);

    // For layout purposes, put the buttons in a separate panel

    JPanel optionPanel = new JPanel();

    GroupLayout layout = new GroupLayout(optionPanel);
    optionPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout.createSequentialGroup().addComponent(copyButton).addComponent(moveButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(copyButton)
                    .addComponent(moveButton)));

    JPanel buttonPanel = new JPanel(); // use FlowLayout

    layout = new GroupLayout(buttonPanel);
    buttonPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(openButton)
                    .addComponent(optionPanel))
            .addComponent(destButton)
            .addComponent(startButton)
            .addComponent(stopButton)
        // .addComponent(saveButton)
        );
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(openButton)
                    .addComponent(destButton)
                    .addComponent(startButton)
                    .addComponent(stopButton)
                // .addComponent(saveButton)
                )
            .addComponent(optionPanel));

    buttonPanel.add(optionPanel);
    /*
    buttonPanel.add(openButton);
    buttonPanel.add(destButton);
    buttonPanel.add(startButton);
    buttonPanel.add(stopButton);
    buttonPanel.add(saveButton);
    buttonPanel.add(listLabel);
    buttonPanel.add(copyButton);
    buttonPanel.add(moveButton);
    */
    destButton.setEnabled(false);
    startButton.setEnabled(false);
    stopButton.setEnabled(false);

    // Add the buttons and the log to this panel.

    // add(logScrollPane, BorderLayout.CENTER);

    JLabel listLabel = new JLabel("Monitored Directory:");
    listLabel.setLabelFor(list);

    // Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);
    list.setVisibleRowCount(8);
    JScrollPane listScrollPane = new JScrollPane(list);
    JPanel listPane = new JPanel();
    listPane.setLayout(new BorderLayout());

    listPane.add(listLabel, BorderLayout.PAGE_START);
    listPane.add(listScrollPane, BorderLayout.CENTER);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    // monitored, destination, waitInt, check

    destination = new JLabel("Destination Directory: ");

    waitField = new JFormattedTextField();
    // waitField.setValue(240);
    waitField.setEditable(false);
    waitField.addPropertyChangeListener(new FormattedTextListener());

    waitInt = new JLabel("Wait Interval (in minutes)");
    // waitInt.setLabelFor(waitField);

    checkField = new JFormattedTextField();
    checkField.setSize(1, 10);
    // checkField.setValue(60);
    checkField.setEditable(false);
    checkField.addPropertyChangeListener(new FormattedTextListener());

    check = new JLabel("Check Interval (in minutes)");
    // check.setLabelFor(checkField);

    fireButton = new JButton(fireString);
    fireButton.setActionCommand(fireString);
    fireButton.addActionListener(new FireListener());

    JPanel fieldPane = new JPanel();
    // fieldPane.add(destField);
    layout = new GroupLayout(fieldPane);
    fieldPane.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(waitInt)
                    .addComponent(check))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(waitField, 60, 60, 60)
                    .addComponent(checkField, 60, 60, 60)));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(waitInt)
                    .addComponent(waitField))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(check)
                    .addComponent(checkField)));

    JPanel labelPane = new JPanel();

    labelPane.setLayout(new BorderLayout());

    labelPane.add(destination, BorderLayout.PAGE_START);
    labelPane.add(fieldPane, BorderLayout.CENTER);

    layout = new GroupLayout(labelPane);
    labelPane.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(destination)
                    .addComponent(fieldPane)));

    layout.setVerticalGroup(
        layout.createSequentialGroup().addComponent(destination).addComponent(fieldPane));
    // labelPane.add(destination);
    // labelPane.add(fieldPane);

    try {
      // Read from disk using FileInputStream
      FileInputStream f_in = new FileInputStream(LOG_DIRECTORY + "\\save.data");

      // Read object using ObjectInputStream
      ObjectInputStream obj_in = new ObjectInputStream(f_in);

      // Read an object
      directoryList = (directoryStorage) obj_in.readObject();
      ERROR_LOG_NAME = (String) obj_in.readObject();
      MOVE_LOG_NAME = (String) obj_in.readObject();

      if (ERROR_LOG_NAME instanceof String) {
        printer.changeErrorLogName(ERROR_LOG_NAME);
      }

      if (MOVE_LOG_NAME instanceof String) {
        printer.changeMoveLogName(MOVE_LOG_NAME);
      }

      if (directoryList instanceof directoryStorage) {
        System.out.println("found object");
        // directoryList = (directoryStorage) obj;

        Iterator<Directory> directories = directoryList.getDirectories();
        Directory d;
        while (directories.hasNext()) {
          d = directories.next();

          try {
            listModel.addElement(d.getDirectory().toRealPath());
          } catch (IOException x) {
            printer.printError(x.toString());
          }

          int index = list.getSelectedIndex();
          if (index == -1) {
            list.setSelectedIndex(0);
          }

          index = list.getSelectedIndex();
          Directory dir = directoryList.getDirectory(index);

          destButton.setEnabled(true);
          checkField.setValue(dir.getInterval());
          waitField.setValue(dir.getWaitInterval());
          checkField.setEditable(true);
          waitField.setEditable(true);

          // directoryList.addNewDirectory(d);
          // try {
          // listModel.addElement(d.getDirectory().toString());
          // } catch (IOException x) {
          // printer.printError(x.toString());
          // }

          // timer = new Timer();
          // timer.schedule(new CopyTask(d.directory, d.destination, d.getWaitInterval(), printer,
          // d.copy), 0, d.getInterval());
        }

      } else {
        System.out.println("did not find object");
      }
      obj_in.close();
    } catch (ClassNotFoundException x) {
      printer.printError(x.getLocalizedMessage());
      System.err.format("Unable to read");
    } catch (IOException y) {
      printer.printError(y.getLocalizedMessage());
    }

    // Layout the text fields in a panel.

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));

    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(buttonPanel, BorderLayout.PAGE_START);
    add(listPane, BorderLayout.LINE_START);
    // add(destListScrollPane, BorderLayout.CENTER);

    add(fieldPane, BorderLayout.LINE_END);
    add(labelPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
  }
  /** Class constructor - make the JFrame ready */
  public TestProgram() {
    // Set screen size
    Toolkit tk = Toolkit.getDefaultToolkit();
    int x = (int) tk.getScreenSize().getWidth() - 150;
    int y = (int) tk.getScreenSize().getHeight() - 100;
    this.setSize(x, y);

    // Some settings
    this.setTitle("Friends With Benefits - Test program");
    field = new Field();
    random = new Random(System.currentTimeMillis());

    // Set the panel
    c = this.getContentPane();
    c.setLayout(new BorderLayout());

    contentpanel = new ContentPanel();
    contentpanel.setField(field);
    c.add(contentpanel, BorderLayout.CENTER);

    // Menupanel
    menupanel = new JPanel();
    layout = new GroupLayout(menupanel);
    menupanel.setLayout(layout);
    c.add(menupanel, BorderLayout.EAST);

    progress = new JProgressBar(0, 99);
    progress.setValue(99);

    open = new JButton("Open");
    open.setFocusPainted(false);
    save = new JButton("Save");
    save.setFocusPainted(false);
    open.addActionListener(this);
    save.addActionListener(this);

    everywhere = new JRadioButton("Everywhere");
    everywhere.setFocusPainted(false);
    inRectangle = new JRadioButton("In bounding rectangle");
    inRectangle.setFocusPainted(false);
    inRectangle.setSelected(true);

    placeOfCluster = new ButtonGroup();
    placeOfCluster.add(everywhere);
    placeOfCluster.add(inRectangle);

    addnoise = new JButton("Add noise");
    addnoise.setFocusPainted(false);
    addnoise.addActionListener(this);

    circle = new JRadioButton("Circle");
    circle.setFocusPainted(false);
    square = new JRadioButton("Square");
    square.setFocusPainted(false);
    circle.setSelected(true);

    squarecircle = new ButtonGroup();
    squarecircle.add(circle);
    squarecircle.add(square);

    fillFactor = new JSlider();
    fillFactor.setMajorTickSpacing(20);
    fillFactor.setMinorTickSpacing(5);
    fillFactor.setPaintTicks(true);

    addacluster = new JButton("Add simple cluster");
    addacluster.setFocusPainted(false);
    addacluster.addActionListener(this);

    clear = new JButton("Clear field");
    clear.addActionListener(this);
    clear.setFocusPainted(false);

    center = new JButton("Center field");
    center.addActionListener(this);
    center.setFocusPainted(false);

    minAlgo = new JTextField();
    minAlgo.setText("0");
    maxAlgo = new JTextField();
    maxAlgo.setText("10");
    run = new JButton("Run algo");
    run.addActionListener(this);
    run.setFocusPainted(false);

    empty = new JPanel();
    empty.setLayout(new BorderLayout());

    JSeparator sep1 = new JSeparator();
    JSeparator sep2 = new JSeparator();
    JSeparator sep3 = new JSeparator();
    JSeparator sep4 = new JSeparator();
    JLabel runalgo = new JLabel("Run algorithm"), addcluster = new JLabel("Add simple cluster");
    JLabel addNoise = new JLabel("Add noise"), fillf = new JLabel("Fill factor:");
    JLabel minalgo = new JLabel("Min:"), maxalgo = new JLabel("Max:");
    addcluster.setFont(f);
    addNoise.setFont(f);
    runalgo.setFont(f);

    fillFactor.setPreferredSize(
        new Dimension(
            menupanel.getPreferredSize().width / 2, fillFactor.getPreferredSize().height));

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addGroup(
                layout.createSequentialGroup().addComponent(open).addGap(2).addComponent(save))
            .addComponent(sep1)
            .addComponent(addNoise)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(everywhere)
                    .addComponent(inRectangle))
            .addComponent(addnoise)
            .addComponent(sep2)
            .addComponent(addcluster)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(circle)
                    .addComponent(square))
            .addComponent(fillf)
            .addComponent(fillFactor)
            .addComponent(addacluster)
            .addComponent(sep3)
            .addComponent(center)
            .addComponent(clear)
            .addComponent(sep4)
            .addComponent(runalgo)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(minalgo)
                    .addGap(2)
                    .addComponent(minAlgo)
                    .addGap(10)
                    .addComponent(maxalgo)
                    .addGap(2)
                    .addComponent(maxAlgo))
            .addComponent(run)
            .addComponent(empty)
            .addComponent(progress));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(open)
                    .addComponent(save))
            .addGap(5)
            .addComponent(sep1)
            .addGap(5)
            .addComponent(addNoise)
            .addComponent(everywhere)
            .addComponent(inRectangle)
            .addGap(3)
            .addComponent(addnoise)
            .addGap(5)
            .addComponent(sep2)
            .addGap(5)
            .addComponent(addcluster)
            .addComponent(circle)
            .addComponent(square)
            .addGap(3)
            .addComponent(fillf)
            .addGap(3)
            .addComponent(fillFactor)
            .addGap(3)
            .addComponent(addacluster)
            .addGap(5)
            .addComponent(sep3)
            .addGap(5)
            .addComponent(center)
            .addGap(3)
            .addComponent(clear)
            .addGap(5)
            .addComponent(sep4)
            .addGap(5)
            .addComponent(runalgo)
            .addGap(3)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(minalgo)
                    .addComponent(minAlgo)
                    .addComponent(maxalgo)
                    .addComponent(maxAlgo))
            .addComponent(run)
            .addComponent(empty)
            .addComponent(progress));

    int width = menupanel.getPreferredSize().width;

    setSize(addNoise, width - 10);
    setSize(everywhere, width - 20);
    setSize(inRectangle, width - 20);
    setSize(addnoise, width);

    setSize(addcluster, width - 10);
    setSize(circle, width - 20);
    setSize(square, width - 20);
    setSize(addacluster, width);

    setSize(center, width);
    setSize(clear, width);

    setSize(runalgo, width - 10);
    setSize(minalgo, (int) Math.floor(width / 4) - 20);
    setMaxSize(minAlgo, (int) Math.ceil(width / 4));
    setSize(maxalgo, (int) Math.floor(width / 4) - 20);
    setMaxSize(maxAlgo, (int) Math.ceil(width / 4));
    setSize(run, width);

    empty.setPreferredSize(new Dimension(width, 1000));

    menupanel.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.BLACK),
            "Menu",
            TitledBorder.CENTER,
            TitledBorder.DEFAULT_POSITION,
            f));
  }
Example #16
0
    private void launch() {

      head = new JLabel();
      email = new JLabel();
      pas = new JLabel();
      pass = new JPasswordField();
      JTextComponent.KeyBinding[] newBindings = {
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction)
      };

      Keymap k = pass.getKeymap();
      JTextComponent.loadKeymap(k, newBindings, pass.getActions());
      mail = new JTextField();
      XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png"));

      head.setFont(new Font("Verdana", 1, 16));
      head.setText("Change Email ID");

      email.setFont(new Font("Verdana", 0, 12));
      email.setText("Enter New Email ID");

      pas.setFont(new Font("Verdana", 0, 12));
      pas.setText("Enter the Password");

      sub.setToolTipText("Submit");
      sub.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (pass.getText().equals(pwd)) {
                if ((mail.getText().equalsIgnoreCase(null))
                    || (mail.getText().equalsIgnoreCase(""))) {
                  JOptionPane.showMessageDialog(
                      null, "Please Enter the new email id", "Error", JOptionPane.ERROR_MESSAGE);
                } else {
                  String r = update(mail.getText());
                  if (r.equalsIgnoreCase("ok")) {
                    JOptionPane.showMessageDialog(
                        null, "Updated....", "Alert", JOptionPane.INFORMATION_MESSAGE);
                  } else {
                    JOptionPane.showMessageDialog(
                        null,
                        "Encountered Error cant update..",
                        "Error",
                        JOptionPane.ERROR_MESSAGE);
                  }
                }
              } else {

                JOptionPane.showMessageDialog(
                    null, "Incorrect Password", "Error", JOptionPane.ERROR_MESSAGE);
              }
              dispose();
            }
          });

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(118, 118, 118)
                                      .addComponent(head))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(77, 77, 77)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                                              .addComponent(pas)
                                              .addComponent(email))
                                      .addGap(27, 27, 27)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(
                                                  GroupLayout.Alignment.LEADING, false)
                                              .addComponent(mail)
                                              .addComponent(
                                                  pass,
                                                  GroupLayout.DEFAULT_SIZE,
                                                  140,
                                                  Short.MAX_VALUE))))
                      .addContainerGap(31, Short.MAX_VALUE))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(165, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(170, 170, 170)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(38, 38, 38)
                      .addComponent(head)
                      .addGap(48, 48, 48)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(email)
                              .addComponent(
                                  mail,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(29, 29, 29)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(pas, GroupLayout.Alignment.TRAILING)
                              .addComponent(
                                  pass,
                                  GroupLayout.Alignment.TRAILING,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(45, 45, 45)
                      .addComponent(sub)
                      .addContainerGap(56, Short.MAX_VALUE)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Change Email");
      pack();
    }
Example #17
0
  protected void setLayout(final Editor editor, boolean activateErrorPanel, boolean isLoading) {
    if (progressBar == null) {
      progressBar = new JProgressBar();
      progressBar.setVisible(false);

      createComponents();
      buildErrorPanel();

      loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif"));
      loaderLabel.setOpaque(false);
      loaderLabel.setBackground(Color.WHITE);
    }

    int scrollBarWidth =
        contributionListPanel.scrollPane.getVerticalScrollBar().getPreferredSize().width;

    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    //    layout.setAutoCreateContainerGaps(true);
    //    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(ContributionManagerDialog.STATUS_WIDTH)
                    .addComponent(
                        filterField,
                        ContributionManagerDialog.FILTER_WIDTH,
                        ContributionManagerDialog.FILTER_WIDTH,
                        ContributionManagerDialog.FILTER_WIDTH)
                    //                  .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addPreferredGap(
                        LayoutStyle.ComponentPlacement.RELATED,
                        GroupLayout.PREFERRED_SIZE,
                        Short.MAX_VALUE)
                    .addComponent(
                        categoryChooser,
                        ContributionManagerDialog.AUTHOR_WIDTH,
                        ContributionManagerDialog.AUTHOR_WIDTH,
                        ContributionManagerDialog.AUTHOR_WIDTH)
                    .addGap(scrollBarWidth))
            .addComponent(loaderLabel)
            .addComponent(contributionListPanel)
            .addComponent(errorPanel)
            .addComponent(statusPanel));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addContainerGap()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(categoryChooser)
                    .addComponent(filterField))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(loaderLabel)
                    .addComponent(contributionListPanel))
            .addComponent(errorPanel)
            .addComponent(
                statusPanel,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.DEFAULT_SIZE,
                GroupLayout.PREFERRED_SIZE));
    layout.linkSize(SwingConstants.VERTICAL, categoryChooser, filterField);

    // these will occupy space even if not visible
    layout.setHonorsVisibility(contributionListPanel, false);
    layout.setHonorsVisibility(categoryChooser, false);

    setBackground(Color.WHITE);
    setBorder(null);
  }
Example #18
0
  private void initComponents() {
    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception e) {
      // If Nimbus is not available, you can set the GUI to another look and feel.
    }

    usernameLabel = new JLabel();
    usernameField = new JTextField();
    chatroomScrollPane = new JScrollPane();
    chatroomArea = new JTextArea();
    chatMsgLabel = new JLabel();
    chatMsgField = new JTextField();
    chatIPLabel = new JLabel();
    chatIPField = new JTextField();
    portLabel = new JLabel();
    portField = new JTextField();
    joinButton = new JToggleButton();
    sendButton = new JButton();
    leaveButton = new JButton();
    exitButton = new JButton();

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    usernameLabel.setText("Username:"******" ");

    chatroomArea.setEditable(false);
    chatroomArea.setColumns(20);
    chatroomArea.setRows(5);
    chatroomScrollPane.setViewportView(chatroomArea);

    chatMsgLabel.setText("Chat Message:");

    chatIPLabel.setText("Chat Group IP");

    chatIPField.setText("224.27.43.188");

    portLabel.setText("Port");

    portField.setText("4001");

    joinButton.setText("JOIN CHAT");
    joinButton.addActionListener(this);

    sendButton.setText("SEND MESSAGE");
    sendButton.addActionListener(this);

    leaveButton.setText("LEAVE CHAT");
    leaveButton.addActionListener(this);

    exitButton.setText("EXIT");
    exitButton.addActionListener(this);

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(
                                GroupLayout.Alignment.TRAILING,
                                layout
                                    .createSequentialGroup()
                                    .addGap(0, 0, Short.MAX_VALUE)
                                    .addComponent(usernameLabel)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        usernameField,
                                        GroupLayout.PREFERRED_SIZE,
                                        83,
                                        GroupLayout.PREFERRED_SIZE))
                            .addComponent(chatroomScrollPane)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(chatMsgLabel)
                                                    .addPreferredGap(
                                                        LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(
                                                        chatMsgField,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        296,
                                                        GroupLayout.PREFERRED_SIZE))
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                GroupLayout.Alignment.TRAILING,
                                                                false)
                                                            .addComponent(
                                                                chatIPField,
                                                                GroupLayout.Alignment.LEADING)
                                                            .addComponent(
                                                                chatIPLabel,
                                                                GroupLayout.Alignment.LEADING,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE))
                                                    .addGap(18, 18, 18)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                GroupLayout.Alignment.LEADING,
                                                                false)
                                                            .addComponent(
                                                                portField,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                46,
                                                                Short.MAX_VALUE)
                                                            .addComponent(
                                                                portLabel,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE))
                                                    .addGap(18, 18, 18)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                GroupLayout.Alignment.LEADING,
                                                                false)
                                                            .addGroup(
                                                                layout
                                                                    .createSequentialGroup()
                                                                    .addComponent(leaveButton)
                                                                    .addGap(18, 18, 18)
                                                                    .addComponent(
                                                                        exitButton,
                                                                        GroupLayout.DEFAULT_SIZE,
                                                                        GroupLayout.DEFAULT_SIZE,
                                                                        Short.MAX_VALUE))
                                                            .addGroup(
                                                                layout
                                                                    .createSequentialGroup()
                                                                    .addComponent(
                                                                        joinButton,
                                                                        GroupLayout.PREFERRED_SIZE,
                                                                        93,
                                                                        GroupLayout.PREFERRED_SIZE)
                                                                    .addGap(18, 18, 18)
                                                                    .addComponent(sendButton)))))
                                    .addGap(0, 8, Short.MAX_VALUE)))
                    .addContainerGap()));

    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(usernameField)
                            .addComponent(
                                usernameLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addGap(3, 3, 3)
                    .addComponent(
                        chatroomScrollPane,
                        GroupLayout.PREFERRED_SIZE,
                        178,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                chatMsgLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                chatMsgField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(chatIPLabel)
                                            .addComponent(portLabel))
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                chatIPField,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                portField,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(16, 16, 16)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                GroupLayout.Alignment.LEADING, false)
                                            .addComponent(
                                                joinButton,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                sendButton,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))
                                    .addGap(8, 8, 8)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(leaveButton)
                                            .addComponent(exitButton))))
                    .addGap(17, 17, 17)));
    pack();
    setVisible(true);
  }
Example #19
0
    public FilterField() {
      super("");

      filterLabel = new JLabel("Filter");
      filterLabel.setFont(Toolkit.getSansFont(14, Font.PLAIN));
      filterLabel.setOpaque(false);

      setFont(Toolkit.getSansFont(14, Font.PLAIN));
      searchIcon = Toolkit.getLibIconX("manager/search");
      filterLabel.setIcon(searchIcon);
      // searchIcon = new
      // ImageIcon(java.awt.Toolkit.getDefaultToolkit().getImage("NSImage://NSComputerTemplate"));
      setOpaque(false);
      // setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon));

      GroupLayout fl = new GroupLayout(this);
      setLayout(fl);
      fl.setHorizontalGroup(fl.createSequentialGroup().addComponent(filterLabel));
      fl.setVerticalGroup(
          fl.createSequentialGroup()
              .addPreferredGap(
                  LayoutStyle.ComponentPlacement.RELATED,
                  GroupLayout.PREFERRED_SIZE,
                  Short.MAX_VALUE)
              .addComponent(filterLabel)
              .addPreferredGap(
                  LayoutStyle.ComponentPlacement.RELATED,
                  GroupLayout.PREFERRED_SIZE,
                  Short.MAX_VALUE));

      filters = new ArrayList<String>();

      addFocusListener(
          new FocusListener() {
            public void focusLost(FocusEvent focusEvent) {
              if (getText().isEmpty()) {
                //            setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon));
                filterLabel.setVisible(true);
              }
            }

            public void focusGained(FocusEvent focusEvent) {
              //          setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
              filterLabel.setVisible(false);
            }
          });

      getDocument()
          .addDocumentListener(
              new DocumentListener() {
                public void removeUpdate(DocumentEvent e) {
                  applyFilter();
                }

                public void insertUpdate(DocumentEvent e) {
                  applyFilter();
                }

                public void changedUpdate(DocumentEvent e) {
                  applyFilter();
                }
              });
    }
Example #20
0
  public void asetaLayout() {

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(jnimi)
                    .addComponent(aloita)
                    .addComponent(maalivahti)
                    .addComponent(puolustaja1)
                    .addComponent(puolustaja2)
                    .addComponent(puolustaja3)
                    .addComponent(keskikentta1)
                    .addComponent(keskikentta2)
                    .addComponent(keskikentta3)
                    .addComponent(keskikentta4)
                    .addComponent(hyokkaaja1)
                    .addComponent(hyokkaaja2)
                    .addComponent(hyokkaaja3)));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(jnimi)
            .addComponent(aloita)
            .addComponent(maalivahti)
            .addComponent(puolustaja1)
            .addComponent(puolustaja2)
            .addComponent(puolustaja3)
            .addComponent(keskikentta1)
            .addComponent(keskikentta2)
            .addComponent(keskikentta3)
            .addComponent(keskikentta4)
            .addComponent(hyokkaaja1)
            .addComponent(hyokkaaja2)
            .addComponent(hyokkaaja3));

    panelo.add(pisteet, BorderLayout.PAGE_START);
    panelo.add(loki, BorderLayout.CENTER);

    aloita.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String a1 = (String) hyokkaaja1.getSelectedItem();
            String a2 = (String) hyokkaaja2.getSelectedItem();
            String a3 = (String) hyokkaaja3.getSelectedItem();
            String b1 = (String) keskikentta1.getSelectedItem();
            String b2 = (String) keskikentta2.getSelectedItem();
            String b3 = (String) keskikentta3.getSelectedItem();
            String b4 = (String) keskikentta4.getSelectedItem();
            String c1 = (String) puolustaja1.getSelectedItem();
            String c2 = (String) puolustaja2.getSelectedItem();
            String c3 = (String) puolustaja3.getSelectedItem();
            if (a1.equals(a2)
                || a1.equals(a3)
                || a2.equals(a3)
                || b1.equals(b2)
                || b1.equals(b3)
                || b1.equals(b4)
                || b2.equals(b3)
                || b2.equals(b4)
                || b3.equals(b4)
                || c1.equals(c2)
                || c1.equals(c3)
                || c2.equals(c3)) {
              JOptionPane.showMessageDialog(
                  null,
                  "Valitse joka kohtaan eri pelaaja",
                  "Sama pelaaja error",
                  JOptionPane.ERROR_MESSAGE);
            } else {
              aloita.setEnabled(false);
              maalivahti.setEnabled(false);
              hyokkaaja1.setEnabled(false);
              hyokkaaja2.setEnabled(false);
              hyokkaaja3.setEnabled(false);
              keskikentta1.setEnabled(false);
              keskikentta2.setEnabled(false);
              keskikentta3.setEnabled(false);
              keskikentta4.setEnabled(false);
              puolustaja1.setEnabled(false);
              puolustaja2.setEnabled(false);
              puolustaja3.setEnabled(false);
              status = true;
            }
          }
        });
  }