예제 #1
0
  /** Create the panel. */
  public DictionaryPane() {
    setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    add(panel, BorderLayout.SOUTH);
    panel.setLayout(new BorderLayout(0, 0));

    JPanel panel_1 = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel_1.getLayout();
    flowLayout.setAlignment(FlowLayout.LEADING);
    panel.add(panel_1, BorderLayout.CENTER);

    JButton btnNewButton = new JButton("Add word");
    panel_1.add(btnNewButton);

    JButton btnRemoveWord = new JButton("Remove word");
    panel_1.add(btnRemoveWord);

    JPanel panel_2 = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) panel_2.getLayout();
    flowLayout_1.setAlignment(FlowLayout.TRAILING);
    panel.add(panel_2, BorderLayout.EAST);

    JButton btnNewButton_1 = new JButton("Save");
    panel_2.add(btnNewButton_1);

    JPanel panel_3 = new JPanel();
    panel_3.setBorder(new EmptyBorder(5, 5, 0, 5));
    add(panel_3, BorderLayout.CENTER);
    panel_3.setLayout(new BorderLayout(0, 0));

    list = new JList<String>();
    panel_3.add(list);
  }
예제 #2
0
 /**
  * Switches views based on the passed enum.
  *
  * @param v the View to switch to
  * @param o A BattleField if switching to BattleView.
  */
 public void changeView(Views v, Object o) {
   switch (v) {
     case PREVIOUS:
       CardLayout cl = (CardLayout) body.getLayout();
       JPanel temp = currentPanel;
       panels.pop();
       currentPanel = panels.peek();
       cl.show(body, currentPanel.toString());
       cl.removeLayoutComponent(temp);
       break;
     case BATTLE:
       currentPanel = new BattleView(this, (BattleField) o);
       panels.push(currentPanel);
       body.add(currentPanel, v.name());
       CardLayout cl1 = (CardLayout) body.getLayout();
       cl1.show(body, v.name());
       for (Component c : body.getComponents()) {
         if (c == currentPanel) {
           c.requestFocusInWindow();
         }
       }
       break;
     case TITLE:
       currentPanel = new TitleView(this);
       panels.push(currentPanel);
       body.add(currentPanel, v.name());
       CardLayout cl2 = (CardLayout) body.getLayout();
       cl2.show(body, v.name());
       break;
     default:
       // Do nothing
   }
 }
예제 #3
0
 public void actionPerformed(ActionEvent ae) {
   Object source = ae.getSource();
   String actionCommand = ae.getActionCommand();
   if (actionCommand.equals("Cancel")) {
     System.exit(0);
   } else if (actionCommand.equals("<< Back")) {
     if (((JButton) source).isEnabled()) {
       ((CardLayout) modulePanel.getLayout()).previous(modulePanel);
       currentModuleNumber--;
       if (currentModuleNumber == 0) {
         backButton.setEnabled(false);
       }
       if (currentModuleNumber < (moduleCount - 1)) {
         nextButton.setEnabled(true);
         finishButton.setEnabled(false);
       }
     }
   } else if (actionCommand.equals("Next >>")) {
     if (((JButton) source).isEnabled()) {
       if (!verifyAndSaveCurrent()) return;
       ((CardLayout) modulePanel.getLayout()).next(modulePanel);
       currentModuleNumber++;
       if (currentModuleNumber == (moduleCount - 1)) {
         nextButton.setEnabled(false);
         finishButton.setEnabled(true);
       }
       if (currentModuleNumber > 0) {
         backButton.setEnabled(true);
       }
     }
   } else if (actionCommand.equals("Finish")) {
     if (!verifyAndSaveCurrent()) return;
     saveSettings();
   }
 }
