private void initComponents(Object[][] data) {
    String[] columnList = JTableUtils.getLogFileColumnHeaders();
    logFileTable = new ConfigurationTable(data, columnList, JTableUtils.getLogFileColumnTypes());
    logFileTable.setColumnSelectionAllowed(true);
    logFileTable.getTableHeader().setReorderingAllowed(false);
    logFileTable.setRowSelectionAllowed(true);
    logFileTable.setColumnSelectionAllowed(false);
    logFileTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    logFileTable
        .getSelectionModel()
        .addListSelectionListener(new RowSelectionListener(logFileTable));
    logFileTableScroller = new JScrollPane();
    logFileTableScroller.setViewportView(logFileTable);

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(logFileTableScroller, GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(logFileTableScroller, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));
  }
Example #2
0
  private void initHexboard(int size) {

    hexboard = new Hexboard(size, this);

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

    GroupLayout layout = new GroupLayout(jPanel1);
    jPanel1.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                hexboard, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                hexboard, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
  }
  private 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;
  }
Example #4
0
  /**
   * Default constructor
   *
   * @param playerName The player name
   * @param isReplay If true, this is a replay
   */
  public PlayerInfoView(Player player, boolean isReplay) {
    _player = player;

    this.setPreferredSize(new Dimension(COMPONENT_WIDTH, COMPONENT_HEIGHT));
    _isBlack = player.getColor();
    _playerNameLabel = new JLabel(player.getPlayer().getPseudo());
    _timerLabel = new JLabel(normalizeTime(player.getTimer()));
    JLayeredPane layeredPane = new JLayeredPane();

    // Background
    JLabel background =
        new JLabel(
            new ImageIcon(LobbyConstant.chargeFichier("fr/utc/ressources/player_info_bg.png")));
    background.setBounds(0, 0, COMPONENT_WIDTH, COMPONENT_HEIGHT);

    // Player label
    _playerNameLabel.setFont(new Font("Georgia", Font.BOLD, 33));
    _playerNameLabel.setForeground(_isBlack ? Color.black : Color.white);
    _playerNameLabel.setHorizontalAlignment(JLabel.CENTER);

    // 0 = no timer
    if (player.getTimer() == -1 || isReplay) {
      _playerNameLabel.setVerticalAlignment(JLabel.CENTER);
      _playerNameLabel.setBounds(15, 0, COMPONENT_WIDTH - 30, COMPONENT_HEIGHT);
    } else {
      _playerNameLabel.setVerticalAlignment(JLabel.TOP);
      _playerNameLabel.setBounds(15, 35, COMPONENT_WIDTH - 30, COMPONENT_HEIGHT);
      _timerLabel.setVerticalAlignment(JLabel.TOP);
      _timerLabel.setHorizontalAlignment(JLabel.CENTER);
      _timerLabel.setFont(new Font("Georgia", Font.BOLD, 28));
      _timerLabel.setForeground(new Color(137, 78, 33));
      _timerLabel.setBounds(0, 80, COMPONENT_WIDTH, COMPONENT_HEIGHT);
      layeredPane.add(_timerLabel, JLayeredPane.DEFAULT_LAYER);
      this.initTimer();
    }

    layeredPane.add(_playerNameLabel, JLayeredPane.DEFAULT_LAYER);
    layeredPane.add(background, JLayeredPane.DEFAULT_LAYER);
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(layeredPane, GroupLayout.DEFAULT_SIZE, COMPONENT_WIDTH, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(
                layeredPane, GroupLayout.DEFAULT_SIZE, COMPONENT_HEIGHT, Short.MAX_VALUE));
  }
  @Override
  protected JPanel createFormPanel() {
    JPanel mainPanel = new JPanel();
    JScrollPane scroll = new JScrollPane();
    JTextArea textArea = new JTextArea();

    textArea.setColumns(20);
    textArea.setRows(5);
    scroll.setViewportView(textArea);

    textArea.setText(HELP_TXT);
    textArea.setEditable(false);

    GroupLayout layout = new GroupLayout(mainPanel);
    mainPanel.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
                    .addContainerGap()));
    return mainPanel;
  }
 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();
 }
Example #7
0
  public MainFrame() {
    super("P2 Auto Update and Automatic Build Test");

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      System.out.println("Error loading System Look and Feel: " + e.getMessage());
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } catch (Exception ex) {
        System.out.println("Error loading CrossPlatform Look and Feel: " + e.getMessage());
      }
    }

    LabelOne one = new LabelOne();
    LabelTwo two = new LabelTwo();
    LabelThree three = new LabelThree();
    LabelFour four = new LabelFour();

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

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

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(one)
            .addComponent(two)
            .addComponent(three)
            .addComponent(four));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(one)
            .addComponent(two)
            .addComponent(three)
            .addComponent(four));

    this.addWindowListener(this);

    this.add(mainPanel);
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    this.pack();
    this.setVisible(true);
  }
