Ejemplo n.º 1
0
  private JPanel createBattlefieldSlidersPanel() {
    JPanel panel = new JPanel();

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

    GroupLayout.SequentialGroup leftToRight = layout.createSequentialGroup();

    GroupLayout.ParallelGroup left = layout.createParallelGroup();
    left.addComponent(battlefieldSizeLabel);
    left.addComponent(battlefieldWidthSlider);
    leftToRight.addGroup(left);

    GroupLayout.ParallelGroup right = layout.createParallelGroup();
    right.addComponent(battlefieldHeightSlider);
    leftToRight.addGroup(right);

    GroupLayout.SequentialGroup topToBottom = layout.createSequentialGroup();

    GroupLayout.ParallelGroup top = layout.createParallelGroup();
    top.addComponent(battlefieldSizeLabel);
    top.addComponent(battlefieldHeightSlider);
    topToBottom.addGroup(top);

    GroupLayout.ParallelGroup bottom = layout.createParallelGroup();
    bottom.addComponent(battlefieldWidthSlider);
    topToBottom.addGroup(bottom);

    layout.setHorizontalGroup(leftToRight);
    layout.setVerticalGroup(topToBottom);

    return panel;
  }
 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();
 }
Ejemplo n.º 3
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);
  }
Ejemplo n.º 4
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();
    }
Ejemplo n.º 5
0
  private JPanel createRulesPanel() {
    JPanel panel = new JPanel();

    panel.addAncestorListener(new EventHandler());
    panel.setBorder(BorderFactory.createEtchedBorder());

    GroupLayout layout = new GroupLayout(panel);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    panel.setLayout(layout);

    GroupLayout.SequentialGroup leftToRight = layout.createSequentialGroup();

    GroupLayout.ParallelGroup left = layout.createParallelGroup();
    left.addComponent(numberOfRoundsLabel);
    left.addComponent(gunCoolingRateLabel);
    left.addComponent(inactivityTimeLabel);
    left.addComponent(sentryBorderSizeLabel);
    left.addComponent(hideEnemyNamesLabel);
    leftToRight.addGroup(left);

    GroupLayout.ParallelGroup right = layout.createParallelGroup();
    right.addComponent(getNumberOfRoundsTextField());
    right.addComponent(getGunCoolingRateTextField());
    right.addComponent(getInactivityTimeTextField());
    right.addComponent(getSentryBorderSizeTextField());
    right.addComponent(hideEnemyNamesCheckBox);
    leftToRight.addGroup(right);

    GroupLayout.SequentialGroup topToBottom = layout.createSequentialGroup();

    GroupLayout.ParallelGroup row0 = layout.createParallelGroup(Alignment.BASELINE);
    row0.addComponent(numberOfRoundsLabel);
    row0.addComponent(numberOfRoundsTextField);
    topToBottom.addGroup(row0);

    GroupLayout.ParallelGroup row1 = layout.createParallelGroup(Alignment.BASELINE);
    row1.addComponent(gunCoolingRateLabel);
    row1.addComponent(getGunCoolingRateTextField());
    topToBottom.addGroup(row1);

    GroupLayout.ParallelGroup row2 = layout.createParallelGroup(Alignment.BASELINE);
    row2.addComponent(inactivityTimeLabel);
    row2.addComponent(inactivityTimeTextField);
    topToBottom.addGroup(row2);

    GroupLayout.ParallelGroup row3 = layout.createParallelGroup(Alignment.BASELINE);
    row3.addComponent(sentryBorderSizeLabel);
    row3.addComponent(sentryBorderSizeTextField);
    topToBottom.addGroup(row3);

    GroupLayout.ParallelGroup row4 = layout.createParallelGroup(Alignment.CENTER);
    row4.addComponent(hideEnemyNamesLabel);
    row4.addComponent(hideEnemyNamesCheckBox);
    topToBottom.addGroup(row4);

    layout.setHorizontalGroup(leftToRight);
    layout.setVerticalGroup(topToBottom);

    return panel;
  }