예제 #4
0
  private JComponent createTabForSession(MemoryLogModel memoryLogModel) {

    ViewModel viewModel = new ViewModel(memoryLogModel);

    JComponent rawTable = createRawMessageTable(viewModel);
    JComponent crackedTable = createCrackedMessageTable(viewModel);

    JSplitPane messageView = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    messageView.setBorder(null);

    messageView.setLeftComponent(new JScrollPane(rawTable));
    messageView.setRightComponent(new JScrollPane(crackedTable));

    JSplitPane messageAndEventView = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    messageAndEventView.setResizeWeight(.66);
    messageAndEventView.setLeftComponent(messageView);
    messageAndEventView.setRightComponent(new JScrollPane(createEventMessageTable(viewModel)));
    messageAndEventView.setBorder(null);

    JPanel mainView = new JPanel(new BorderLayout());
    mainView.add(messageAndEventView, BorderLayout.CENTER);

    // @todo - wrap the filter component in a "view builder". This will eliminate
    // the cast and provide the ability to change the layout without junking up
    // builder.
    JTextField filterField = new MessageSearchField();

    FilterList<LogMessage> messages = ((GlazedListsMemoryLogModel) memoryLogModel).getMessages();

    EventList matchers = new BasicEventList();

    TextComponentMatcherEditor<LogMessage> liveSearchMatcherEditor =
        new TextComponentMatcherEditor<LogMessage>(filterField, new MessageFilterator());
    matchers.add(liveSearchMatcherEditor);
    MatcherEditor matcherEditor = new CompositeMatcherEditor(matchers);
    messages.setMatcherEditor(matcherEditor);

    JPanel sortPanel = new JPanel();
    ((FlowLayout) sortPanel.getLayout()).setAlignment(FlowLayout.LEFT);
    JCheckBox sortCheckbox = new JCheckBox("Keep New Messages At The Top");
    sortPanel.add(sortCheckbox);
    sortCheckbox.addActionListener(viewModel.getSortByMessageIndexActionListener());

    JCheckBox hideHeartbeats = new JCheckBox("Hide Heartbeats");
    sortPanel.add(hideHeartbeats);
    hideHeartbeats.addActionListener(viewModel.getHideHeartbeatsActionListener());

    JPanel filterPanel = new JPanel();
    ((FlowLayout) filterPanel.getLayout()).setAlignment(FlowLayout.RIGHT);
    filterPanel.add(new JLabel("Search:"));
    filterPanel.add(filterField);

    JPanel northPanel = new JPanel(new BorderLayout());
    northPanel.add(sortPanel, BorderLayout.WEST);
    northPanel.add(filterPanel, BorderLayout.EAST);
    mainView.add(northPanel, BorderLayout.NORTH);

    return mainView;
  }
 public void testGridBagLayout() throws Exception {
   JPanel panel = (JPanel) getInstrumentedRootComponent("TestGridBag.form", "BindingTest");
   assertTrue(panel.getLayout() instanceof GridBagLayout);
   GridBagLayout gridBag = (GridBagLayout) panel.getLayout();
   JButton btn = (JButton) panel.getComponent(0);
   GridBagConstraints gbc = gridBag.getConstraints(btn);
   assertNotNull(gbc);
   assertEquals(2, gbc.gridheight);
   assertEquals(2, gbc.gridwidth);
   assertEquals(1.0, gbc.weightx, 0.01);
   assertEquals(new Insets(1, 2, 3, 4), gbc.insets);
   assertEquals(GridBagConstraints.HORIZONTAL, gbc.fill);
   assertEquals(GridBagConstraints.NORTHWEST, gbc.anchor);
 }
  public void testGridBagSpacer() throws Exception {
    JPanel panel = (JPanel) getInstrumentedRootComponent("TestGridBagSpacer.form", "BindingTest");
    assertTrue(panel.getLayout() instanceof GridBagLayout);
    assertTrue(panel.getComponent(0) instanceof JLabel);
    assertTrue(panel.getComponent(1) instanceof JPanel);

    GridBagLayout gridBag = (GridBagLayout) panel.getLayout();
    GridBagConstraints gbc = gridBag.getConstraints(panel.getComponent(0));
    assertEquals(0.0, gbc.weightx, 0.01);
    assertEquals(0.0, gbc.weighty, 0.01);
    gbc = gridBag.getConstraints(panel.getComponent(1));
    assertEquals(0.0, gbc.weightx, 0.01);
    assertEquals(1.0, gbc.weighty, 0.01);
  }
