/** Pause/resume the module. */
 public void setIsPaused(boolean isPaused) {
   this.isPaused = isPaused;
   if (isPaused) {
     btnPauseResume.setText("Resume");
   } else {
     btnPauseResume.setText("Pause");
   }
 }
Beispiel #2
0
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(null);
   Bienvenue.setFont(new java.awt.Font("Garamond", 1, 24));
   Bienvenue.setForeground(SystemColor.textHighlight);
   Bienvenue.setRequestFocusEnabled(true);
   Bienvenue.setVerifyInputWhenFocusTarget(true);
   Bienvenue.setText("Bienvenue dans JChat");
   Bienvenue.setBounds(new Rectangle(125, 28, 305, 44));
   Pseudo_L.setFont(new java.awt.Font("Dialog", 1, 14));
   Pseudo_L.setText("Pseudonyme :");
   Pseudo_L.setBounds(new Rectangle(75, 94, 128, 28));
   nom.setText("");
   nom.setBounds(new Rectangle(229, 95, 108, 24));
   pwd.setText("");
   pwd.setBounds(new Rectangle(230, 135, 108, 25));
   pwd_L.setFont(new java.awt.Font("Dialog", 1, 14));
   pwd_L.setText("Mot de passe :");
   pwd_L.setBounds(new Rectangle(76, 133, 122, 31));
   gestionnaire_B gestionnaire = new gestionnaire_B();
   Connect.addActionListener(gestionnaire);
   Connect.setBackground(new Color(239, 240, 234));
   Connect.setBounds(new Rectangle(281, 251, 142, 30));
   Connect.setText("Connexion");
   Connect.setIcon(new ImageIcon(image_c));
   Annuler.addActionListener(gestionnaire);
   Annuler.setBackground(new Color(239, 240, 234));
   Annuler.setBounds(new Rectangle(104, 252, 140, 29));
   Annuler.setText("Annuler");
   Annuler.setIcon(new ImageIcon(image_d));
   this.getContentPane().setBackground(new Color(239, 240, 234));
   this.setForeground(new Color(239, 240, 234));
   this.setTitle("Interface de connexion des clients au serveur de chat");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
   jLabel1.setText("Adresse du serveur :");
   jLabel1.setBounds(new Rectangle(75, 176, 156, 26));
   jTextField1.setBounds(new Rectangle(230, 176, 108, 25));
   Icon siegle = new ImageIcon(image);
   siegle_L = new JLabel("", siegle, SwingConstants.LEFT);
   siegle_L.setBounds(new Rectangle(0, 1, 76, 105));
   this.getContentPane().add(jLabel1, null);
   this.getContentPane().add(pwd_L, null);
   this.getContentPane().add(Pseudo_L, null);
   this.getContentPane().add(jTextField1, null);
   this.getContentPane().add(nom, null);
   this.getContentPane().add(pwd, null);
   this.getContentPane().add(Bienvenue, null);
   this.getContentPane().add(Connect, null);
   this.getContentPane().add(Annuler, null);
   this.getContentPane().add(siegle_L, null);
   this.setSize(new Dimension(439, 321));
   this.setResizable(false);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   this.setVisible(true);
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource().equals(pausePlay)) {
     if (pausePlay.getText().equals("Play")) {
       pausePlay.setText("Pause");
       LifeSimulation.timer().start();
     } else {
       pausePlay.setText("Play");
       LifeSimulation.timer().stop();
     }
   }
 }
  /** Initialisation */
  private void initComponents() {
    setBackground(new java.awt.Color(114, 159, 255));
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog();
          }
        });
    getContentPane().setLayout(new java.awt.BorderLayout());

    JPanel actionPanel = new JPanel();
    actionPanel.setLayout(new java.awt.GridLayout(1, 0));
    detailedArea.setEditable(false);
    detailedArea.setVisible(true);
    detailedArea.setSize(500, 300);
    detailedArea.setFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 11));
    StringWriter opDetail = new StringWriter();
    actionPrint(new PrintWriter(opDetail));
    detailedArea.setText(new String(opDetail.getBuffer()));
    JScrollPane scroll = new JScrollPane(detailedArea);
    actionPanel.add(scroll);
    getContentPane().add(actionPanel, "Center");

    northToolBar = new javax.swing.JToolBar();
    northToolBar.setLayout(new java.awt.FlowLayout());
    northToolBar.setFloatable(false);

    jbn_Print = new javax.swing.JButton();
    jbn_Print.setText("   Print   ");
    jbn_Print.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbn_PrintActionPerformed();
          }
        });
    northToolBar.add(jbn_Print);

    jbn_OK = new javax.swing.JButton();
    jbn_OK.setText("   Close   ");
    jbn_OK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbn_OKActionPerformed();
          }
        });
    northToolBar.add(jbn_OK);

    getContentPane().add(northToolBar, "South");
  }
 private void showNextCard() {
   currentCard = cardList.get(currentCardIndex);
   currentCardIndex++;
   display.setText(currentCard.getQuestion());
   nextButton.setText("Show Answer");
   isShowAnswer = true;
 }
    /** Returns the tool bar for the panel. */
    protected JComponent getToolBar() {
      JToolBar tbarDir = new JToolBar();
      JButton btnNew = new JButton();
      // m_btnSave = new JButton("Save File");
      // i118n
      // btnNew.setText("New Label");
      btnNew.setText(Util.getAdmLabel("_adm_New_Label"));
      btnNew.setActionCommand("new");
      // m_btnSave.setActionCommand("save");

      ActionListener alTool =
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              doAction(e);
            }
          };

      btnNew.addActionListener(alTool);
      // m_btnSave.addActionListener(alTool);

      tbarDir.setFloatable(false);
      tbarDir.add(btnNew);
      /*tbarDir.add(new JLabel("        "));
      tbarDir.add(m_btnSave);*/

      return tbarDir;
    }