Example #8
0
  /**
   * Universally creates layout for dialog.
   *
   * @param jcs
   */
  protected final void createLayout(JComponent... jcs) {
    Container pane = getContentPane();
    GroupLayout gl = new GroupLayout(pane);
    pane.setLayout(gl);

    gl.setAutoCreateContainerGaps(true);
    gl.setAutoCreateGaps(true);

    GroupLayout.ParallelGroup pg = gl.createParallelGroup(CENTER);

    for (JComponent jc : jcs) {
      pg.addComponent(jc).addGap(200);
    }
    gl.setHorizontalGroup(pg);

    GroupLayout.SequentialGroup sg = gl.createSequentialGroup();

    for (JComponent jc : jcs) {
      sg.addGap(30).addComponent(jc).addGap(20);
    }
    gl.setVerticalGroup(sg);

    pack();
  }
  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;
  }
Example #10
0
  private void initComponents() {

    filtergroup = new ButtonGroup();
    TabbedPane = new JTabbedPane();
    filterViolationPanel = new JPanel();
    ruletypepanel = new JScrollPane();
    ruletypeTable = new JTable();
    violationtypePanel = new JScrollPane();
    violationtypeTable = new JTable();
    pathFilterPanel = new JPanel();
    pathFilterScrollPane = new JScrollPane();
    pathFilterTable = new JTable();
    addPath = new JButton();
    removePath = new JButton();
    save = new JButton();
    cancel = new JButton();
    showFilteredValues = new JRadioButton();
    hideFilteredValues = new JRadioButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(ResourceBundles.getValue("TotalViolations"));
    setAlwaysOnTop(true);
    setResizable(false);

    ruletypeTable.setAutoCreateRowSorter(true);
    ruletypeTable.setModel(ruletypeModelFilter);
    ruletypeTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
    ruletypeTable.setFillsViewportHeight(true);
    ruletypeTable.getTableHeader().setResizingAllowed(false);
    ruletypeTable.getTableHeader().setReorderingAllowed(false);
    ruletypepanel.setViewportView(ruletypeTable);

    violationtypeTable.setModel(violationtypeModelFilter);
    violationtypeTable.setFillsViewportHeight(true);
    violationtypeTable.getTableHeader().setReorderingAllowed(false);
    violationtypePanel.setViewportView(violationtypeTable);

    GroupLayout filterViolationPanelLayout = new GroupLayout(filterViolationPanel);
    filterViolationPanel.setLayout(filterViolationPanelLayout);
    filterViolationPanelLayout.setHorizontalGroup(
        filterViolationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                filterViolationPanelLayout
                    .createSequentialGroup()
                    .addComponent(
                        ruletypepanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        215,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        violationtypePanel,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        289,
                        Short.MAX_VALUE)));
    filterViolationPanelLayout.setVerticalGroup(
        filterViolationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ruletypepanel, javax.swing.GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE)
            .addComponent(violationtypePanel));

    TabbedPane.addTab(ResourceBundles.getValue("FilterViolations"), filterViolationPanel);

    pathFilterTable.setModel(pathFilterModel);
    pathFilterTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
    pathFilterTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    pathFilterScrollPane.setViewportView(pathFilterTable);

    addPath.setText(ResourceBundles.getValue("Add"));
    addPath.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            addPathActionPerformed();
          }
        });

    removePath.setText(ResourceBundles.getValue("Remove"));
    removePath.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            removePathActionPerformed();
          }
        });

    GroupLayout pathFilterPanelLayout = new GroupLayout(pathFilterPanel);
    pathFilterPanel.setLayout(pathFilterPanelLayout);
    pathFilterPanelLayout.setHorizontalGroup(
        pathFilterPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                pathFilterPanelLayout
                    .createSequentialGroup()
                    .addComponent(
                        pathFilterScrollPane,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        423,
                        Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        pathFilterPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(
                                removePath,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addPath,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                71,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    pathFilterPanelLayout.setVerticalGroup(
        pathFilterPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                pathFilterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                pathFilterPanelLayout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(addPath)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(removePath)
                    .addContainerGap()));

    TabbedPane.addTab(ResourceBundles.getValue("FilterPaths"), pathFilterPanel);

    save.setText(ResourceBundles.getValue("Save"));
    save.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            saveActionPerformed();
          }
        });

    cancel.setText(ResourceBundles.getValue("Cancel"));
    cancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            cancelActionPerformed();
          }
        });

    filtergroup.add(showFilteredValues);
    showFilteredValues.setText(ResourceBundles.getValue("ShowSelectedValues"));

    filtergroup.add(hideFilteredValues);
    hideFilteredValues.setSelected(true);
    hideFilteredValues.setText(ResourceBundles.getValue("HideSelectedValues"));

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(TabbedPane)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(hideFilteredValues)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(showFilteredValues)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addComponent(save)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(cancel)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(TabbedPane)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(save)
                                    .addComponent(cancel))
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(hideFilteredValues)
                                    .addComponent(showFilteredValues)))));

    pack();
  } // </editor-fold>
  /** Class constructor - make the JFrame ready */
  public TestProgram() {
    // Set screen size
    Toolkit tk = Toolkit.getDefaultToolkit();
    int x = (int) tk.getScreenSize().getWidth() - 150;
    int y = (int) tk.getScreenSize().getHeight() - 100;
    this.setSize(x, y);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    int width = menupanel.getPreferredSize().width;

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

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

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

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

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

    menupanel.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.BLACK),
            "Menu",
            TitledBorder.CENTER,
            TitledBorder.DEFAULT_POSITION,
            f));
  }