Ejemplo n.º 6
0
  public FoodEditor(JFrame parent, RItem data) {
    super(parent, "Scroll Editor: " + data.id);
    this.data = data;

    JPanel itemProps = new JPanel();
    GroupLayout layout = new GroupLayout(itemProps);
    itemProps.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel nameLabel = new JLabel("Name: ");
    JLabel costLabel = new JLabel("Cost: ");
    JLabel colorLabel = new JLabel("Color: ");
    JLabel charLabel = new JLabel("Character: ");
    JLabel weightLabel = new JLabel("Weight: ");
    JLabel spellLabel = new JLabel("Spell: ");
    nameField = new JTextField(15);
    costField = new JFormattedTextField(NeonFormat.getIntegerInstance());
    colorBox = new JComboBox<String>(ColorFactory.getColorNames());
    colorBox.setBackground(Color.black);
    colorBox.setRenderer(new ColorCellRenderer());
    colorBox.addActionListener(new ColorListener(colorBox));
    charField = new JFormattedTextField(getMaskFormatter("*", 'X'));
    weightField = new JFormattedTextField(NeonFormat.getFloatInstance());
    spellBox = new JComboBox<String>(loadSpells());
    JLabel nameHelpLabel = HelpLabels.getNameHelpLabel();
    JLabel costHelpLabel = HelpLabels.getCostHelpLabel();
    JLabel colorHelpLabel = HelpLabels.getColorHelpLabel();
    JLabel charHelpLabel = HelpLabels.getCharHelpLabel();
    JLabel weightHelpLabel = HelpLabels.getWeightHelpLabel();
    JLabel foodHelpLabel = HelpLabels.getFoodEffectHelpLabel();
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(nameLabel)
                    .addComponent(nameField)
                    .addComponent(nameHelpLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(costLabel)
                    .addComponent(costField)
                    .addComponent(costHelpLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(colorLabel)
                    .addComponent(colorBox)
                    .addComponent(colorHelpLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(charLabel)
                    .addComponent(charField)
                    .addComponent(charHelpLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(weightLabel)
                    .addComponent(weightField)
                    .addComponent(weightHelpLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(spellLabel)
                    .addComponent(spellBox)
                    .addComponent(foodHelpLabel)));
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(nameLabel)
                    .addComponent(costLabel)
                    .addComponent(colorLabel)
                    .addComponent(charLabel)
                    .addComponent(weightLabel)
                    .addComponent(spellLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(
                        nameField,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addComponent(costField)
                    .addComponent(colorBox)
                    .addComponent(charField)
                    .addComponent(weightField)
                    .addComponent(spellBox))
            .addGap(10)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(nameHelpLabel)
                    .addComponent(costHelpLabel)
                    .addComponent(colorHelpLabel)
                    .addComponent(charHelpLabel)
                    .addComponent(weightHelpLabel)
                    .addComponent(foodHelpLabel)));

    JScrollPane propScroller = new JScrollPane(itemProps);
    propScroller.setBorder(new TitledBorder("Properties"));
    frame.add(propScroller, BorderLayout.CENTER);
  }
Ejemplo n.º 7
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>
Ejemplo n.º 8
0
  private void initComponents() {
    scrollPane1 = new JScrollPane();
    statusPane = new JTextPane();
    boxCommercial = new JCheckBox();
    boxReadSubs = new JCheckBox();
    accountNameField = new JTextField();
    label1 = new JLabel();
    authorizeButton = new JButton();
    separator1 = new JSeparator();
    boxEditStatus = new JCheckBox();
    boxFollowed = new JCheckBox();
    label2 = new JLabel();
    oauthField = new JPasswordField();
    closeButton = new JButton();
    setResizable(false);
    // ======== this ========
    setTitle("Authorize Accounts");
    setIconImage(new ImageIcon(getClass().getResource("/image/icon.png")).getImage());
    Container contentPane = getContentPane();

    // ======== scrollPane1 ========
    {

      // ---- statusPane ----
      statusPane.setEditable(false);
      statusPane.setText(
          isForBotAccount
              ? "Enter your bot account's username. On Twitch, log into your bot account. Then press \"Authorize\""
              : "Enter your username, tick the boxes you want Botnak to be able to do, and press \"Authorize\"");
      scrollPane1.setViewportView(statusPane);
    }

    // ---- boxCommercial ----
    boxCommercial.setText("Play Commercials (Partnered Channels Only)");
    boxCommercial.setFocusable(false);
    boxCommercial.setEnabled(!isForBotAccount);

    // ---- boxReadSubs ----
    boxReadSubs.setText("Read Subscribers (Partnered Channels Only)");
    boxReadSubs.setFocusable(false);
    boxReadSubs.setEnabled(!isForBotAccount);

    // ---- label1 ----
    label1.setText("Username:"******"Authorize");
    authorizeButton.addActionListener(this::authorizeButtonActionPerformed);
    authorizeButton.setFocusable(false);

    // ---- boxEditStatus ----
    boxEditStatus.setText("Edit Title and Game");
    boxEditStatus.setFocusable(false);
    boxEditStatus.setEnabled(!isForBotAccount);

    // ---- boxFollowed ----
    boxFollowed.setText("Read Followed Streams");
    boxFollowed.setFocusable(false);
    boxFollowed.setEnabled(!isForBotAccount);

    // ---- label2 ----
    label2.setText("OAuth key:");

    // ---- closeButton ----
    closeButton.setText("Close");
    closeButton.setFocusable(false);
    closeButton.addActionListener(this::doneButtonActionPerformed);

    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPane.setLayout(contentPaneLayout);
    contentPaneLayout.setHorizontalGroup(
        contentPaneLayout
            .createParallelGroup()
            .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
            .addComponent(separator1, GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
            .addGroup(
                contentPaneLayout
                    .createSequentialGroup()
                    .addGap(10, 10, 10)
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup()
                            .addGroup(
                                contentPaneLayout
                                    .createSequentialGroup()
                                    .addComponent(boxCommercial)
                                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(
                                contentPaneLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        accountNameField,
                                        GroupLayout.PREFERRED_SIZE,
                                        171,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        LayoutStyle.ComponentPlacement.RELATED,
                                        GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(authorizeButton)
                                    .addGap(35, 35, 35))
                            .addGroup(
                                contentPaneLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                        contentPaneLayout
                                            .createParallelGroup()
                                            .addGroup(
                                                contentPaneLayout
                                                    .createSequentialGroup()
                                                    .addComponent(boxEditStatus)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(
                                                        boxFollowed,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        140,
                                                        GroupLayout.PREFERRED_SIZE))
                                            .addComponent(boxReadSubs)
                                            .addComponent(label1))
                                    .addGap(0, 64, Short.MAX_VALUE))))
            .addGroup(
                contentPaneLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup()
                            .addGroup(
                                contentPaneLayout
                                    .createSequentialGroup()
                                    .addComponent(label2)
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(
                                contentPaneLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        oauthField,
                                        GroupLayout.PREFERRED_SIZE,
                                        239,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                                    .addComponent(closeButton)))
                    .addContainerGap()));
    contentPaneLayout.setVerticalGroup(
        contentPaneLayout
            .createParallelGroup()
            .addGroup(
                contentPaneLayout
                    .createSequentialGroup()
                    .addComponent(
                        scrollPane1, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(label1)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(authorizeButton)
                            .addComponent(
                                accountNameField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(11, 11, 11)
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(boxEditStatus)
                            .addComponent(boxFollowed))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(boxCommercial)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(boxReadSubs)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        separator1, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(label2)
                    .addGap(5, 5, 5)
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                oauthField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)
                            .addComponent(closeButton))
                    .addGap(0, 15, Short.MAX_VALUE)));
    pack();
    setLocationRelativeTo(getOwner());
  }
Ejemplo n.º 9
0
  public FindReplaceDialog(RobocodeEditor owner) {
    super(owner, false);
    editor = owner;

    GroupLayout layout = new GroupLayout(getContentPane());

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

    JPanel optionsPanel = new JPanel();

    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
    optionsPanel.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Options"));
    optionsPanel.add(getCaseSensitiveCheckBox());
    optionsPanel.add(getWholeWordCheckBox());
    optionsPanel.setAlignmentY(TOP_ALIGNMENT);

    JPanel usePanel = new JPanel();

    usePanel.setLayout(new BoxLayout(usePanel, BoxLayout.Y_AXIS));
    usePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Use"));
    usePanel.add(getLiteralButton());
    usePanel.add(getWildCardsButton());
    usePanel.add(getRegexButton());
    usePanel.setAlignmentY(TOP_ALIGNMENT);

    ButtonGroup buttonGroup = new ButtonGroup();

    buttonGroup.add(getLiteralButton());
    buttonGroup.add(getWildCardsButton());
    buttonGroup.add(getRegexButton());

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(LEADING)
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(getFindLabel())
                            .addComponent(getFindTextField()))
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(getReplaceLabel())
                            .addComponent(getReplaceTextField()))
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(optionsPanel)
                            .addComponent(usePanel)))
            .addGroup(
                layout
                    .createParallelGroup(LEADING)
                    .addComponent(getFindNextButton())
                    .addComponent(getReplaceFindButton())
                    .addComponent(getReplaceButton())
                    .addComponent(getReplaceAllButton())
                    .addComponent(getCloseButton())));

    layout.linkSize(SwingConstants.HORIZONTAL, getFindLabel(), getReplaceLabel());
    layout.linkSize(
        SwingConstants.HORIZONTAL,
        getFindNextButton(),
        getReplaceFindButton(),
        getReplaceButton(),
        getReplaceAllButton(),
        getCloseButton());

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(BASELINE)
                    .addComponent(getFindLabel())
                    .addComponent(getFindTextField())
                    .addComponent(getFindNextButton()))
            .addGroup(
                layout
                    .createParallelGroup(BASELINE)
                    .addComponent(getReplaceLabel())
                    .addComponent(getReplaceTextField())
                    .addComponent(getReplaceButton()))
            .addGroup(
                layout
                    .createParallelGroup(BASELINE)
                    .addComponent(optionsPanel)
                    .addComponent(usePanel)
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(getReplaceFindButton())
                            .addComponent(getReplaceAllButton())
                            .addComponent(getCloseButton()))));

    pack();
    setResizable(false);
  }