예제 #7
0
  /** Creates the ui. */
  private void createUI() {
    JPanel panel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel.getLayout();
    flowLayout.setAlignment(FlowLayout.TRAILING);
    getContentPane().add(panel, BorderLayout.SOUTH);

    JButton btnOk = new JButton(Localisation.getString(ExpressionPanelv2.class, "common.ok"));
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            okButtonPressed = true;

            setVisible(false);
          }
        });
    panel.add(btnOk);

    JButton btnCancel =
        new JButton(Localisation.getString(ExpressionPanelv2.class, "common.cancel"));
    btnCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            okButtonPressed = false;

            setVisible(false);
          }
        });
    panel.add(btnCancel);
  }
  private void backJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_backJButtonActionPerformed

    userProcessContainer.remove(this);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.previous(userProcessContainer);
  } // GEN-LAST:event_backJButtonActionPerformed
 private void jButton1ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
   // TODO add your handling code here:
   upcJPanel.remove(this);
   CardLayout card = (CardLayout) upcJPanel.getLayout();
   card.previous(upcJPanel);
 } // GEN-LAST:event_jButton1ActionPerformed
예제 #10
0
  public void drawParams() {
    if (monParams.size() > 0) {
      SpringUtilities.makeCompactGrid(monPanel, monParams.size(), 2, 6, 6, 6, 6);
      SpringLayout sl = (SpringLayout) monPanel.getLayout();
      Dimension d = sl.minimumLayoutSize(monPanel);
      monPanel.setSize(d);
    }
    if (steerParams.size() > 0) {
      SpringUtilities.makeCompactGrid(steerPanel, steerParams.size(), 3, 6, 6, 6, 6);
      SpringLayout sl = (SpringLayout) steerPanel.getLayout();
      Dimension d = sl.minimumLayoutSize(steerPanel);
      steerPanel.setSize(d);
    }

    tabs.insertTab("Parameters", null, paramPanel, "", 0);
  }
예제 #11
0
  public void initializeGUIComponents() {

    // Setup Data Panel
    editButton = new JButton("Edit");
    editButton.addActionListener(buttonController);
    JPanel buttonPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.RIGHT);
    buttonPanel.add(editButton);
    buttonPanel.add(Box.createHorizontalStrut(10));

    // Setup the Main Panel.
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Skills"));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    // Setup TextField
    scrollPane = new JScrollPane();
    taSkills = new JTextArea();
    taSkills.setLineWrap(true);
    taSkills.setWrapStyleWord(true);
    taSkills.setEditable(false);
    scrollPane.setViewportView(taSkills);

    add(scrollPane);
    add(buttonPanel);
  }
예제 #12
0
  public void showCard(final String name, final Trait trait) {
    CardLayout layout = (CardLayout) innerPanel.getLayout();
    layout.show(innerPanel, name);
    boolean b = cardMap.get(name) instanceof TraitDetail;
    buttonsPanel.setVisible(b);

    TraitDetail newDetail = null;
    if (b) {
      newDetail = (TraitDetail) cardMap.get(name);
    }
    for (JComponent v : cardMap.values()) {
      if (v instanceof TraitDetail) {
        if (v != newDetail) {
          TraitDetail oldDetail = (TraitDetail) v;
          oldDetail.setActive(false);
        }
      }
    }
    if (newDetail != null) {
      newDetail.setActive(true);
    }

    selectedCard = name;
    selectedLabel.setText(selectedCard);
    if (trait == null) {
      traitNameLabel.setText("-");
    } else {
      if (abcPanel != null) {
        traitNameLabel.setText(
            trait.getName(abcPanel.abc).getName(abcPanel.abc.constants, null, false));
      }
    }
  }
