Пример #1
0
 // GUI介面
 public SystemEditReplace_Search() {
   jp.add(jl1);
   jp.add(tf1);
   jp.add(jl2);
   jp.add(tf2);
   jp.add(jb1);
   jb1.addActionListener(this);
   jp.add(jb2);
   jb2.addActionListener(this);
 }
Пример #2
0
    public OptionFrame(JFrame f) {
      super("Options");
      setSize(320, 240);
      setResizable(false);
      options = new JTabbedPane();
      op1 = new JPanel();
      op1.setLayout(new GridLayout(6, 2));
      op1.add(new JLabel("Run:"));
      op1.add(new JTextField());
      op1.add(new JLabel("Reset JVM:"));
      op1.add(new JTextField());
      op1.add(new JLabel("Open options:"));
      op1.add(new JTextField());
      op1.add(new JLabel("Toggle terminal:"));
      op1.add(new JTextField());

      op2 = new JPanel();
      options.addTab("Key bindings", op1);
      options.addTab("Preferences", op2);
      add(options);
      setLocationRelativeTo(f); // Makes this pop up in the center of the frame
      setVisible(true);
    }
Пример #3
0
  /**
   * Constructor for FindDialog
   *
   * @param type
   * @param ta Description of the Parameter
   */
  public FindDialog(JFrame parent, JTextComponent ta) {
    super(parent, "Find in Output", true);
    this.textarea = ta;
    textarea.requestFocus();

    JPanel panel = new JPanel();
    KappaLayout layout = new KappaLayout();
    panel.setLayout(layout);
    panel.setBorder(new javax.swing.border.EmptyBorder(11, 11, 11, 11));
    setContentPane(panel);

    JLabel find_label = new JLabel("Find:");
    final JTextField to_find = new JTextField(20);
    JButton find_btn = new JButton("Find");
    JButton find_next_btn = new JButton("Find Next");
    JButton cancel_btn = new JButton("Close");
    final JCheckBox wrap_cb = new JCheckBox("Wrap search");
    wrap_cb.setSelected(true);

    panel.add(find_label, "0, 0, 1, 1, W, w, 3");
    panel.add(to_find, "0, 1, 1, 1, 0, w, 3");
    panel.add(wrap_cb, "0, 2, 1, 1, 0, w, 3");

    JPanel btn_panel = new JPanel(new KappaLayout());
    btn_panel.add(find_btn, "0, 0, 1, 1, 0, w, 3");
    btn_panel.add(find_next_btn, "0, 1, 1, 1, 0, w, 3");
    btn_panel.add(cancel_btn, "0, 2, 1, 1, 0, w, 3");
    panel.add(btn_panel, "1, 0, 1, 3, 0, h, 5");

    find_btn.addActionListener(new Finder(to_find, textarea, false, wrap_cb.isSelected()));
    find_next_btn.addActionListener(new Finder(to_find, textarea, true, wrap_cb.isSelected()));
    cancel_btn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            setVisible(false);
            dispose();
          }
        });
    pack();
    to_find.requestFocus();
  }
Пример #4
0
  void initComponents() {
    JPanel mainPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f);
    buttonPanel.setBackground(bgColor);
    Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    buttonPanel.setBorder(empty);

    textField = new JTextField(75);
    buttonPanel.add(textField);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchPHI = new JButton("Search PHI");
    searchPHI.addActionListener(this);
    buttonPanel.add(searchPHI);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchTrial = new JButton("Search Trial IDs");
    searchTrial.addActionListener(this);
    buttonPanel.add(searchTrial);

    buttonPanel.add(Box.createHorizontalStrut(20));
    buttonPanel.add(Box.createHorizontalGlue());
    saveAs = new JCheckBox("Save As...");
    saveAs.setBackground(bgColor);
    buttonPanel.add(saveAs);

    mainPanel.add(buttonPanel, BorderLayout.NORTH);

    JScrollPane scrollPane = new JScrollPane();
    textPane = new ColorPane();
    // textPane.setEditable(false);
    scrollPane.setViewportView(textPane);
    mainPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel footerPanel = new JPanel();
    footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS));
    footerPanel.setBackground(bgColor);
    message = new JLabel("Ready...");
    footerPanel.add(message);
    mainPanel.add(footerPanel, BorderLayout.SOUTH);

    setTitle(windowTitle);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    pack();
    centerFrame();
  }
Пример #5
0
 void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(10, 10, 5, 5);
   panel1.setLayout(borderLayout1);
   jPanel1.setLayout(borderLayout2);
   jScrollPane1.getViewport().setBackground(Color.white);
   jPanel2.setLayout(gridBagLayout1);
   jLabel1.setText("Profile Name : ");
   nameTextField.setMinimumSize(new Dimension(4, 18));
   nameTextField.setPreferredSize(new Dimension(63, 18));
   jLabel2.setText("Profile Type : ");
   openButton.setMaximumSize(new Dimension(73, 24));
   openButton.setMinimumSize(new Dimension(73, 24));
   openButton.setPreferredSize(new Dimension(73, 24));
   openButton.setText("Open");
   openButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           openButton_actionPerformed(e);
         }
       });
   cancelButton.setMaximumSize(new Dimension(73, 24));
   cancelButton.setMinimumSize(new Dimension(73, 24));
   cancelButton.setPreferredSize(new Dimension(73, 24));
   cancelButton.setMargin(new Insets(0, 5, 0, 5));
   cancelButton.setText("Cancel");
   cancelButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           cancelButton_actionPerformed(e);
         }
       });
   profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   profileList.addMouseListener(
       new java.awt.event.MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           profileList_mouseClicked(e);
         }
       });
   jPanel2.setBorder(border1);
   typeComboBox.setMaximumSize(new Dimension(32767, 18));
   typeComboBox.setMinimumSize(new Dimension(122, 18));
   typeComboBox.setPreferredSize(new Dimension(176, 18));
   getContentPane().add(panel1);
   panel1.add(jPanel1, BorderLayout.CENTER);
   jPanel1.add(jScrollPane1, BorderLayout.CENTER);
   panel1.add(jPanel2, BorderLayout.SOUTH);
   jPanel2.add(
       jLabel1,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 7, 0),
           0,
           0));
   jPanel2.add(
       nameTextField,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 11, 7, 0),
           0,
           0));
   jPanel2.add(
       jLabel2,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 17, 0),
           0,
           0));
   jScrollPane1.getViewport().add(profileList, null);
   jPanel2.add(
       openButton,
       new GridBagConstraints(
           3,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 11, 2, 10),
           0,
           0));
   jPanel2.add(
       cancelButton,
       new GridBagConstraints(
           3,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 11, 9, 10),
           0,
           0));
   jPanel2.add(
       typeComboBox,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 11, 17, 0),
           0,
           0));
 }