Ejemplo n.º 10
0
 private void initGUI() {
   /** 北部panel */
   Font font_12 = new Font("微软雅黑", Font.PLAIN, 14);
   /** 设置字体 */
   crackButton.setFont(font_12);
   northPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
   northPane.setBorder(BorderFactory.createTitledBorder("破解地址"));
   GroupLayout layout_north = new GroupLayout(northPane);
   northPane.setLayout(layout_north);
   /** 自动设定组件、组之间的间隙 */
   layout_north.setAutoCreateGaps(true);
   layout_north.setAutoCreateContainerGaps(true);
   /** 垂直一 */
   GroupLayout.ParallelGroup hpg_north_1 =
       layout_north.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg_north_1.addComponent(label_for_pageUrl);
   /** 垂直二 */
   GroupLayout.ParallelGroup hpg_north_2 =
       layout_north.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg_north_2.addComponent(pageUrl);
   /** 垂直三 */
   GroupLayout.ParallelGroup hpg_north_3 =
       layout_north.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg_north_3.addComponent(crackButton);
   /** 垂直 */
   layout_north.setHorizontalGroup(
       layout_north
           .createSequentialGroup()
           .addGroup(hpg_north_1)
           .addGroup(hpg_north_2)
           .addGroup(hpg_north_3));
   /** 水平一 */
   GroupLayout.ParallelGroup vpg_north_1 =
       layout_north.createParallelGroup(GroupLayout.Alignment.CENTER);
   vpg_north_1.addComponent(label_for_pageUrl).addComponent(pageUrl).addComponent(crackButton);
   /** 水平 */
   layout_north.setVerticalGroup(layout_north.createSequentialGroup().addGroup(vpg_north_1));
   this.add(northPane, BorderLayout.NORTH);
   /** 南部panel */
   mCode.setColumns(50);
   regCode.setColumns(50);
   mCode.setEditable(false);
   southPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
   southPane.setBorder(BorderFactory.createTitledBorder("软件注册"));
   southPane.add(label_for_mCode);
   southPane.add(mCode);
   southPane.add(label_for_regCode);
   southPane.add(regCode);
   /** 新增为布局的南部 */
   this.add(southPane, BorderLayout.SOUTH);
   /** 中部panel */
   videoInfo = new JPanel();
   videoInfo.setBorder(BorderFactory.createTitledBorder("视频信息"));
   GroupLayout layout = new GroupLayout(videoInfo);
   videoInfo.setLayout(layout);
   /** 自动设定组件、组之间的间隙 */
   layout.setAutoCreateGaps(true);
   layout.setAutoCreateContainerGaps(true);
   JButton cancelButton = new JButton("Cancel");
   /** LEADING -- 左对齐 BASELINE -- 底部对齐 CENTER -- 中心对齐 */
   /** 垂直一 */
   GroupLayout.ParallelGroup hpg1 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg1.addComponent(label_for_title)
       .addComponent(label_for_time)
       .addComponent(label_for_addTime)
       .addComponent(label_for_imgPre)
       .addComponent(label_for_crack_video)
       .addComponent(label_for_fileSize);
   /** 垂直二 */
   GroupLayout.ParallelGroup hpg2 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg2.addComponent(title)
       .addComponent(time)
       .addComponent(addTime)
       .addComponent(image)
       .addComponent(crackVideo)
       .addComponent(fileSize);
   /** 垂直三 */
   GroupLayout.ParallelGroup hpg3 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
   hpg3.addComponent(cancelButton);
   /** 垂直 */
   layout.setHorizontalGroup(
       layout.createSequentialGroup().addGroup(hpg1).addGroup(hpg2).addGroup(hpg3));
   /** 设定两个Button在水平方向一样宽 */
   //        layout.linkSize(SwingConstants.HORIZONTAL, new Component[]{crackButton,
   // cancelButton});
   /** 水平一 */
   GroupLayout.ParallelGroup vpg1 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   //        vpg1.addComponent(crackButton);
   /** 水平二 */
   GroupLayout.ParallelGroup vpg2 = layout.createParallelGroup(GroupLayout.Alignment.CENTER);
   vpg2.addComponent(label_for_title).addComponent(title).addComponent(cancelButton);
   /** 水平三 */
   GroupLayout.ParallelGroup vpg3 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg3.addComponent(label_for_time).addComponent(time);
   /** 水平四 */
   GroupLayout.ParallelGroup vpg4 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg4.addComponent(label_for_addTime).addComponent(addTime);
   /** 水平五 */
   GroupLayout.ParallelGroup vpg5 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg5.addComponent(label_for_imgPre).addComponent(image);
   /** 水平六 */
   GroupLayout.ParallelGroup vpg6 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg6.addComponent(label_for_crack_video).addComponent(crackVideo);
   /** 水平七 */
   GroupLayout.ParallelGroup vpg7 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
   vpg7.addComponent(label_for_fileSize).addComponent(fileSize);
   /** 水平 */
   layout.setVerticalGroup(
       layout
           .createSequentialGroup()
           .addGroup(vpg1)
           .addGroup(vpg2)
           .addGroup(vpg3)
           .addGroup(vpg4)
           .addGroup(vpg5)
           .addGroup(vpg6)
           .addGroup(vpg7));
   this.add(videoInfo, BorderLayout.CENTER);
 }