Example #12
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();
    }
  private void makeAndSetTabComponents() {
    final String[] tabTitles = {"Libraries", "Modes", "Tools", "Examples", "Updates"};
    tabLabels = new JLabel[4];

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

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

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

    numberLabel.setVisible(false);
  }
Example #14
0
  protected void setLayout(final Editor editor, boolean activateErrorPanel, boolean isLoading) {
    if (progressBar == null) {
      progressBar = new JProgressBar();
      progressBar.setVisible(false);

      createComponents();
      buildErrorPanel();

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

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

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

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

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

    setBackground(Color.WHITE);
    setBorder(null);
  }
Example #15
0
    public FilterField() {
      super("");

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

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

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

      filters = new ArrayList<String>();

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

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

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

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

                public void changedUpdate(DocumentEvent e) {
                  applyFilter();
                }
              });
    }
Example #16
0
  private void launch() {
    JRoundButton view;
    JRoundButton edit;
    JRoundButton print;
    JRoundButton mail;
    JLabel jLabel1;
    jLabel1 = new JLabel();
    view = new JRoundButton(null, new ImageIcon("Bin\\img\\view.png"));
    mail = new JRoundButton(null, new ImageIcon("Bin\\img\\mail.png"));
    print = new JRoundButton(null, new ImageIcon("Bin\\img\\viewcomp.png"));
    edit = new JRoundButton(null, new ImageIcon("Bin\\img\\edit.png"));

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("Choose Options");
    setResizable(false);
    setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
    jLabel1.setIcon(new ImageIcon("Bin\\img\\1960_Air_India.jpg"));
    edit.setToolTipText("Edit Account");
    mail.setToolTipText("Mail Pay Slip");
    view.setToolTipText("View Pay Slip without PLI");
    print.setActionCommand("Merge");
    edit.setActionCommand("Edit");
    mail.setActionCommand("Mail");
    view.setActionCommand("View");
    print.setToolTipText("View Pay Slip with PLI");
    print.addActionListener(this);
    edit.addActionListener(this);
    mail.addActionListener(this);
    view.addActionListener(this);
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(43, 43, 43) // 59,59,59
                                    .addComponent(jLabel1))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(24, 24, 24)
                                    .addComponent(print)
                                    .addGap(36, 36, 36)
                                    .addComponent(view)
                                    .addGap(35, 35, 35)
                                    .addComponent(mail)
                                    .addGap(29, 29, 29)
                                    .addComponent(edit)))
                    .addContainerGap(35, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(41, 41, 41)
                    .addComponent(jLabel1)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(print)
                            .addComponent(view)
                            .addComponent(mail)
                            .addComponent(edit))
                    .addContainerGap()));
    setLocation(h / 2, w / 14);
    pack();
  }