Beispiel #7
0
  // 部屋に入室している状態のコンポーネント設定
  private void enteredRoom(String roomName) {
    this.roomName = roomName;
    setTitle(APPNAME + " " + roomName);

    msgTextField.setEnabled(true);
    submitButton.setEnabled(true);

    addRoomButton.setEnabled(false);
    enterRoomButton.setText("退室");
    enterRoomButton.setActionCommand("exitRoom");
  }
Beispiel #8
0
  // 部屋に入室していない状態のコンポーネント設定
  private void exitedRoom() {
    roomName = null;
    setTitle(APPNAME);

    msgTextField.setEnabled(false);
    submitButton.setEnabled(false);

    addRoomButton.setEnabled(true);
    enterRoomButton.setText("入室");
    enterRoomButton.setActionCommand("enterRoom");
    userList.setModel(new DefaultListModel());
  }
  private void chooseFileFor(JButton chooserBtn) {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.showDialog(this, "Choose a file");
    File file = fileChooser.getSelectedFile();

    if (chooserBtn == btnInput) {
      inputFile = file;
    } else {
      outputFile = file;
    }
    if (file != null) {
      chooserBtn.setText(file.getAbsolutePath());
    }
  }
Beispiel #10
0
 public void actionPerformed(ActionEvent evt) {
   Component parent = extensionButton.getParent();
   while ((parent != null) && !(parent instanceof Frame)) parent = parent.getParent();
   String newExtensions =
       JOptionPane.showInputDialog(
           parent,
           "Edit the extension list.\nSeparate extensions by commas.\n\n",
           filter.getExtensionString());
   if ((newExtensions != null) && !newExtensions.trim().equals("")) {
     newExtensions = newExtensions.replaceAll("\\s", "");
     filter.setExtensions(newExtensions);
     extensionButton.setText(filter.getDescription());
     properties.setProperty("extensions", filter.getExtensionString());
     directoryPane.reloadTree();
   }
 }
Beispiel #11
0
 public void start() {
   if (T != null) return;
   stop.setText("Stop");
   T = new Thread(this);
   T.start(); // calls run() indirectly
 }
  /**
   * Inizialize frame components
   *
   * @throws CMSException
   * @throws FileNotFoundException
   * @throws IOException
   * @throws GeneralSecurityException
   */
  private void initComponents()
      throws CMSException, FileNotFoundException, IOException, GeneralSecurityException {

    // *********************************

    panel4 = new JPanel();
    label2 = new JLabel();
    textPane1 = new JTextPane();
    panel5 = new JPanel();
    textArea1 = new JTextArea();
    textArea2 = new JTextArea();

    progressBar = new JProgressBar();

    textPane2 = new JTextPane();
    textField1 = new JTextField();
    button1 = new JButton();
    panel6 = new JPanel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    GridBagConstraints gbc;
    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout) contentPane.getLayout()).columnWidths = new int[] {165, 0, 0};
    ((GridBagLayout) contentPane.getLayout()).rowHeights = new int[] {105, 50, 0};
    ((GridBagLayout) contentPane.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4};
    ((GridBagLayout) contentPane.getLayout()).rowWeights = new double[] {1.0, 0.0, 1.0E-4};

    // ======== panel4 ========
    {
      panel4.setBackground(Color.white);
      panel4.setLayout(new GridBagLayout());
      ((GridBagLayout) panel4.getLayout()).columnWidths = new int[] {160, 0};
      ((GridBagLayout) panel4.getLayout()).rowHeights = new int[] {0, 0, 0};
      ((GridBagLayout) panel4.getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
      ((GridBagLayout) panel4.getLayout()).rowWeights = new double[] {1.0, 1.0, 1.0E-4};

      // ---- label2 ----
      label2.setIcon(
          new ImageIcon(
              "images" + System.getProperty("file.separator") + "logo-freesigner-piccolo.png"));
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      panel4.add(label2, gbc);

      // ---- textPane1 ----
      textPane1.setFont(new Font("Verdana", Font.BOLD, 12));
      textPane1.setText("Lettura\ncertificati\nda token");
      textPane1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.anchor = GridBagConstraints.NORTHWEST;
      panel4.add(textPane1, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    contentPane.add(panel4, gbc);

    // ======== panel5 ========
    {
      panel5.setBackground(Color.white);
      panel5.setLayout(new GridBagLayout());
      ((GridBagLayout) panel5.getLayout()).columnWidths = new int[] {0, 205, 0, 0};
      ((GridBagLayout) panel5.getLayout()).rowHeights = new int[] {100, 0, 30, 30, 0};
      ((GridBagLayout) panel5.getLayout()).columnWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel5.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0, 1.0, 1.0E-4};

      // ---- textArea1 ----
      textArea1.setFont(new Font("Verdana", Font.BOLD, 14));
      textArea1.setText("Lettura certificati da token");
      textArea1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.VERTICAL;
      gbc.insets.bottom = 5;
      panel5.add(textArea1, gbc);

      // ---- textArea2 ----
      textArea2.setFont(new Font("Verdana", Font.PLAIN, 12));
      textArea2.setText("Ricerca certificati...\n");
      textArea2.setEditable(false);
      textArea2.setColumns(30);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.BOTH;
      panel5.add(textArea2, gbc);
      progressBar.setValue(0);
      progressBar.setMaximum(1);
      progressBar.setStringPainted(true);
      progressBar.setBounds(0, 0, 300, 150);

      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 2;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      gbc.insets.right = 5;
      gbc.gridwidth = 3;
      panel5.add(progressBar, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    contentPane.add(panel5, gbc);

    // ======== panel6 ========
    {
      panel6.setBackground(Color.white);
      panel6.setLayout(new GridBagLayout());
      ((GridBagLayout) panel6.getLayout()).columnWidths = new int[] {0, 0, 0, 0};
      ((GridBagLayout) panel6.getLayout()).rowHeights = new int[] {0, 0};
      ((GridBagLayout) panel6.getLayout()).columnWeights = new double[] {1.0, 1.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel6.getLayout()).rowWeights = new double[] {1.0, 1.0E-4};

      // ---- button2 ----
      button2.setText("Indietro");
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.insets.right = 5;
      button2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {

              frame.hide();

              FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
            }
          });

      // panel6.add(button2, gbc);

      // ---- button4 ----
      button4.setText("Annulla");
      gbc = new GridBagConstraints();
      gbc.gridx = 2;
      gbc.gridy = 0;
      // panel6.add(button4, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    contentPane.add(panel6, gbc);
    contentPane.setBackground(Color.white);
    frame = new JFrame();
    frame.setContentPane(contentPane);
    frame.setTitle("Freesigner");
    frame.setSize(300, 150);
    frame.setResizable(false);
    frame.pack();
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getWidth()) / 2, (d.height - frame.getHeight()) / 2);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    timer =
        new Timer(
            10,
            new ActionListener() {

              public void actionPerformed(ActionEvent evt) {
                frame.show();
                if (task.getMessage() != null) {
                  String s = new String();
                  s = task.getMessage();
                  s = s.substring(0, Math.min(60, s.length()));

                  textArea2.setText(s + " ");
                  progressBar.setValue(task.getStatus());
                }
                if (task.isDone()) {
                  timer.stop();

                  // Finalizzo la cryptoki, onde evitare
                  // successivi errori PKCS11 "cryptoki alreadi initialized"

                  if ((task != null)) task.libFinalize();

                  ArrayList slotInfos = task.getSlotInfos();
                  if ((slotInfos == null) || slotInfos.isEmpty()) {

                    frame.show();

                    JOptionPane.showMessageDialog(
                        frame,
                        "Controllare la presenza sul sistema\n"
                            + "della libreria PKCS11 impostata.",
                        "Nessun lettore rilevato",
                        JOptionPane.WARNING_MESSAGE);

                    frame.hide();

                  } else {
                    String st = task.getCRLerror();

                    if (st.length() > 0) {
                      timer.stop();

                      JOptionPane.showMessageDialog(
                          frame,
                          "C'è stato un errore nella verifica CRL.\n" + st,
                          "Errore verifica CRL",
                          JOptionPane.ERROR_MESSAGE);
                      frame.hide();
                      FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
                    }
                    if (task.getDifferentCerts() == 0) {
                      if (task.getCIr() != null) {
                        JOptionPane.showMessageDialog(
                            frame,
                            "La carta "
                                + task.getCardDescription()
                                + " nel lettore "
                                + conf.getReader()
                                + " non contiene certificati",
                            "Attenzione",
                            JOptionPane.WARNING_MESSAGE);

                      } else
                        JOptionPane.showMessageDialog(
                            frame, task.getMessage(), "Errore:", JOptionPane.ERROR_MESSAGE);
                    }

                    frame.hide();

                    // confFrame.createTreeAndTokenNodes(task.getSlotInfos());

                  }
                }
              }
            });
  }