Ejemplo n.º 11
0
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Nick K
    JLabel label1 = new JLabel();
    JScrollPane scrollPane1 = new JScrollPane();
    titleText = new JTextArea();
    titleText.setLineWrap(true);
    titleText.setWrapStyleWord(true);
    titleText.setFont(new Font("Tahoma", Font.PLAIN, 11));
    gameText = new JTextField();
    JLabel label2 = new JLabel();
    playingGameToggle = new JCheckBox();
    playingGameToggle.setFocusable(false);
    saveButton = new JButton();
    saveButton.setFocusable(false);
    closeButton = new JButton();
    closeButton.setFocusable(false);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    // ======== this ========
    setTitle("Change Stream Status");
    setIconImage(new ImageIcon(getClass().getResource("/image/icon.png")).getImage());
    setResizable(false);
    Container contentPane = getContentPane();

    // ---- label1 ----
    label1.setText("Title");

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

    // ---- label2 ----
    label2.setText("Game");

    // ---- playingGameToggle ----
    playingGameToggle.setText("Not Playing a Game");
    playingGameToggle.addChangeListener(e -> playingGameToggleStateChanged());

    // ---- saveButton ----
    saveButton.setText("Update");
    saveButton.addActionListener(e -> saveButtonActionPerformed());

    // ---- closeButton ----
    closeButton.setText("Close");
    closeButton.addActionListener(e -> closeButtonActionPerformed());

    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPane.setLayout(contentPaneLayout);
    contentPaneLayout.setHorizontalGroup(
        contentPaneLayout
            .createParallelGroup()
            .addGroup(
                contentPaneLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup()
                            .addComponent(playingGameToggle)
                            .addGroup(
                                contentPaneLayout
                                    .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                                    .addComponent(label1)
                                    .addComponent(label2)
                                    .addComponent(
                                        scrollPane1, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
                                    .addComponent(
                                        gameText, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)))
                    .addContainerGap(25, Short.MAX_VALUE))
            .addGroup(
                GroupLayout.Alignment.TRAILING,
                contentPaneLayout
                    .createSequentialGroup()
                    .addContainerGap(140, Short.MAX_VALUE)
                    .addComponent(saveButton)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(closeButton)
                    .addGap(18, 18, 18)));
    contentPaneLayout.setVerticalGroup(
        contentPaneLayout
            .createParallelGroup()
            .addGroup(
                contentPaneLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(label1)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        scrollPane1, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(label2)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        gameText,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(playingGameToggle)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                    .addGroup(
                        contentPaneLayout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(saveButton)
                            .addComponent(closeButton))
                    .addContainerGap()));
    pack();
    setLocationRelativeTo(getOwner());
    updateStatusComponents();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 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
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 15
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
  }
