/** Show the filter dialog */
 public void showDialog() {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   include_panel =
       new ServiceFilterPanel("Include messages based on target service:", filter_include_list);
   exclude_panel =
       new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list);
   status_box = new JCheckBox("Filter messages based on status:");
   status_box.addActionListener(this);
   status_active = new JRadioButton("Active messages only");
   status_active.setSelected(true);
   status_active.setEnabled(false);
   status_complete = new JRadioButton("Complete messages only");
   status_complete.setEnabled(false);
   status_group = new ButtonGroup();
   status_group.add(status_active);
   status_group.add(status_complete);
   if (filter_active || filter_complete) {
     status_box.setSelected(true);
     status_active.setEnabled(true);
     status_complete.setEnabled(true);
     if (filter_complete) {
       status_complete.setSelected(true);
     }
   }
   status_options = new JPanel();
   status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS));
   status_options.add(status_active);
   status_options.add(status_complete);
   status_options.setBorder(indent_border);
   status_panel = new JPanel();
   status_panel.setLayout(new BorderLayout());
   status_panel.add(status_box, BorderLayout.NORTH);
   status_panel.add(status_options, BorderLayout.CENTER);
   status_panel.setBorder(empty_border);
   ok_button = new JButton("Ok");
   ok_button.addActionListener(this);
   cancel_button = new JButton("Cancel");
   cancel_button.addActionListener(this);
   buttons = new JPanel();
   buttons.setLayout(new FlowLayout());
   buttons.add(ok_button);
   buttons.add(cancel_button);
   panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
   panel.add(include_panel);
   panel.add(exclude_panel);
   panel.add(status_panel);
   panel.add(buttons);
   dialog = new JDialog();
   dialog.setTitle("SOAP Monitor Filter");
   dialog.setContentPane(panel);
   dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   dialog.setModal(true);
   dialog.pack();
   Dimension d = dialog.getToolkit().getScreenSize();
   dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2);
   ok_pressed = false;
   dialog.show();
 }
예제 #2
0
  private void warning(String msg) {
    final JDialog warn;
    JButton ok;
    JLabel message;

    warn = new JDialog();
    warn.setTitle(msg);

    message = new JLabel("CryoBay: " + msg);
    ok = new JButton("Ok");

    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            warn.dispose();
          }
        });

    warn.getContentPane().setLayout(new BorderLayout());
    warn.getContentPane().add(message, "North");
    warn.getContentPane().add(ok, "South");

    warn.setSize(200, 80);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    warn.setLocation(screenSize.width / 2 - 100, screenSize.height / 2 - 40);
    warn.setResizable(false);
    warn.show();
  }
예제 #3
0
  public void actionPerformed(ActionEvent e) {
    System.out.println("[*** EditSpeakersAction ***]");
    ApplicationControl ac = (ApplicationControl) applicationControl;
    JDialog dialog = new JDialog(ac.getFrame(), true);
    EditSpeakerPanel editSpeakerPanel = new EditSpeakerPanel(ac.getTranscription());
    dialog.setTitle(FOLKERInternationalizer.getString("dialog.speaker.editspeakers"));
    dialog.getContentPane().add(editSpeakerPanel);
    dialog.pack();
    dialog.setLocationRelativeTo(ac.getFrame());
    dialog.setVisible(true);

    ac.speakersChanged();
  }