Beispiel #13
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);
  }
Beispiel #14
0
 /**
  * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
  * call it in your code!
  *
  * @noinspection ALL
  */
 private void $$$setupUI$$$() {
   rootPanel = new JPanel();
   rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
   final JToolBar toolBar1 = new JToolBar();
   rootPanel.add(
       toolBar1,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           new Dimension(-1, 20),
           null,
           0,
           false));
   openSrcButton = new JButton();
   openSrcButton.setText("Open Src");
   openSrcButton.setToolTipText("Open source file");
   toolBar1.add(openSrcButton);
   openBinButton = new JButton();
   openBinButton.setEnabled(true);
   openBinButton.setText("Open Bin");
   openBinButton.setToolTipText("Open and disassemble binaries");
   toolBar1.add(openBinButton);
   saveSrcButton = new JButton();
   saveSrcButton.setEnabled(true);
   saveSrcButton.setText("Save Src");
   saveSrcButton.setToolTipText("Save sources");
   toolBar1.add(saveSrcButton);
   saveBinButton = new JButton();
   saveBinButton.setEnabled(true);
   saveBinButton.setText("Save Bin");
   saveBinButton.setToolTipText("Save assembled binary");
   toolBar1.add(saveBinButton);
   final JToolBar.Separator toolBar$Separator1 = new JToolBar.Separator();
   toolBar1.add(toolBar$Separator1);
   asmButton = new JButton();
   asmButton.setText("Asm");
   asmButton.setToolTipText("Assemble sources");
   toolBar1.add(asmButton);
   final JToolBar.Separator toolBar$Separator2 = new JToolBar.Separator();
   toolBar1.add(toolBar$Separator2);
   hardResetButton = new JButton();
   hardResetButton.setEnabled(true);
   hardResetButton.setText("Hard Reset");
   hardResetButton.setToolTipText("Hard Reset - zeroize memory and reupload binary");
   toolBar1.add(hardResetButton);
   resetButton = new JButton();
   resetButton.setEnabled(true);
   resetButton.setText("Reset");
   resetButton.setToolTipText("Reset CPU (registers to zero)");
   toolBar1.add(resetButton);
   execButton = new JButton();
   execButton.setEnabled(true);
   execButton.setText("Exec");
   execButton.setToolTipText("Run forever");
   toolBar1.add(execButton);
   pauseButton = new JButton();
   pauseButton.setEnabled(false);
   pauseButton.setText("Pause");
   pauseButton.setToolTipText("Pause execution");
   toolBar1.add(pauseButton);
   runButton = new JButton();
   runButton.setEnabled(true);
   runButton.setText("Run");
   runButton.setToolTipText("Run until breakpoint/reserved");
   toolBar1.add(runButton);
   stepButton = new JButton();
   stepButton.setEnabled(true);
   stepButton.setText("Step");
   stepButton.setToolTipText("Execute one instruction");
   toolBar1.add(stepButton);
   final JToolBar.Separator toolBar$Separator3 = new JToolBar.Separator();
   toolBar1.add(toolBar$Separator3);
   breakpointButton = new JButton();
   breakpointButton.setEnabled(true);
   breakpointButton.setText("Breakpoint");
   breakpointButton.setToolTipText("Toggle breakpoint on instruction address");
   toolBar1.add(breakpointButton);
   final JPanel panel1 = new JPanel();
   panel1.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
   rootPanel.add(
       panel1,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final JLabel label1 = new JLabel();
   label1.setText("Source");
   panel1.add(
       label1,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label2 = new JLabel();
   label2.setText("Memory");
   panel1.add(
       label2,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final JLabel label3 = new JLabel();
   label3.setText("Registers");
   panel1.add(
       label3,
       new GridConstraints(
           0,
           2,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   memoryScrollPane = new JScrollPane();
   panel1.add(
       memoryScrollPane,
       new GridConstraints(
           1,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           new Dimension(600, -1),
           null,
           0,
           false));
   memoryTable = new JTable();
   memoryScrollPane.setViewportView(memoryTable);
   final JScrollPane scrollPane1 = new JScrollPane();
   panel1.add(
       scrollPane1,
       new GridConstraints(
           1,
           2,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           new Dimension(100, -1),
           null,
           0,
           false));
   registersTable = new JTable();
   scrollPane1.setViewportView(registersTable);
   sourceScrollPane = new JScrollPane();
   panel1.add(
       sourceScrollPane,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           new Dimension(500, 400),
           null,
           0,
           false));
   sourceTextarea = new JTextArea();
   sourceTextarea.setFont(new Font("Courier New", sourceTextarea.getFont().getStyle(), 12));
   sourceTextarea.setText(
       "; Input your program here\n            set a, 1\n            add a, 1\n            ife a, 2\n                set a, 3\n:mainloop\n            ife [message + I], 0\n                set pc, end\n            set a, [message + I]\n            add a, 0xA100\n            set [0x8000 + I], a\n            add i, 1\n            set pc, mainloop\n:message    dat \"Hello, world!\", 0\n:end        set pc, end");
   sourceScrollPane.setViewportView(sourceTextarea);
   final JPanel panel2 = new JPanel();
   panel2.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
   panel2.setVisible(false);
   rootPanel.add(
       panel2,
       new GridConstraints(
           2,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   consoleTextarea = new JTextArea();
   consoleTextarea.setEditable(true);
   panel2.add(
       consoleTextarea,
       new GridConstraints(
           1,
           0,
           1,
           3,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           new Dimension(150, 200),
           null,
           0,
           false));
   final JLabel label4 = new JLabel();
   label4.setText("Console");
   panel2.add(
       label4,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   clearButton = new JButton();
   clearButton.setText("Clear");
   panel2.add(
       clearButton,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_FIXED,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer1 = new Spacer();
   panel2.add(
       spacer1,
       new GridConstraints(
           0,
           2,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
 }
Beispiel #15
0
 public void stop() {
   if (T == null) return;
   stop.setText("Start");
   T = null;
 }
Beispiel #16
0
 /**
  * Component initialization.
  *
  * @throws java.lang.Exception
  */
 private void jbInit() throws Exception {
   contentPane = (JPanel) getContentPane();
   contentPane.setLayout(xYLayoutServer);
   setSize(new Dimension(365, 327));
   setTitle("ProgDan® Codename Avalon: Parser Server v. 0.1");
   statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
   statusBar.setText("Server stopped!");
   jPanelFiles.setBorder(BorderFactory.createEtchedBorder());
   jPanelFiles.setToolTipText("");
   jPanelFiles.setLayout(xYLayout1);
   jLabelFiles.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
   jLabelFiles.setText("Files received:");
   jLabelConverted.setText("Files converted:");
   jProgressBarConvert.setMaximum(0);
   jProgressBarConvert.setString("0");
   jProgressBarConvert.setStringPainted(true);
   jLabelNoConvert.setText("Files not converted:");
   jProgressBarNoConvert.setMaximum(0);
   jProgressBarNoConvert.setString("0");
   jProgressBarNoConvert.setStringPainted(true);
   jProgressBarNoConvert.addPropertyChangeListener(
       new FrameServer_jProgressBarNoConvert_propertyChangeAdapter(this));
   jButtonStart.setSelected(false);
   jButtonStart.setText("Start");
   jButtonStart.addActionListener(new FrameServer_jButtonStart_actionAdapter(this));
   jButtonStop.setEnabled(false);
   jButtonStop.setText("Stop");
   jButtonStop.addActionListener(new FrameServer_jButtonStop_actionAdapter(this));
   jButtonExit.setText("Exit");
   jButtonExit.addActionListener(new FrameServer_jButtonExit_actionAdapter(this));
   jButtonConfig.setText("Config");
   jButtonConfig.addActionListener(new FrameServer_jButtonConfig_actionAdapter(this));
   jLabelActiveConnections.setText("Active Connections:");
   jTextFieldConnections.setEditable(false);
   jTextFieldConnections.setText("0");
   jTextFieldConnections.setHorizontalAlignment(SwingConstants.CENTER);
   jProgressBarFiles.setMaximum(0);
   jProgressBarFiles.setString("0");
   jProgressBarFiles.setStringPainted(true);
   jButtonText.setEnabled(false);
   jButtonText.setText("...");
   jButtonText.addActionListener(new FrameServer_jButtonText_actionAdapter(this));
   jPanelLogo.setBorder(null);
   jPanelLogo.setMinimumSize(new Dimension(10, 10));
   jPanelLogo.setPreferredSize(new Dimension(10, 10));
   jPanelLogo.setLayout(null);
   jLabelTitle.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
   jLabelTitle.setText("ProgDan® Codename Avalon");
   jLabelApplication.setFont(new java.awt.Font("Dialog", Font.BOLD, 24));
   jLabelApplication.setForeground(Color.red);
   jLabelApplication.setText("Parser Server");
   jLabelRelease.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
   jLabelRelease.setForeground(Color.red);
   jLabelRelease.setText("Release 0.1 - Beta");
   jLabelCopyright.setText("Copyright 2004-2005 - ProgDan® Software");
   jPanelFiles.add(jLabelFiles, new XYConstraints(8, 5, -1, -1));
   jPanelFiles.add(jLabelNoConvert, new XYConstraints(8, 50, -1, -1));
   jPanelFiles.add(jLabelConverted, new XYConstraints(8, 28, -1, -1));
   jPanelFiles.add(jProgressBarFiles, new XYConstraints(108, 3, 160, -1));
   jPanelFiles.add(jProgressBarConvert, new XYConstraints(108, 26, 160, -1));
   jPanelFiles.add(jProgressBarNoConvert, new XYConstraints(108, 48, 160, -1));
   jPanelFiles.add(jButtonText, new XYConstraints(279, 46, -1, -1));
   contentPane.add(jTextFieldConnections, new XYConstraints(158, 118, 131, -1));
   contentPane.add(jLabelActiveConnections, new XYConstraints(45, 121, -1, -1));
   contentPane.add(jButtonExit, new XYConstraints(277, 238, 65, -1));
   contentPane.add(jButtonStart, new XYConstraints(11, 238, 65, -1));
   contentPane.add(jButtonStop, new XYConstraints(100, 238, 65, -1));
   contentPane.add(jButtonConfig, new XYConstraints(188, 238, 65, -1));
   contentPane.add(statusBar, new XYConstraints(6, 272, 344, -1));
   contentPane.add(jPanelFiles, new XYConstraints(13, 148, 327, 77));
   contentPane.add(jPanelLogo, new XYConstraints(13, 15, 112, 96));
   contentPane.add(jLabelTitle, new XYConstraints(141, 14, -1, -1));
   contentPane.add(jLabelApplication, new XYConstraints(165, 40, -1, -1));
   contentPane.add(jLabelRelease, new XYConstraints(250, 66, -1, -1));
   contentPane.add(jLabelCopyright, new XYConstraints(137, 95, -1, -1));
 }
Beispiel #17
0
 protected void setSimpleDisplayUpdate() {
   view().setDisplayUpdate(new SimpleUpdateStrategy());
   fUpdateButton.setText("Simple Update");
   fSimpleUpdate = true;
 }
Beispiel #18
0
  private void initComponents() { // 初始化构件

    jLabel1 = new JLabel();
    jLabel2 = new JLabel();
    jLabel3 = new JLabel();
    jLabel4 = new JLabel();
    jLabel5 = new JLabel();
    jTextField1 = new JTextField(null);
    jTextField2 = new JTextField(null);
    jTextField3 = new JTextField(null);
    jTextField4 = new JTextField(null);
    jRadioButton1 = new JRadioButton("男");
    jRadioButton2 = new JRadioButton("女");
    jRadioButtonName = new String();
    jButton1 = new JButton();
    ButtonGroup buttonGroup = new ButtonGroup(); // 单选按钮组
    buttonGroup.add(jRadioButton1);
    buttonGroup.add(jRadioButton2);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(false); // 不可更改大小

    jLabel1.setText("心电仪IP地址");
    jLabel2.setText("端口号");
    jLabel3.setText("档案ID");
    jLabel4.setText("姓名");
    jLabel5.setText("性别");
    jButton1.setText("确定");

    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            jLabel1.setText(null);
            jLabel2.setText(null);
            jLabel3.setText(null);
            jLabel4.setText(null);
            jLabel5.setText(null);
            jRadioButtonName = null;
            System.out.println("windowClosing");
          }
        });

    if (!file.exists()) {
      try {
        fwriter = new FileWriter(filename);
        fwriter.write(jTextField1.getText());
        fwriter.write("\r\n");
        fwriter.write(jTextField2.getText());
        fwriter.write("\r\n");
        fwriter.write(jTextField3.getText());
        fwriter.write("\r\n");
        fwriter.write(jTextField4.getText());
        fwriter.write("\r\n");
        fwriter.write(jRadioButtonName);
        fwriter.write("\r\n");

      } catch (IOException e) {
        e.printStackTrace();
      } finally {
        try {
          fwriter.flush();
          fwriter.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    } else {
      File file = new File(filename);
      String[] fileContent = new String[5];
      try {
        reader = new BufferedReader(new FileReader(file));
        String tempString = null;
        int line = 1; // 一次读入一行,直到读入null为文件结束
        while ((tempString = reader.readLine()) != null) {
          System.out.println("line" + line + ": " + tempString);
          // content=tempString;
          fileContent[line - 1] = tempString;
          line++;
        }
        reader.close();
      } catch (IOException e) {
        e.printStackTrace();
      } finally {
        if (reader != null) {
          try {
            reader.close();
          } catch (IOException e1) {
          }
        }
      }
      jTextField1.setText(fileContent[0]);
      jTextField2.setText(fileContent[1]);
      jTextField3.setText(fileContent[2]);
      jTextField4.setText(fileContent[3]);
      jRadioButtonName = fileContent[4];
      if (jRadioButtonName.equals((String) "男")) {
        jRadioButton1.setSelected(true);
      } else if (jRadioButtonName.equals((String) "女")) {
        jRadioButton2.setSelected(true);
      }
    }

    jButton1.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt); // jButton1ActionPerformed这个方法在后面定义
          }
        }); // 按钮的监听事件

    GroupLayout layout = new GroupLayout(getContentPane()); // GroupLayout布局
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(40, 40, 40)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.TRAILING)
                            .addComponent(jButton1)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabel5)
                                            .addComponent(jLabel4)
                                            .addComponent(jLabel3)
                                            .addComponent(jLabel2)
                                            .addComponent(jLabel1))
                                    .addGap(40, 40, 40)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(GroupLayout.Alignment.LEADING)
                                            .addGroup(
                                                layout
                                                    .createSequentialGroup()
                                                    .addComponent(jRadioButton1)
                                                    .addComponent(jRadioButton2))
                                            .addComponent(
                                                jTextField4,
                                                GroupLayout.PREFERRED_SIZE,
                                                160,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jTextField3,
                                                GroupLayout.PREFERRED_SIZE,
                                                160,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jTextField2,
                                                GroupLayout.PREFERRED_SIZE,
                                                160,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jTextField1,
                                                GroupLayout.PREFERRED_SIZE,
                                                160,
                                                GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(85, Short.MAX_VALUE)));

    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(
                                jTextField1,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(
                                jTextField2,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(
                                jTextField3,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(
                                jTextField4,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)
                    .addGroup(
                        layout
                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addGroup(
                                layout
                                    .createParallelGroup()
                                    .addComponent(jRadioButton1)
                                    .addComponent(jRadioButton2)))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jButton1)
                    .addContainerGap(23, Short.MAX_VALUE)));

    pack(); // 调整此窗口的大小,以适合其子组件的首选大小和布局
    setLocationRelativeTo(null); // 窗口居中显示
  } //  初始化构件initComponents() 结束
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(gridBagLayout2);
   bottomPanel.setLayout(gridBagLayout1);
   messagePanel.setBorder(BorderFactory.createLoweredBevelBorder());
   replaceButton.setToolTipText("Save the new trace replacing the old trace.");
   replaceButton.setText("Replace old trace");
   replaceButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           replaceOldTrace();
         }
       });
   buttonPanel.setBorder(BorderFactory.createLoweredBevelBorder());
   discardButton.setToolTipText("Discard the new trace");
   discardButton.setText("Discard new trace");
   discardButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           DoneReplayDialog.this.setVisible(false);
         }
       });
   saveButton.setToolTipText("Save the new trace in a file.");
   saveButton.setText("Save as new file");
   saveButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           saveNewToFile();
         }
       });
   this.setModal(true);
   this.setTitle("Replay Complete");
   jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
   jScrollPane1.setMinimumSize(new Dimension(200, 200));
   jScrollPane1.setPreferredSize(new Dimension(200, 200));
   jTextPane.setMinimumSize(new Dimension(25, 80));
   jTextPane.setPreferredSize(new Dimension(40, 80));
   tracePanel.setLayout(borderLayout1);
   commentPanel.setLayout(borderLayout3);
   jPanel6.setLayout(borderLayout2);
   jScrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
   jScrollPane2.setMinimumSize(new Dimension(200, 100));
   jScrollPane2.setPreferredSize(new Dimension(200, 100));
   jLabel1.setText("Comment");
   jLabel2.setText("Traces (Old is Yellow, New is Pink)");
   tracePanel.setBorder(BorderFactory.createEtchedBorder());
   bottomPanel.setBorder(BorderFactory.createEtchedBorder());
   commentPanel.setBorder(BorderFactory.createEtchedBorder());
   this.getContentPane()
       .add(
           bottomPanel,
           new GridBagConstraints(
               0,
               3,
               1,
               1,
               1.0,
               1.0,
               GridBagConstraints.CENTER,
               GridBagConstraints.HORIZONTAL,
               new Insets(0, 5, 5, 5),
               0,
               0));
   buttonPanel.add(saveButton, null);
   buttonPanel.add(replaceButton, null);
   buttonPanel.add(discardButton, null);
   bottomPanel.add(
       messagePanel,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(0, 0, 0, 0),
           0,
           0));
   messagePanel.add(messageLabel, null);
   this.getContentPane()
       .add(
           tracePanel,
           new GridBagConstraints(
               0,
               2,
               1,
               1,
               1.0,
               1.0,
               GridBagConstraints.CENTER,
               GridBagConstraints.BOTH,
               new Insets(0, 0, 0, 0),
               0,
               0));
   tracePanel.add(jScrollPane1, BorderLayout.CENTER);
   tracePanel.add(jLabel2, BorderLayout.NORTH);
   this.getContentPane()
       .add(
           commentPanel,
           new GridBagConstraints(
               0,
               1,
               1,
               1,
               1.0,
               1.0,
               GridBagConstraints.CENTER,
               GridBagConstraints.BOTH,
               new Insets(0, 5, 5, 5),
               0,
               0));
   commentPanel.add(jPanel6, BorderLayout.CENTER);
   jPanel6.add(jScrollPane2, BorderLayout.CENTER);
   commentPanel.add(jLabel1, BorderLayout.NORTH);
   jScrollPane2.getViewport().add(commentPane, null);
   jScrollPane1.getViewport().add(jTextPane, null);
   bottomPanel.add(
       buttonPanel,
       new GridBagConstraints(
           0,
           1,
           2,
           2,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
 }
Beispiel #20
0
  /** The graphic handling and deployment. */
  private void initComponents() {
    jDesktopPane1 = new javax.swing.JDesktopPane();
    jInternalFrame1 = new javax.swing.JInternalFrame();
    tf = new javax.swing.JTextField();
    b1 = new javax.swing.JButton();
    jInternalFrame3 = new javax.swing.JInternalFrame();
    ta = new javax.swing.JTextArea();
    jsp_ta = new javax.swing.JScrollPane(ta);
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    jMenuItem4 = new javax.swing.JMenuItem();

    jInternalFrame1
        .getContentPane()
        .setLayout(
            new javax.swing.BoxLayout(
                jInternalFrame1.getContentPane(), javax.swing.BoxLayout.X_AXIS));

    jInternalFrame1.setIconifiable(true);
    jInternalFrame1.setMaximizable(true);
    jInternalFrame1.setResizable(true);
    jInternalFrame1.setTitle("Message editor");
    jInternalFrame1.setToolTipText(
        "Move and resize all of these to make the chat room appearance match your preferences.");
    jInternalFrame1.setVisible(true);
    tf.setFont(new java.awt.Font("Lucida Sans", 0, 12));
    jInternalFrame1.getContentPane().add(tf);

    b1.setText("Send Message");
    jInternalFrame1.getContentPane().add(b1);

    jInternalFrame1.setBounds(10, 10, 440, 60);
    jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);

    jInternalFrame3.setIconifiable(true);
    jInternalFrame3.setMaximizable(true);
    jInternalFrame3.setResizable(true);
    jInternalFrame3.setTitle("Messages");
    jInternalFrame3.setToolTipText(
        "Move and resize all of these to make the chat room appearance match your preferences.");
    jInternalFrame3.setVisible(true);
    ta.setBackground(new Color(255, 255, 255));
    ta.setEditable(false);
    ta.setFont(new java.awt.Font("Lucida Sans", 0, 12));
    // jsp_ta.setAutoscrolls(true);
    jsp_ta.setDoubleBuffered(true);

    jInternalFrame3.getContentPane().add(jsp_ta, java.awt.BorderLayout.CENTER);

    jInternalFrame3.setBounds(10, 80, 420, 240);

    jDesktopPane1.add(jInternalFrame3, javax.swing.JLayeredPane.DEFAULT_LAYER);

    getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);

    jMenu1.setText("Private room options");
    jMenu1.setMnemonic(KeyEvent.VK_O);
    jMenu1.setToolTipText("Choose some options.");
    jMenuItem3.setText("Save conversation");
    jMenuItem3.setMnemonic(KeyEvent.VK_S);
    jMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    jMenu1.add(jMenuItem3);
    jMenu1.add(jSeparator1);
    jMenuItem4.setText("Exit");
    jMenuItem4.setMnemonic(KeyEvent.VK_E);
    jMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
    jMenu1.add(jMenuItem4);
    jMenuBar1.add(jMenu1);
    setJMenuBar(jMenuBar1);

    this.pack();

    b1.addActionListener(this);
    tf.addActionListener(this);
    jMenuItem3.addActionListener(this);
    jMenuItem4.addActionListener(this);

    posx = (int) Math.random() * 640;
    posy = (int) Math.random() * 480;

    this.pack();
    this.setSize(dimx, dimy);
    this.setLocation(posx, posy);
    this.show();
  }
  /** Constructor to create the frame and its components */
  public CoreyTextEditor() {
    // Create a scroll pane
    area.setFont(new Font("Monospaced", Font.PLAIN, 12));
    JScrollPane scroll =
        new JScrollPane(
            area, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    add(scroll, BorderLayout.CENTER);

    // Adds the system default look and feel

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException
        | InstantiationException
        | UnsupportedLookAndFeelException
        | IllegalAccessException e) {
      e.printStackTrace();
    }

    // Create a menu bar
    JMenuBar JMB = new JMenuBar();
    setJMenuBar(JMB);
    JMenu file = new JMenu("File");
    JMenu edit = new JMenu("Edit");
    JMB.add(file);
    JMB.add(edit);

    // Finishing our menu bar
    file.add(New);
    file.add(Open);
    file.add(Save);
    file.add(SaveAs);
    file.addSeparator();
    file.add(Quit);

    edit.add(Cut);
    edit.add(Copy);
    edit.add(Paste);

    edit.getItem(0).setText("Cut");
    edit.getItem(0).setIcon(new ImageIcon("cut.gif"));
    edit.getItem(1).setText("Copy");
    edit.getItem(1).setIcon(new ImageIcon("copy.gif"));
    edit.getItem(2).setText("Paste");
    edit.getItem(2).setIcon(new ImageIcon("paste.gif"));

    // Time to make a toolbar!
    JToolBar tool = new JToolBar();
    add(tool, BorderLayout.NORTH);
    tool.add(New);
    tool.add(Open);
    tool.add(Save);
    tool.addSeparator();

    JButton cut = tool.add(Cut);
    JButton cop = tool.add(Copy);
    JButton pas = tool.add(Paste);

    cut.setText(null);
    cut.setIcon(new ImageIcon("cut.gif"));
    cop.setText(null);
    cop.setIcon(new ImageIcon("copy.gif"));
    pas.setText(null);
    pas.setIcon(new ImageIcon("paste.gif"));

    Save.setEnabled(false);
    SaveAs.setEnabled(false);

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    pack();

    /*
     KeyListener to change Save and SaveAs
    */
    KeyListener k1 =
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            changed = true;
            Save.setEnabled(true);
            SaveAs.setEnabled(true);
          }
        };
    area.addKeyListener(k1);
    setTitle(currentFile + " - CoreyTextEditor");
    setVisible(true);
  }