Ejemplo n.º 16
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
  }
Ejemplo n.º 17
0
  protected JComponent createSouthPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));

    JPanel buttonPanel = new JPanel();

    if (SystemInfo.isMac) {
      panel.add(buttonPanel, BorderLayout.EAST);
      buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));

      if (!UIUtil.isUnderDarcula()) {
        myHelpButton.putClientProperty("JButton.buttonType", "help");
      }
      if (UIUtil.isUnderAquaLookAndFeel()) {
        myHelpButton.setText("");
      }

      JPanel leftPanel = new JPanel();
      if (ApplicationInfo.contextHelpAvailable()) {
        leftPanel.add(myHelpButton);
      }
      leftPanel.add(myCancelButton);
      panel.add(leftPanel, BorderLayout.WEST);

      if (mySteps.size() > 1) {
        buttonPanel.add(Box.createHorizontalStrut(5));
        buttonPanel.add(myPreviousButton);
      }
      buttonPanel.add(Box.createHorizontalStrut(5));
      buttonPanel.add(myNextButton);
    } else {
      panel.add(buttonPanel, BorderLayout.CENTER);
      GroupLayout layout = new GroupLayout(buttonPanel);
      buttonPanel.setLayout(layout);
      layout.setAutoCreateGaps(true);

      final GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
      final GroupLayout.ParallelGroup vGroup = layout.createParallelGroup();
      final Collection<Component> buttons = ContainerUtil.newArrayListWithExpectedSize(5);
      final boolean helpAvailable = ApplicationInfo.contextHelpAvailable();

      if (helpAvailable && UIUtil.isUnderGTKLookAndFeel()) {
        add(hGroup, vGroup, buttons, myHelpButton);
      }
      add(hGroup, vGroup, null, Box.createHorizontalGlue());
      if (mySteps.size() > 1) {
        add(hGroup, vGroup, buttons, myPreviousButton);
      }
      add(hGroup, vGroup, buttons, myNextButton, myCancelButton);
      if (helpAvailable && !UIUtil.isUnderGTKLookAndFeel()) {
        add(hGroup, vGroup, buttons, myHelpButton);
      }

      layout.setHorizontalGroup(hGroup);
      layout.setVerticalGroup(vGroup);
      layout.linkSize(buttons.toArray(new Component[buttons.size()]));
    }

    myPreviousButton.setEnabled(false);
    myPreviousButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            doPreviousAction();
          }
        });
    myNextButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            if (isLastStep()) {
              // Commit data of current step and perform OK action
              final Step currentStep = mySteps.get(myCurrentStep);
              LOG.assertTrue(currentStep != null);
              try {
                currentStep._commit(true);
                doOKAction();
              } catch (final CommitStepException exc) {
                String message = exc.getMessage();
                if (message != null) {
                  Messages.showErrorDialog(myContentPanel, message);
                }
              }
            } else {
              doNextAction();
            }
          }
        });

    myCancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            doCancelAction();
          }
        });
    myHelpButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            helpAction();
          }
        });

    return panel;
  }
  @Override
  public boolean onStart() {
    window = new JFrame("Interface Explorer");
    treeModel = new InterfaceTreeModel();
    treeModel.update("");
    tree = new JTree(treeModel);
    tree.setRootVisible(false);
    tree.setEditable(false);
    renderer = new HighlightTreeCellRenderer(tree.getCellRenderer());
    tree.setCellRenderer(renderer);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.addTreeSelectionListener(
        new TreeSelectionListener() {
          private void addInfo(final String key, final String value, final boolean highlight) {
            final JPanel row = new JPanel();
            row.setAlignmentX(Component.LEFT_ALIGNMENT);
            row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
            for (final String data : new String[] {key, value}) {
              final JLabel label = new JLabel(data);
              label.setAlignmentY(Component.TOP_ALIGNMENT);
              if (highlight) {
                label.setForeground(Color.magenta);
              }
              row.add(label);
            }
            infoArea.add(row);
          }

          public void valueChanged(final TreeSelectionEvent e) {
            final Object node = tree.getLastSelectedPathComponent();
            if (node == null || node instanceof RSInterfaceWrap) {
              return;
            }
            infoArea.removeAll();
            RSComponent iface = null;
            if (node instanceof RSComponentWrap) {
              iface = ((RSComponentWrap) node).wrapped;
            }
            if (iface == null) {
              return;
            }
            List<Integer> changes = new ArrayList<Integer>();
            for (int i = 0; i < HighLightWraps.size(); i++) {
              if (iface.getParent() == null) {
                if (HighLightWraps.get(i).getChild().getIndex() == iface.getIndex()
                    && HighLightWraps.get(i).getParent().getIndex()
                        == iface.getInterface().getIndex()) {
                  changes.add(HighLightWraps.get(i).getChange());
                }
              } else {
                if (HighLightWraps.get(i).getChild().getIndex() == iface.getParent().getIndex()
                    && HighLightWraps.get(i).getParent().getIndex()
                        == iface.getParent().getInterface().getIndex()) {
                  changes.add(HighLightWraps.get(i).getChange());
                }
              }
            }
            addInfo("Type: ", "" + iface.getType(), changes.contains(1));
            addInfo("SpecialType: ", "" + iface.getSpecialType(), changes.contains(2));
            addInfo("Bounds Index: ", "" + iface.getBoundsArrayIndex(), changes.contains(3));
            if (iface.getArea() != null) {
              Rectangle size = iface.getArea();
              addInfo("Size: ", size.width + "," + size.height, changes.contains(15));
            }
            addInfo("Model ID: ", "" + iface.getModelID(), changes.contains(4));
            addInfo("Texture ID: ", "" + iface.getBackgroundColor(), changes.contains(5));
            addInfo("Parent ID: ", "" + iface.getParentID(), changes.contains(6));
            addInfo("Text: ", "" + iface.getText(), changes.contains(7));
            addInfo("Tooltip: ", "" + iface.getTooltip(), changes.contains(8));
            addInfo("SelActionName: ", "" + iface.getSelectedActionName(), changes.contains(9));
            if (iface.getActions() != null) {
              String actions = "";
              for (final String action : iface.getActions()) {
                if (!actions.equals("")) {
                  actions += "\n";
                }
                actions += action;
              }
              addInfo("Actions: ", actions, changes.contains(10));
            }
            addInfo("Component ID: ", "" + iface.getComponentID(), changes.contains(11));
            addInfo(
                "Component Stack Size: ", "" + iface.getComponentStackSize(), changes.contains(12));
            addInfo(
                "Relative Location: ",
                "(" + iface.getRelativeX() + "," + iface.getRelativeY() + ")",
                changes.contains(13));
            addInfo(
                "Absolute Location: ",
                "(" + iface.getAbsoluteX() + "," + iface.getAbsoluteY() + ")",
                changes.contains(14));
            addInfo(
                "Rotation: ",
                "x: "
                    + iface.getXRotation()
                    + "  y: "
                    + iface.getYRotation()
                    + "  z: "
                    + iface.getZRotation(),
                changes.contains(16));
            setHighlightArea(iface.getArea());
            infoArea.validate();
            infoArea.repaint();
          }
        });
    final JDialog Help = new JDialog();
    JScrollPane jScrollPane1;
    JTextArea jTextArea1;
    jScrollPane1 = new JScrollPane();
    jTextArea1 = new JTextArea();
    Help.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Help.setTitle("Help");
    Help.setResizable(false);
    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setFont(new java.awt.Font("MS UI Gothic", 0, 12));
    jTextArea1.setLineWrap(true);
    jTextArea1.setRows(5);
    jTextArea1.setText(
        "Once toggled the listener feature of the interface explorer will detect any changes made to Runescapes interfaces in realtime. If a change is found that interface and data will then be highlighted within the explorers tree model. To use the listener feature you would :\n\n1) Toggle the listener button as active\n2) Wait or commit changes in Runescape\n3) Repaint tree using repaint button or reclick interface folders in GUI\n\n\nTips : While listening for changes the tree model in the GUI will not update itself, changing colors. To refresh the GUI either use the repaint button or close and open Interface folder already within the tree model.");
    jTextArea1.setWrapStyleWord(true);
    jScrollPane1.setViewportView(jTextArea1);
    final GroupLayout layout = new GroupLayout(Help.getContentPane());
    Help.getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jScrollPane1, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    Help.pack();
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(250, 500));
    window.add(scrollPane, BorderLayout.WEST);
    infoArea = new JPanel();
    infoArea.setLayout(new BoxLayout(infoArea, BoxLayout.Y_AXIS));
    scrollPane = new JScrollPane(infoArea);
    scrollPane.setPreferredSize(new Dimension(250, 500));
    window.add(scrollPane, BorderLayout.CENTER);
    final ActionListener actionListener =
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            treeModel.update(searchBox.getText());
            infoArea.removeAll();
            infoArea.validate();
            infoArea.repaint();
          }
        };
    final ActionListener toggleListener =
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            if (listenerButton.isSelected()) {
              log("Cleared");
              HighLightWraps.clear();
            }
            check();
          }
        };
    final ActionListener repaintListener =
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            log("Refreshed Tree");
            treeModel.fireTreeStructureChanged(treeModel.getRoot());
            infoArea.removeAll();
            infoArea.validate();
            infoArea.repaint();
          }
        };
    final ActionListener helpListener =
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            Help.setVisible(true);
          }
        };
    final JPanel toolArea = new JPanel();
    toolArea.setLayout(new FlowLayout(FlowLayout.LEFT));
    toolArea.add(new JLabel("Filter:"));
    searchBox = new JTextField(20);
    searchBox.addActionListener(actionListener);
    toolArea.add(searchBox);
    final JButton updateButton = new JButton("Update");
    final JButton repaintButton = new JButton("Repaint");
    final JButton helpButton = new JButton("Help");
    helpButton.addActionListener(helpListener);
    listenerButton.addActionListener(toggleListener);
    updateButton.addActionListener(actionListener);
    repaintButton.addActionListener(repaintListener);
    toolArea.add(updateButton);
    toolArea.add(listenerButton);
    toolArea.add(repaintButton);
    toolArea.add(helpButton);
    window.add(toolArea, BorderLayout.NORTH);
    window.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    window.pack();
    window.setVisible(true);
    return true;
  }