Example #17
0
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    startPane = new JTabbedPane();
    arrivalListPanel = new JPanel();
    scrollPane2 = new JScrollPane();
    arrivalTable = new JTable();
    selectArrival = new JButton();
    searchListPanel = new JPanel();
    label5 = new JLabel();
    deliveryID = new JTextField();
    entruck = new JRadioButton();
    transfer = new JRadioButton();
    searchList = new JButton();
    arrivalVO = new JTabbedPane();
    panel1 = new JPanel();
    scrollPane1 = new JScrollPane();
    arrivalVOTable = new JTable();
    label1 = new JLabel();
    transferID = new JTextField();
    label2 = new JLabel();
    from = new JTextField();
    label3 = new JLabel();
    arrivalDate = new JTextField();
    status = new JComboBox();
    modifyStatus = new JButton();
    cancelArrival = new JButton();
    doArrive = new JButton();
    label4 = new JLabel();
    saveArrival = new JButton();
    entruckVO = new JTabbedPane();
    DeliveryListPanel = new JPanel();
    scrollPane3 = new JScrollPane();
    deliveryTable = new JTable();
    cancelLoad = new JButton();
    createArrival2 = new JButton();
    resultDialog = new JDialog();
    label6 = new JLabel();
    resultSureButton = new JButton();
    errorDialog = new JDialog();
    label7 = new JLabel();
    errorSure = new JButton();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      GroupLayout errorDialogContentPaneLayout = new GroupLayout(errorDialogContentPane);
      errorDialogContentPane.setLayout(errorDialogContentPaneLayout);
      errorDialogContentPaneLayout.setHorizontalGroup(
          errorDialogContentPaneLayout
              .createParallelGroup()
              .addGroup(
                  errorDialogContentPaneLayout
                      .createSequentialGroup()
                      .addContainerGap(95, Short.MAX_VALUE)
                      .addGroup(
                          errorDialogContentPaneLayout
                              .createParallelGroup()
                              .addGroup(
                                  GroupLayout.Alignment.TRAILING,
                                  errorDialogContentPaneLayout
                                      .createSequentialGroup()
                                      .addComponent(
                                          label7,
                                          GroupLayout.PREFERRED_SIZE,
                                          89,
                                          GroupLayout.PREFERRED_SIZE)
                                      .addGap(80, 80, 80))
                              .addGroup(
                                  GroupLayout.Alignment.TRAILING,
                                  errorDialogContentPaneLayout
                                      .createSequentialGroup()
                                      .addComponent(errorSure)
                                      .addGap(111, 111, 111)))));
      errorDialogContentPaneLayout.setVerticalGroup(
          errorDialogContentPaneLayout
              .createParallelGroup()
              .addGroup(
                  errorDialogContentPaneLayout
                      .createSequentialGroup()
                      .addGap(41, 41, 41)
                      .addComponent(label7)
                      .addGap(36, 36, 36)
                      .addComponent(errorSure)
                      .addContainerGap(46, Short.MAX_VALUE)));
      errorDialog.pack();
      errorDialog.setLocationRelativeTo(errorDialog.getOwner());
    }
    // //GEN-END:initComponents
  }
Example #18
0
  private void initComponents() {
    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception e) {
      // If Nimbus is not available, you can set the GUI to another look and feel.
    }

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

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

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

    chatMsgLabel.setText("Chat Message:");

    chatIPLabel.setText("Chat Group IP");

    chatIPField.setText("224.27.43.188");

    portLabel.setText("Port");

    portField.setText("4001");

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

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

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

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

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

    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(usernameField)
                            .addComponent(
                                usernameLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addGap(3, 3, 3)
                    .addComponent(
                        chatroomScrollPane,
                        GroupLayout.PREFERRED_SIZE,
                        178,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                chatMsgLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                chatMsgField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(chatIPLabel)
                                            .addComponent(portLabel))
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                chatIPField,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                portField,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(16, 16, 16)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                GroupLayout.Alignment.LEADING, false)
                                            .addComponent(
                                                joinButton,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                sendButton,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))
                                    .addGap(8, 8, 8)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(leaveButton)
                                            .addComponent(exitButton))))
                    .addGap(17, 17, 17)));
    pack();
    setVisible(true);
  }
Example #19
0
  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
  }
  @SuppressWarnings("unchecked")
  private void initComponents() {

    ruletypePanel = new JScrollPane();
    ruletypeTable = new JTable();
    violationtypePanel = new JScrollPane();
    violationtypeTable = new JTable();
    applyViolationTypes = new JButton();

    ruletypeTable.setModel(ruletypeModel);
    ruletypeTable.setFillsViewportHeight(true);
    ruletypeTable.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked() {
            ruletypeTableMouseClicked();
          }
        });
    ruletypeTable.addKeyListener(
        new KeyAdapter() {
          public void keyPressed() {
            ruletypeTableKeyPressed();
          }
        });
    ruletypePanel.setViewportView(ruletypeTable);

    violationtypeTable.setModel(violationtypeModel);
    violationtypeTable.setFillsViewportHeight(true);
    violationtypeTable.getTableHeader().setReorderingAllowed(false);
    violationtypePanel.setViewportView(violationtypeTable);

    applyViolationTypes.setText("Apply");
    applyViolationTypes.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            applyViolationTypesActionPerformed();
          }
        });

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        ruletypePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        violationtypePanel,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        249,
                        Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(applyViolationTypes)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                violationtypePanel,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                371,
                Short.MAX_VALUE)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(applyViolationTypes)
                    .addContainerGap())
            .addComponent(
                ruletypePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE));
  }