Beispiel #22
0
 protected void setBufferedDisplayUpdate() {
   view().setDisplayUpdate(new BufferedUpdateStrategy());
   fUpdateButton.setText("Buffered Update");
   fSimpleUpdate = false;
 }
Beispiel #23
0
 public void mouseClicked(MouseEvent e) {
   if (e.getSource() == userList && e.getClickCount() == 2) {
     int index = userList.locationToIndex(e.getPoint());
     if (index > -1) {
       String userInfo = (String) ((DefaultListModel) userList.getModel()).get(index);
       link.running = false;
       userInfo = userInfo.substring(userInfo.indexOf("@") - 1);
       link =
           new LeetClient(
               userInfo.substring(userInfo.indexOf("@") + 1, userInfo.indexOf(":")),
               Integer.parseInt(userInfo.substring(userInfo.indexOf(":") + 1)),
               address,
               directory);
       link.setPasv(portItem.getState());
       link.command = "LIST";
       link.start();
     }
   }
   if (e.getSource() == fileList && e.getClickCount() == 2) {
     int index = fileList.locationToIndex(e.getPoint());
     if (index > -1) {
       String fileName = (String) ((DefaultListModel) fileList.getModel()).get(index);
       if (fileName.indexOf(" ") > -1) {
         fileName = fileName.substring(0, fileName.indexOf(" "));
       }
       link.command = "RETR " + fileName;
       System.out.println(link.command);
     }
   }
   if (e.getSource() == connectButton) {
     if (connectButton.getText().equals("Disconnect")) {
       active.running = false;
       connectButton.setText("Connect");
     } else {
       active =
           new LeetActive(
               serverTextField.getText(),
               Integer.parseInt(portTextField.getText()),
               SERVER_PORT);
       active.setUserName(nameTextField.getText());
       active.start();
       connectButton.setText("Disconnect");
     }
   }
   if (e.getSource() == searchInit) {
     search = new SearchUsers();
     search.start();
   }
   if (e.getSource() == searchList && e.getClickCount() == 2) {
     int index = searchList.locationToIndex(e.getPoint());
     if (index > -1) {
       String fileInfo = (String) ((DefaultListModel) searchList.getModel()).get(index);
       link.running = false;
       String userInfo = fileInfo.substring(fileInfo.indexOf("@") + 1);
       userInfo = userInfo.substring(userInfo.indexOf("@") - 1);
       fileInfo = fileInfo.substring(0, fileInfo.indexOf("@"));
       link =
           new LeetClient(
               userInfo.substring(userInfo.indexOf("@") + 1, userInfo.indexOf(":")),
               Integer.parseInt(userInfo.substring(userInfo.indexOf(":") + 1)),
               address,
               directory);
       link.setPasv(portItem.getState());
       link.command = "RETR " + fileInfo;
       link.start();
     }
   }
 }