예제 #13
0
  public void updateComponents() {
    try {
      CardLayout cl = (CardLayout) (wizardPanelsContainer.getLayout());
      cl.show(wizardPanelsContainer, currentIndex + "");

      if (currentIndex == 0) {
        backButton.setEnabled(false);
      } else {
        backButton.setEnabled(true);
      }

      if (onLastPanel()) {
        nextButton.setEnabled(false);
        finishButton.setEnabled(true);
      } else {
        finishButton.setEnabled(false);
        nextButton.setEnabled(true);
      }
      // let panel to update itself
      getCurrentPanel().update();

      // inform PropertyChangeListeners
      PropertyChangeEvent event =
          new PropertyChangeEvent(
              this, WizardComponents.CURRENT_PANEL_PROPERTY, null, getCurrentPanel());
      propertyChangeListeners.firePropertyChange(event);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 private void backButton4ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_backButton4ActionPerformed
   // TODO add your handling code here:
   userProcessContainer.remove(this);
   CardLayout layout = (CardLayout) userProcessContainer.getLayout();
   layout.previous(userProcessContainer);
 } // GEN-LAST:event_backButton4ActionPerformed
예제 #15
0
  public TasksPanelBase() {
    setLayout(new BorderLayout(0, 0));

    panel = new JPanel();
    panel.setBorder(
        new TitledBorder(null, "Tasks", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel, BorderLayout.CENTER);
    panel.setOpaque(false);
    panel.setLayout(new BorderLayout(0, 0));

    scrollPane = new JScrollPane();
    scrollPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panel.add(scrollPane, BorderLayout.CENTER);

    taskList = new JList();
    taskList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    taskList.setCellRenderer(new TaskListRenderer());
    scrollPane.setViewportView(taskList);

    buttonPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    flowLayout.setAlignment(FlowLayout.RIGHT);
    panel.add(buttonPanel, BorderLayout.SOUTH);

    deleteButton = new JButton("");
    deleteButton.setActionCommand("delete");
    deleteButton.setIcon(
        new ImageIcon(TasksPanelBase.class.getResource("/resources/icons/delete.png")));
    buttonPanel.add(deleteButton);
  }
예제 #16
0
 private void manageEntAdminBtnActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_manageEntAdminBtnActionPerformed
   // TODO add your handling code here:
   ManageEnterpriseAdminJPanel meajp = new ManageEnterpriseAdminJPanel(upc, system);
   upc.add("ManageEnterpriseAdminJPanel", meajp);
   CardLayout layout = (CardLayout) upc.getLayout();
   layout.next(upc);
 } // GEN-LAST:event_manageEntAdminBtnActionPerformed
 private void jButton2ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton2ActionPerformed
   DoctorHomepageAreaJPanel doctorReportMedicationJPanel =
       new DoctorHomepageAreaJPanel(container, ua, o, e, ecoSystem);
   CardLayout cl = (CardLayout) container.getLayout();
   container.add("doctorReportMedicationJPanel", doctorReportMedicationJPanel);
   cl.next(container);
 } // GEN-LAST:event_jButton2ActionPerformed
 private void addPatientJButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addPatientJButtonActionPerformed
   // TODO add your handling code here:
   AddPatient ap = new AddPatient(userProcessContainer, enterprise);
   userProcessContainer.add("Add Patient", ap);
   CardLayout layout = (CardLayout) userProcessContainer.getLayout();
   layout.next(userProcessContainer);
 } // GEN-LAST:event_addPatientJButtonActionPerformed