Ejemplo n.º 19
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();
  }
  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);
  }
Ejemplo n.º 21
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();
    }
Ejemplo n.º 22
0
  /** 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));
  }
Ejemplo n.º 23
0
    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();
    }
Ejemplo n.º 24
0
  /**
   * Private method used to initialize everything in the dialog box This method was generated by
   * Forte, which was used to create the initial layout of the dialog box
   */
  @SuppressWarnings({"rawtypes", "unchecked"})
  private void initComponents() {
    buttonGroup1 = new ButtonGroup();
    jPanel1 = new JPanel();
    jPanel1.setPreferredSize(new Dimension(350, 270));
    jButtonAdd = new JButton();
    jButtonCancel = new JButton();
    jLabel1 = new JLabel();
    jLabel2 = new JLabel();
    jLabel4 = new JLabel();
    jLabel8 = new JLabel();
    jButtonClear = new JButton();
    jTextFieldName = new JTextField();
    jTextFieldName.setToolTipText("Enter full name here");
    jTextFieldPhone = new JTextField();
    jTextFieldPhone.setToolTipText("xxx-xxx-xxxx");
    jTextFieldNotes = new JTextField();
    jComboBoxStartHours = new JComboBox();
    jSeparator1 = new JSeparator();
    jRadioButtonAM = new JRadioButton();
    jRadioButtonPM = new JRadioButton();
    jComboBoxStartMinutes = new JComboBox();
    jLabel11 = new JLabel();

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    jButtonAdd.setText("Add");
    jButtonAdd.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            jButtonAddMouseClicked(evt);
          }
        });

    jButtonCancel.setText("Cancel");
    jButtonCancel.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            jButtonCancelMouseClicked(evt);
          }
        });

    jLabel1.setText("Name");

    jLabel2.setText("Phone Number");

    jLabel4.setText("Appointment Time");

    jLabel8.setText("Notes");

    jButtonClear.setText("Clear");
    jButtonClear.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            jButtonClearMouseClicked(evt);
          }
        });

    jComboBoxStartHours.setModel(
        new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "9", "10", "11", "12"}));

    jRadioButtonAM.setText("AM");
    buttonGroup1.add(jRadioButtonAM);

    jRadioButtonPM.setText("PM");
    buttonGroup1.add(jRadioButtonPM);
    jRadioButtonPM.setSelected(true);

    jComboBoxStartMinutes.setModel(new DefaultComboBoxModel(new String[] {"00"}));

    jLabel11.setText("Duration: 1 hour");

    getContentPane().add(jPanel1, BorderLayout.CENTER);

    JLabel lblXxxxxxxxxx = new JLabel("xxx-xxx-xxxx");
    GroupLayout gl_jPanel1 = new GroupLayout(jPanel1);
    gl_jPanel1.setHorizontalGroup(
        gl_jPanel1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_jPanel1
                    .createSequentialGroup()
                    .addGroup(
                        gl_jPanel1
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_jPanel1
                                    .createSequentialGroup()
                                    .addGap(10)
                                    .addGroup(
                                        gl_jPanel1
                                            .createParallelGroup(Alignment.LEADING, false)
                                            .addGroup(
                                                gl_jPanel1
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        jLabel1,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        80,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(40)
                                                    .addComponent(
                                                        jTextFieldName,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        198,
                                                        GroupLayout.PREFERRED_SIZE))
                                            .addGroup(
                                                gl_jPanel1
                                                    .createSequentialGroup()
                                                    .addComponent(jLabel2)
                                                    .addGap(50)
                                                    .addGroup(
                                                        gl_jPanel1
                                                            .createParallelGroup(Alignment.LEADING)
                                                            .addComponent(lblXxxxxxxxxx)
                                                            .addComponent(jTextFieldPhone)))))
                            .addGroup(
                                gl_jPanel1
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addGroup(
                                        gl_jPanel1
                                            .createParallelGroup(Alignment.LEADING, false)
                                            .addGroup(
                                                gl_jPanel1
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        jButtonAdd,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        90,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18)
                                                    .addComponent(
                                                        jButtonClear,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        94,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18)
                                                    .addComponent(
                                                        jButtonCancel,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE))
                                            .addComponent(
                                                jSeparator1,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addGroup(
                                                gl_jPanel1
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        jLabel8,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        90,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(30)
                                                    .addComponent(
                                                        jTextFieldNotes,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        196,
                                                        GroupLayout.PREFERRED_SIZE))))
                            .addGroup(
                                gl_jPanel1
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addGroup(
                                        gl_jPanel1
                                            .createParallelGroup(Alignment.TRAILING, false)
                                            .addComponent(
                                                jLabel11,
                                                Alignment.LEADING,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                jLabel4,
                                                Alignment.LEADING,
                                                GroupLayout.DEFAULT_SIZE,
                                                102,
                                                Short.MAX_VALUE))
                                    .addGap(18)
                                    .addComponent(
                                        jComboBoxStartHours,
                                        GroupLayout.PREFERRED_SIZE,
                                        50,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addComponent(
                                        jComboBoxStartMinutes,
                                        GroupLayout.PREFERRED_SIZE,
                                        50,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(10)
                                    .addComponent(
                                        jRadioButtonAM,
                                        GroupLayout.PREFERRED_SIZE,
                                        40,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addComponent(
                                        jRadioButtonPM,
                                        GroupLayout.PREFERRED_SIZE,
                                        40,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(22, Short.MAX_VALUE)));
    gl_jPanel1.setVerticalGroup(
        gl_jPanel1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_jPanel1
                    .createSequentialGroup()
                    .addGap(20)
                    .addGroup(
                        gl_jPanel1
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(
                                jTextFieldName,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(
                        gl_jPanel1
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(
                                jTextFieldPhone,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblXxxxxxxxxx)
                    .addGap(11)
                    .addGroup(
                        gl_jPanel1
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(
                                jComboBoxStartHours,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jComboBoxStartMinutes,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jRadioButtonAM,
                                GroupLayout.PREFERRED_SIZE,
                                20,
                                GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jRadioButtonPM,
                                GroupLayout.PREFERRED_SIZE,
                                20,
                                GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(jLabel11)
                    .addGap(16)
                    .addComponent(
                        jSeparator1, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(
                        gl_jPanel1
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(
                                jTextFieldNotes,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(
                        gl_jPanel1
                            .createParallelGroup(Alignment.BASELINE)
                            .addComponent(jButtonAdd)
                            .addComponent(jButtonCancel)
                            .addComponent(jButtonClear))
                    .addGap(265)));
    gl_jPanel1.setAutoCreateGaps(true);
    jPanel1.setLayout(gl_jPanel1);

    pack();
  }
Ejemplo n.º 25
0
    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();
    }