Beispiel #24
0
  void jbInit() throws Exception {
    titledBorder1 =
        new TitledBorder(
            BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "Assembler messages");
    this.getContentPane().setLayout(borderLayout1);

    this.setIconifiable(true);
    this.setMaximizable(true);
    this.setResizable(true);

    this.setTitle("EDIT");

    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setDividerLocation(470);
    sourceArea.setFont(new java.awt.Font("Monospaced", 0, 12));
    controlPanel.setLayout(gridBagLayout1);
    controlPanel.setBorder(BorderFactory.createLoweredBevelBorder());
    positionPanel.setLayout(gridBagLayout2);
    fileLabel.setText("Source file:");
    fileText.setEditable(false);
    browseButton.setSelected(false);
    browseButton.setText("Browse ...");
    assembleButton.setEnabled(false);
    assembleButton.setText("Assemble file");
    saveButton.setEnabled(false);
    saveButton.setText("Save file");
    lineLabel.setText("Line:");
    lineText.setMinimumSize(new Dimension(50, 20));
    lineText.setPreferredSize(new Dimension(50, 20));
    lineText.setEditable(false);
    columnLabel.setText("Column:");
    columnText.setMinimumSize(new Dimension(41, 20));
    columnText.setPreferredSize(new Dimension(41, 20));
    columnText.setEditable(false);
    columnText.setText("");
    messageScrollPane.setBorder(titledBorder1);
    messageScrollPane.setMinimumSize(new Dimension(33, 61));
    messageScrollPane.setPreferredSize(new Dimension(60, 90));
    optionsButton.setEnabled(false);
    optionsButton.setText("Assembler options ...");
    messageScrollPane.getViewport().add(messageList, null);
    messageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.getContentPane().add(splitPane, BorderLayout.CENTER);
    splitPane.add(textScrollPane, JSplitPane.TOP);
    splitPane.add(controlPanel, JSplitPane.BOTTOM);
    textScrollPane.getViewport().add(sourceArea, null);

    controlPanel.add(
        fileLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        fileText,
        new GridBagConstraints(
            1,
            0,
            3,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        browseButton,
        new GridBagConstraints(
            4,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));
    controlPanel.add(
        optionsButton,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        assembleButton,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        saveButton,
        new GridBagConstraints(
            4,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));
    controlPanel.add(
        positionPanel,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    positionPanel.add(
        lineLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    positionPanel.add(
        lineText,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 0, 0),
            0,
            0));
    positionPanel.add(
        columnLabel,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 10, 0, 0),
            0,
            0));
    positionPanel.add(
        columnText,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        messageScrollPane,
        new GridBagConstraints(
            0,
            2,
            5,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(5, 5, 5, 5),
            0,
            0));
  }