예제 #4
0
  public EchoAWT() throws UnknownHostException {

    super("채팅 프로그램");

    // 각종 정의
    h = new JPanel(new GridLayout(2, 3));
    m = new JPanel(new BorderLayout());
    f = new JPanel(new BorderLayout());
    s = new JPanel(new BorderLayout());
    login = new JPanel(new BorderLayout());

    // name = new JLabel(" 사용자 이름 ");
    name = new JLabel(" 메세지 입력 ");

    jta = new JTextArea();
    // clientList = new JTextArea(0, 10);
    clientList = new JList();

    jsp = new JScrollPane(jta);
    list = new JScrollPane(clientList);

    jtf = new JTextField("입력하세요.");
    hi = new JTextField("HOST IP 입력");
    pi = new JTextField("PORT 입력");
    localport = new JTextField("원하는 PORT 입력");
    lid = new JTextField("ID를 입력하세요.");
    lpw = new JTextField("PW를 입력하세요.");

    serveropen = new JButton("서버 오픈");
    textin = new JButton("입력");
    clientin = new JButton("서버 접속");
    conf = new JButton("로그인");
    join = new JButton("회원가입");

    addr = InetAddress.getLocalHost();

    // 사용자 해상도 및 창 크기 설정 및 가져오기.
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenSize = tk.getScreenSize();

    setSize(500, 500);
    Dimension d = getSize();

    // 각종 버튼 및 텍스트 필드 리스너
    jtf.addActionListener(this);
    hi.addActionListener(this);
    pi.addActionListener(this);
    localport.addActionListener(this);
    lid.addActionListener(this);
    lpw.addActionListener(this);
    conf.addActionListener(this);
    join.addActionListener(this);

    serveropen.addActionListener(this);
    clientin.addActionListener(this);
    textin.addActionListener(this);

    jtf.addFocusListener(this);
    hi.addFocusListener(this);
    pi.addFocusListener(this);
    localport.addFocusListener(this);
    lid.addFocusListener(this);
    lpw.addFocusListener(this);

    // 서버 접속
    h.add(hi);
    h.add(pi);
    h.add(clientin);

    // 서버 생성
    h.add(new JLabel("IP : " + addr.getHostAddress(), (int) CENTER_ALIGNMENT));
    h.add(localport);
    h.add(serveropen);

    // 채팅글창 글 작성 막기
    jta.setEditable(false);

    // 접속자 리스트 width 제한
    clientList.setFixedCellWidth(d.width / 3);

    // 입력 창
    f.add(name, "West");
    f.add(jtf, "Center");
    f.add(textin, "East");

    // 접속자 확인창
    s.add(new JLabel("접속자", (int) CENTER_ALIGNMENT), "North");
    s.add(list, "Center");
    // clientList.setEditable(false);

    // 메인 창
    m.add(jsp, "Center");
    m.add(s, "East");

    // 프레임 설정
    add(h, "North");
    add(m, "Center");
    add(f, "South");

    // 로그인 다이얼로그
    jd = new JDialog();
    jd.setTitle("채팅 로그인");
    jd.add(login);
    jd.setSize(200, 200);
    Dimension dd = jd.getSize();
    jd.setLocation(screenSize.width / 2 - (dd.width / 2), screenSize.height / 2 - (dd.height / 2));
    jd.setVisible(true);

    // 로그인창
    JPanel lm = new JPanel(new GridLayout(4, 1));
    lm.add(lid);
    lm.add(new Label());
    lm.add(lpw);
    lm.add(new Label());

    JPanel bt = new JPanel();
    bt.add(conf);
    bt.add(join);

    login.add(new Label(), "North");
    login.add(new Label(), "West");
    login.add(new Label(), "East");
    login.add(lm, "Center");
    login.add(bt, "South");

    // 창의 위치, 보임, EXIT 단추 활성화.
    setLocation(screenSize.width / 2 - (d.width / 2), screenSize.height / 2 - (d.height / 2));

    setVisible(false);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
예제 #5
0
  public Viewer() {
    leveldbStore.setMultiSelectionEnabled(false);
    leveldbStore.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    putButton.setEnabled(false);
    key.setEnabled(false);
    value.setEnabled(false);
    findField.setEnabled(false);
    deleteButton.setEnabled(false);
    saveButton.setEnabled(false);
    putType.setEnabled(false);
    putType.setEditable(false);
    signedBox.setEnabled(false);

    openButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (openButton.isEnabled()) {
              openButton.setEnabled(false);
              new Thread() {
                public void run() {
                  if (leveldbStore.showOpenDialog(pane) == JFileChooser.APPROVE_OPTION) {
                    File select = leveldbStore.getSelectedFile();
                    if (select.isDirectory()) {
                      new OpenLevelDBDialog(Viewer.this, select);
                      openDatabase(select);
                      dbPathField.setText(select.getAbsolutePath());
                    } else {
                      JOptionPane.showMessageDialog(
                          pane,
                          "The selecting item must be a directory",
                          "Unable to load database",
                          JOptionPane.WARNING_MESSAGE);
                    }
                  } else {
                    openButton.setEnabled(true);
                  }
                }
              }.start();
            }
          }
        });

    deleteButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (dataList.getSelectedValue() != null) {
              delete(dataList.getSelectedValue().key);
            }
            openDatabase(leveldbStore.getSelectedFile());
          }
        });

    putButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            put(
                ((PutType) putType.getSelectedItem()).getBytes(key.getText()),
                ((PutType) putType.getSelectedItem()).getBytes(value.getText()));
            openDatabase(leveldbStore.getSelectedFile());
          }
        });

    findField.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            openDatabase(leveldbStore.getSelectedFile());
          }
        });
    findField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                openDatabase(leveldbStore.getSelectedFile());
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                openDatabase(leveldbStore.getSelectedFile());
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                openDatabase(leveldbStore.getSelectedFile());
              }
            });
    findField
        .getDocument()
        .addUndoableEditListener(
            new UndoableEditListener() {
              @Override
              public void undoableEditHappened(UndoableEditEvent e) {
                openDatabase(leveldbStore.getSelectedFile());
              }
            });

    hexKey
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                update(hexKey);
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                update(hexKey);
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                update(hexKey);
              }
            });
    hexKey
        .getDocument()
        .addUndoableEditListener(
            new UndoableEditListener() {
              @Override
              public void undoableEditHappened(UndoableEditEvent e) {
                update(hexKey);
              }
            });

    stringKey
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                update(stringKey);
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                update(stringKey);
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                update(stringKey);
              }
            });
    stringKey
        .getDocument()
        .addUndoableEditListener(
            new UndoableEditListener() {
              @Override
              public void undoableEditHappened(UndoableEditEvent e) {
                update(stringKey);
              }
            });

    hexValue
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                update(hexValue);
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                update(hexValue);
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                update(hexValue);
              }
            });
    hexValue
        .getDocument()
        .addUndoableEditListener(
            new UndoableEditListener() {
              @Override
              public void undoableEditHappened(UndoableEditEvent e) {
                update(hexValue);
              }
            });

    stringValue
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                update(stringValue);
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                update(stringValue);
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                update(stringValue);
              }
            });
    stringValue
        .getDocument()
        .addUndoableEditListener(
            new UndoableEditListener() {
              @Override
              public void undoableEditHappened(UndoableEditEvent e) {
                update(stringValue);
              }
            });

    saveButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            save();
            openDatabase(leveldbStore.getSelectedFile());
          }
        });

    dataList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataList.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            DBItem item = dataList.getSelectedValue();
            if (item != null) {
              hexValue.setText(cutToLine(LevelDBViewer.toHexString(item.value), 64));
              stringValue.setText(cutToLine(new String(item.value), 64));
              hexKey.setText(cutToLine(LevelDBViewer.toHexString(item.key), 64));
              stringKey.setText(cutToLine(new String(item.key), 64));

              lengthLabel.setText(String.valueOf(item.value.length + item.key.length));
              keyLength.setText(String.valueOf(item.key.length));
              valueLength.setText(String.valueOf(item.value.length));
            }
          }
        });

    signedBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            LevelDBViewer.DEFAULT_SINGED = signedBox.isSelected();
            int i = dataList.getSelectedIndex();
            dataList.clearSelection();
            dataList.updateUI();
            dataList.setSelectedIndex(i);
            update(hexKey);
            update(hexValue);
          }
        });

    for (PutType t : PutType.values()) {
      putType.addItem(t);
    }
    putType.setSelectedItem(PutType.STRING);
    putType.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            openDatabase(leveldbStore.getSelectedFile());
          }
        });
    putType.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            openDatabase(leveldbStore.getSelectedFile());
          }
        });

    dialog.setLocationByPlatform(true);
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setContentPane(pane);
    dialog.setTitle("LevelDB Viewer By Marcus (https://github.com/SuperMarcus)");
    dialog.getRootPane().setDefaultButton(openButton);
    dialog.pack();
    dialog.setVisible(true);
  }