Example #21
0
    private void launch() {

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

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

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

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

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

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

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

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(118, 118, 118)
                                      .addComponent(head))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(77, 77, 77)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                                              .addComponent(pas)
                                              .addComponent(email))
                                      .addGap(27, 27, 27)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(
                                                  GroupLayout.Alignment.LEADING, false)
                                              .addComponent(mail)
                                              .addComponent(
                                                  pass,
                                                  GroupLayout.DEFAULT_SIZE,
                                                  140,
                                                  Short.MAX_VALUE))))
                      .addContainerGap(31, Short.MAX_VALUE))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(165, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(170, 170, 170)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(38, 38, 38)
                      .addComponent(head)
                      .addGap(48, 48, 48)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(email)
                              .addComponent(
                                  mail,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(29, 29, 29)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(pas, GroupLayout.Alignment.TRAILING)
                              .addComponent(
                                  pass,
                                  GroupLayout.Alignment.TRAILING,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(45, 45, 45)
                      .addComponent(sub)
                      .addContainerGap(56, Short.MAX_VALUE)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Change Email");
      pack();
    }
Example #22
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();
    }
Example #23
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);
  }
Example #24
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());
  }
Example #25
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();
  }
  @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;
  }
Example #27
0
  protected void buildErrorPanel() {
    errorPanel = new JPanel();
    GroupLayout layout = new GroupLayout(errorPanel);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    errorPanel.setLayout(layout);
    //    errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK));
    errorMessage = new JTextPane();
    errorMessage.setEditable(false);
    errorMessage.setContentType("text/html");
    errorMessage.setText(
        "<html><body>Could not connect to the Processing server.<br>"
            + "Contributions cannot be installed or updated without an Internet connection.<br>"
            + "Please verify your network connection again, then try connecting again.</body></html>");
    errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    errorMessage.setMaximumSize(new Dimension(550, 50));
    errorMessage.setOpaque(false);

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

    closeButton = new JButton("X");
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, false);
          }
        });
    tryAgainButton = new JButton("Try Again");
    tryAgainButton.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    tryAgainButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, true);
            contribDialog.downloadAndUpdateContributionListing(editor.getBase());
          }
        });
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(errorMessage)
                    .addComponent(
                        tryAgainButton,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH))
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(closeButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout.createParallelGroup().addComponent(errorMessage).addComponent(closeButton))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(tryAgainButton));
    errorPanel.setBackground(Color.PINK);
    errorPanel.validate();
  }
Example #28
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>
  private void initComponents() {
    entry = new JTextField();
    textArea = new JTextArea();
    status = new JLabel();
    jLabel1 = new JLabel();

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("TextFieldDemo");

    textArea.setColumns(20);
    textArea.setLineWrap(true);
    textArea.setRows(5);
    textArea.setWrapStyleWord(true);
    textArea.setEditable(false);
    jScrollPane1 = new JScrollPane(textArea);

    jLabel1.setText("Enter text to search:");

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

    ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);

    SequentialGroup h1 = layout.createSequentialGroup();
    ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING);

    h1.addContainerGap();

    h2.addComponent(
        jScrollPane1,
        GroupLayout.Alignment.LEADING,
        GroupLayout.DEFAULT_SIZE,
        450,
        Short.MAX_VALUE);
    h2.addComponent(
        status, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE);

    SequentialGroup h3 = layout.createSequentialGroup();
    h3.addComponent(jLabel1);
    h3.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
    h3.addComponent(entry, GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE);

    h2.addGroup(h3);
    h1.addGroup(h2);

    h1.addContainerGap();

    hGroup.addGroup(GroupLayout.Alignment.TRAILING, h1);
    layout.setHorizontalGroup(hGroup);

    ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    SequentialGroup v1 = layout.createSequentialGroup();
    v1.addContainerGap();
    ParallelGroup v2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v2.addComponent(jLabel1);
    v2.addComponent(
        entry, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    v1.addGroup(v2);
    v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
    v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE);

    v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
    v1.addComponent(status);
    v1.addContainerGap();

    vGroup.addGroup(v1);
    layout.setVerticalGroup(vGroup);
    pack();
  }
Example #30
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();
    }