Beispiel #25
0
  @Override
  public void run() {
    this.cardIndex = 0;

    File base = new File(Constants.IO.imageBaseDir);
    if (!base.exists()) {
      base.mkdir();
    }

    Connection.ProxyType configProxyType =
        Connection.ProxyType.valueByText(
            PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));

    Proxy.Type type = Proxy.Type.DIRECT;
    switch (configProxyType) {
      case HTTP:
        type = Proxy.Type.HTTP;
        break;
      case SOCKS:
        type = Proxy.Type.SOCKS;
        break;
      case NONE:
      default:
        p = Proxy.NO_PROXY;
        break;
    }

    if (type != Proxy.Type.DIRECT) {
      try {
        String address = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_ADDRESS, "");
        Integer port =
            Integer.parseInt(
                PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_PORT, "80"));
        p = new Proxy(type, new InetSocketAddress(address, port));
      } catch (Exception ex) {
        throw new RuntimeException("Gui_DownloadPictures : error 1 - " + ex);
      }
    }

    if (p != null) {
      HashSet<String> ignoreUrls = SettingsManager.getIntance().getIgnoreUrls();

      ArrayList<CardDownloadData> cardsToDownload = this.checkBox.isSelected() ? type2cards : cards;

      update(0, cardsToDownload.size());

      for (int i = 0; i < cardsToDownload.size() && !cancel; i++) {
        try {

          CardDownloadData card = cardsToDownload.get(i);

          log.info("Downloading card: " + card.getName() + " (" + card.getSet() + ")");

          String url;
          if (ignoreUrls.contains(card.getSet()) || card.isToken()) {
            if (card.getCollectorId() != 0) {
              continue;
            }
            url = cardImageSource.generateTokenUrl(card);
          } else {
            url = cardImageSource.generateURL(card);
          }

          if (url != null) {
            Logger.getLogger(this.getClass()).info(url);
            Runnable task = new DownloadTask(card, new URL(url), cardsToDownload.size());
            executor.execute(task);
          } else {
            synchronized (sync) {
              update(cardIndex + 1, cardsToDownload.size());
            }
          }

        } catch (Exception ex) {
          log.error(ex, ex);
        }
      }
      executor.shutdown();
      while (!executor.isTerminated()) {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException ie) {
        }
      }
    }
    try {
      TVFS.umount();
    } catch (FsSyncException e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(
          null, "Couldn't unmount zip files", "Error", JOptionPane.ERROR_MESSAGE);
    } finally {
      System.gc();
    }
    closeButton.setText("Close");
  }