예제 #6
0
  public static boolean showLicensing() {
    if (Config.getLicenseResource() == null) return true;
    ClassLoader cl = Main.class.getClassLoader();
    URL url = cl.getResource(Config.getLicenseResource());
    if (url == null) return true;

    String license = null;
    try {
      URLConnection con = url.openConnection();
      int size = con.getContentLength();
      byte[] content = new byte[size];
      InputStream in = new BufferedInputStream(con.getInputStream());
      in.read(content);
      license = new String(content);
    } catch (IOException ioe) {
      Config.trace("Got exception when reading " + Config.getLicenseResource() + ": " + ioe);
      return false;
    }

    // Build dialog
    JTextArea ta = new JTextArea(license);
    ta.setEditable(false);
    final JDialog jd = new JDialog(_installerFrame, true);
    Container comp = jd.getContentPane();
    jd.setTitle(Config.getLicenseDialogTitle());
    comp.setLayout(new BorderLayout(10, 10));
    comp.add(new JScrollPane(ta), "Center");
    Box box = new Box(BoxLayout.X_AXIS);
    box.add(box.createHorizontalStrut(10));
    box.add(new JLabel(Config.getLicenseDialogQuestionString()));
    box.add(box.createHorizontalGlue());
    JButton acceptButton = new JButton(Config.getLicenseDialogAcceptString());
    JButton exitButton = new JButton(Config.getLicenseDialogExitString());
    box.add(acceptButton);
    box.add(box.createHorizontalStrut(10));
    box.add(exitButton);
    box.add(box.createHorizontalStrut(10));
    jd.getRootPane().setDefaultButton(acceptButton);
    Box box2 = new Box(BoxLayout.Y_AXIS);
    box2.add(box);
    box2.add(box2.createVerticalStrut(5));
    comp.add(box2, "South");
    jd.pack();

    final boolean accept[] = new boolean[1];
    acceptButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            accept[0] = true;
            jd.hide();
            jd.dispose();
          }
        });

    exitButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            accept[0] = false;
            jd.hide();
            jd.dispose();
          }
        });

    // Apply any defaults the user may have, constraining to the size
    // of the screen, and default (packed) size.
    Rectangle size = new Rectangle(0, 0, 500, 300);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    size.width = Math.min(screenSize.width, size.width);
    size.height = Math.min(screenSize.height, size.height);
    // Center the window
    jd.setBounds(
        (screenSize.width - size.width) / 2,
        (screenSize.height - size.height) / 2,
        size.width,
        size.height);

    // Show dialog
    jd.show();

    return accept[0];
  }