コード例 #1
0
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the ok button
   if (e.getSource() == ok_button) {
     filter_include_list = include_panel.getServiceList();
     filter_exclude_list = exclude_panel.getServiceList();
     if (status_box.isSelected()) {
       filter_active = status_active.isSelected();
       filter_complete = status_complete.isSelected();
     } else {
       filter_active = false;
       filter_complete = false;
     }
     ok_pressed = true;
     dialog.dispose();
   }
   // Check if the user pressed the cancel button
   if (e.getSource() == cancel_button) {
     dialog.dispose();
   }
   // Check if the user changed the status filter option
   if (e.getSource() == status_box) {
     status_active.setEnabled(status_box.isSelected());
     status_complete.setEnabled(status_box.isSelected());
   }
 }
コード例 #2
0
ファイル: SwingTableDemo.java プロジェクト: trabbis/test3
  // This handles the row, column, and cell selection buttons.
  public void actionPerformed(ActionEvent ie) {

    // See which button is selected.
    if (jrbRows.isSelected()) {
      // Enable row selection.
      jtabOrders.setColumnSelectionAllowed(false);
      jtabOrders.setRowSelectionAllowed(true);
    } else if (jrbColumns.isSelected()) {
      // Enable column selection.
      jtabOrders.setColumnSelectionAllowed(true);
      jtabOrders.setRowSelectionAllowed(false);
    } else {
      // Enable cell selection.
      jtabOrders.setCellSelectionEnabled(true);
    }
  }
コード例 #3
0
 /** 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();
 }
コード例 #4
0
ファイル: SwingTableDemo.java プロジェクト: trabbis/test3
  SwingTableDemo() {

    // Create a new JFrame container.
    JFrame jfrm = new JFrame("JTable Demo");

    // Specify FlowLayout for the layout manager.
    jfrm.setLayout(new FlowLayout());

    // Give the frame an initial size.
    jfrm.setSize(460, 180);

    // Terminate the program when the user closes the application.
    jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create a table that displays order data.
    jtabOrders = new JTable(data, headings);

    // Wrap the table in a scroll pane.
    JScrollPane jscrlp = new JScrollPane(jtabOrders);

    // Set the scrollable viewport size.
    jtabOrders.setPreferredScrollableViewportSize(new Dimension(420, 62));

    // Create the radio buttons that determine
    // what type of selections are allowed.
    jrbRows = new JRadioButton("Select Rows", true);
    jrbColumns = new JRadioButton("Select Columns");
    jrbCells = new JRadioButton("Select Cells");

    // Add the radio buttons to a group.
    ButtonGroup bg = new ButtonGroup();
    bg.add(jrbRows);
    bg.add(jrbColumns);
    bg.add(jrbCells);

    // Radio button events are handled in common by the
    // actionPerformed() method implemented by TableDemo.
    jrbRows.addActionListener(this);
    jrbColumns.addActionListener(this);
    jrbCells.addActionListener(this);

    // Create the Single Selection Mode check box.
    // When checked, only single selections are allowed.
    jcbSingle = new JCheckBox("Single Selection Mode");

    // Add item listener for jcbSingle.
    jcbSingle.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent ie) {
            if (jcbSingle.isSelected())
              // Allow single selections.
              jtabOrders.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            else
              // Allow multiple selections.
              jtabOrders.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
          }
        });

    // Add the components to the content pane.
    jfrm.add(jscrlp);
    jfrm.add(jrbRows);
    jfrm.add(jrbColumns);
    jfrm.add(jrbCells);
    jfrm.add(jcbSingle);

    // Display the frame.
    jfrm.setVisible(true);
  }
コード例 #5
0
 String getOperator() {
   String operator;
   if (m_andRadioBt.isSelected()) operator = " AND ";
   else operator = " OR ";
   return operator;
 }
コード例 #6
0
  JPanel criteriaPanel() {
    int height = getHeightPanel(m_field);

    m_table = new SearchTable(m_field);
    m_statusComboBox = new JComboBox(new Object[] {"Active", "Retired", "All"});
    m_andRadioBt = new JRadioButton("and");
    m_andRadioBt.setSelected(true);
    m_orRadioBt = new JRadioButton("or");

    m_containsRadioBt = new JRadioButton("Text Contains Criteria");
    m_containsRadioBt.setSelected(true);
    m_matchRadioBt = new JRadioButton("Match Case");
    m_wholeRadioBt = new JRadioButton("Find Whole Words only");
    m_findBt = new JButton("Find");
    m_findBt.addActionListener(this);
    m_closeBt = new JButton("Close");
    m_closeBt.addActionListener(this);
    m_clearBt = new JButton("Clear");
    m_clearBt.addActionListener(this);

    ButtonGroup bg = new ButtonGroup();
    bg.add(m_andRadioBt);
    bg.add(m_orRadioBt);

    ButtonGroup bg2 = new ButtonGroup();
    bg2.add(m_containsRadioBt);
    bg2.add(m_matchRadioBt);
    bg2.add(m_wholeRadioBt);

    JPanel centerPanel = new JPanel();
    JPanel criteriaPanel = new JPanel();
    JPanel buttonPanel = new JPanel();
    JPanel operatorPanel = new JPanel();
    JPanel optionPanel = new JPanel();
    JScrollPane scrollPane = new JScrollPane();
    GridBagConstraints gridBagConstraints;

    scrollPane.setPreferredSize(new Dimension(100, height));
    scrollPane.getViewport().add(m_table);

    operatorPanel.setLayout(new GridLayout(2, 1));
    operatorPanel.add(m_andRadioBt);
    operatorPanel.add(m_orRadioBt);
    setBorder(operatorPanel, "Search Operator");

    optionPanel.setLayout(new GridLayout(3, 1));
    optionPanel.add(m_containsRadioBt);
    optionPanel.add(m_matchRadioBt);
    optionPanel.add(m_wholeRadioBt);
    setBorder(optionPanel, "Option");

    criteriaPanel.setLayout(new GridBagLayout());
    gridBagConstraints = new GridBagConstraints();

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.insets = new Insets(1, 0, 2, 0);
    gridBagConstraints.weightx = 1.0;
    // criteriaPanel.add(new JLabel("Search Criterion"), gridBagConstraints);
    setBorder(criteriaPanel, "Search Criterion");

    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new Insets(1, 0, 5, 0);
    criteriaPanel.add(scrollPane, gridBagConstraints);

    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = new Insets(1, 0, 2, 0);
    // criteriaPanel.add(new JLabel("Search Operator"), gridBagConstraints);

    gridBagConstraints.gridy = 3;
    gridBagConstraints.insets = new Insets(1, 0, 5, 0);
    criteriaPanel.add(operatorPanel, gridBagConstraints);

    gridBagConstraints.gridy = 4;
    gridBagConstraints.insets = new Insets(1, 0, 2, 0);

    gridBagConstraints.gridy = 5;
    criteriaPanel.add(optionPanel, gridBagConstraints);

    gridBagConstraints.gridy = 6;
    criteriaPanel.add(buttonPanel, gridBagConstraints);

    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(m_findBt);
    buttonPanel.add(m_closeBt);
    buttonPanel.add(m_clearBt);

    centerPanel.setLayout(new BorderLayout());
    centerPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    centerPanel.add(criteriaPanel, BorderLayout.NORTH);
    // centerPanel.add(buttonPanel, BorderLayout.SOUTH);

    return centerPanel;
  }