예제 #19
0
 private void viewStatusjButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_viewStatusjButtonActionPerformed
   // TODO add your handling code here:
   ViewStatusJPanel vsjp = new ViewStatusJPanel(userProcessContainer, system, nn);
   userProcessContainer.add("ViewStatusJPanel", vsjp);
   CardLayout layout = (CardLayout) userProcessContainer.getLayout();
   layout.next(userProcessContainer);
 } // GEN-LAST:event_viewStatusjButtonActionPerformed
  private void manageNetworkJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_manageNetworkJButtonActionPerformed

    ManageNetworkJPanel manageNetworkJPanel = new ManageNetworkJPanel(userProcessContainer, system);
    userProcessContainer.add("manageNetworkJPanel", manageNetworkJPanel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
  } // GEN-LAST:event_manageNetworkJButtonActionPerformed
  private void manageOrganizationJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_manageOrganizationJButtonActionPerformed

    ManageOrganizationJPanel manageOrganizationJPanel =
        new ManageOrganizationJPanel(userProcessContainer, enterprise.getOrganizationDirectory());
    userProcessContainer.add("manageOrganizationJPanel", manageOrganizationJPanel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
  } // GEN-LAST:event_manageOrganizationJButtonActionPerformed
 private void btnSendEmailActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSendEmailActionPerformed
   // TODO add your handling code here:
   ComposeEmailJPanel frame =
       new ComposeEmailJPanel(userProcessContainer, userAccount, enterprise);
   userProcessContainer.add("ComposeEmailJPanel", frame);
   CardLayout layout = (CardLayout) userProcessContainer.getLayout();
   layout.next(userProcessContainer);
 } // GEN-LAST:event_btnSendEmailActionPerformed
 private void btnEventScheduleActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnEventScheduleActionPerformed
   // TODO add your handling code here:
   ScheduleEventsJPanel sejp =
       new ScheduleEventsJPanel(userProcessContainer, userAccount, coordOrg, enterprise);
   userProcessContainer.add("ScheduleEventsJPanel", sejp);
   CardLayout layout = (CardLayout) userProcessContainer.getLayout();
   layout.next(userProcessContainer);
 } // GEN-LAST:event_btnEventScheduleActionPerformed
  private void manageOrganizationJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_manageOrganizationJButtonActionPerformed
    // TODO add your handling code here:
    ManagePhdOrganizations panel = new ManagePhdOrganizations(userProcessContainer, enterprise);

    userProcessContainer.add("ManagePhdOrganization", panel);
    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
  } // GEN-LAST:event_manageOrganizationJButtonActionPerformed
 private void checkjButton2ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_checkjButton2ActionPerformed
   // TODO add your handling code here:
   CheckStatusPjPanel checkStatuJPanel =
       new CheckStatusPjPanel(container, ua, enterprise, ecoSystem, patientorg);
   CardLayout cl = (CardLayout) container.getLayout();
   container.add("setMessageJPanel", checkStatuJPanel);
   cl.next(container);
 } // GEN-LAST:event_checkjButton2ActionPerformed
 private void reportjButton1ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_reportjButton1ActionPerformed
   // TODO add your handling code here:
   StartReportErrorJPanel patientinfoJPanel =
       new StartReportErrorJPanel(container, ua, patientorg, enterprise, ecoSystem);
   CardLayout cl = (CardLayout) container.getLayout();
   container.add("dirjp", patientinfoJPanel);
   cl.next(container);
 } // GEN-LAST:event_reportjButton1ActionPerformed
 private void manageAdminJButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_manageAdminJButtonActionPerformed
   // TODO add your handling code here:
   ManageEnterpriseAdminJPanel manageEnterpriseAdminJPanel =
       new ManageEnterpriseAdminJPanel(userProcessContainer, system);
   userProcessContainer.add("manageEnterpriseAdminJPanel", manageEnterpriseAdminJPanel);
   CardLayout layout = (CardLayout) userProcessContainer.getLayout();
   layout.next(userProcessContainer);
 } // GEN-LAST:event_manageAdminJButtonActionPerformed
예제 #28
0
 private void showStepComponent(final Component component) {
   String id = myComponentToIdMap.get(component);
   if (id == null) {
     id = addStepComponent(component);
     myContentPanel.revalidate();
     myContentPanel.repaint();
   }
   ((CardLayout) myContentPanel.getLayout()).show(myContentPanel, id);
 }
  private void addsupplierjButton3ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addsupplierjButton3ActionPerformed

    AddSupplierJPanel asjp = new AddSupplierJPanel(userProcessContainer, supplierDir);
    userProcessContainer.add("AddSupplierJPanel", asjp);

    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
  } // GEN-LAST:event_addsupplierjButton3ActionPerformed
  private void userJButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_userJButtonActionPerformed
    // TODO add your handling code here:
    ManageUserAccountJPanel d1 =
        new ManageUserAccountJPanel(userProcessContainer, enterprise, system);
    userProcessContainer.add("d1", d1);

    CardLayout layout = (CardLayout) userProcessContainer.getLayout();
    layout.next(userProcessContainer);
  } // GEN-LAST:event_userJButtonActionPerformed