예제 #1
0
 /**
  * Action of family radio button MultisensorItemPanel {@literal &} IndicatorTOItem must overrides
  */
 protected void setFamily(String family) {
   _family = family;
   if (log.isDebugEnabled()) {
     log.debug("setFamily: for type \"" + _itemType + "\", family \"" + family + "\"");
   }
   _iconFamilyPanel.remove(_iconPanel);
   _iconPanel = new JPanel(new FlowLayout());
   _iconFamilyPanel.add(_iconPanel, 0);
   HashMap<String, NamedIcon> map = ItemPalette.getIconMap(_itemType, _family);
   if (map != null) {
     _currentIconMap = map;
   }
   if (!_supressDragging) {
     _iconFamilyPanel.remove(_dragIconPanel);
     _dragIconPanel = new JPanel(new FlowLayout());
     _iconFamilyPanel.add(_dragIconPanel, 0);
     makeDndIconPanel(_currentIconMap, "BeanStateUnknown");
   }
   addIconsToPanel(_currentIconMap);
   _iconFamilyPanel.invalidate();
   hideIcons();
   Enumeration<AbstractButton> en = _familyButtonGroup.getElements();
   while (en.hasMoreElements()) {
     JRadioButton but = (JRadioButton) en.nextElement();
     if (_family != null && _family.equals(but.getText())) {
       but.setSelected(true);
       break;
     }
   }
 }
예제 #2
0
  private void updateUIWithFindModel() {
    boolean needToResetSearchFocus = mySearchTextComponent.hasFocus();
    boolean needToResetReplaceFocus = myReplaceTextComponent.hasFocus();
    updateSearchComponent();
    updateReplaceComponent();
    if (myFindModel.isReplaceState()) {
      if (myReplaceFieldWrapper.getParent() == null) {
        myLeftPanel.add(myReplaceFieldWrapper, BorderLayout.CENTER);
      }
      if (myReplaceToolbarWrapper.getParent() == null) {
        myRightPanel.add(myReplaceToolbarWrapper, BorderLayout.CENTER);
      }
      if (needToResetReplaceFocus) {
        myReplaceTextComponent.requestFocusInWindow();
      }
    } else {
      if (myReplaceFieldWrapper.getParent() != null) {
        myLeftPanel.remove(myReplaceFieldWrapper);
      }
      if (myReplaceToolbarWrapper.getParent() != null) {
        myRightPanel.remove(myReplaceToolbarWrapper);
      }
    }
    if (needToResetSearchFocus) mySearchTextComponent.requestFocusInWindow();
    mySearchActionsToolbar1.updateActionsImmediately();
    mySearchActionsToolbar2.updateActionsImmediately();
    myReplaceActionsToolbar1.updateActionsImmediately();
    myReplaceActionsToolbar2.updateActionsImmediately();
    myReplaceToolbarWrapper.revalidate();
    revalidate();
    repaint();

    myLivePreviewController.setTrackingSelection(!myFindModel.isGlobal());
  }
  private void setHeaderComponent(JComponent c) {
    boolean doRevalidate = false;
    if (myHeaderComponent != null) {
      myHeaderPanel.remove(myHeaderComponent);
      myHeaderPanel.add(myCaption, BorderLayout.NORTH);
      myHeaderComponent = null;
      doRevalidate = true;
    }

    if (c != null) {
      myHeaderPanel.remove(myCaption);
      myHeaderPanel.add(c, BorderLayout.NORTH);
      myHeaderComponent = c;

      final Dimension size = myContent.getSize();
      if (size.height < c.getPreferredSize().height * 2) {
        size.height += c.getPreferredSize().height;
        setSize(size);
      }

      doRevalidate = true;
    }

    if (doRevalidate) myContent.revalidate();
  }
 @Override
 public void delete() {
   getInnerView().delete();
   traitViewPanel.remove(innerViewPanel);
   traitViewPanel.remove(button.getComponent());
   traitViewPanel.revalidate();
 }
예제 #5
0
파일: NXFrame.java 프로젝트: rhwood/JMRI
 private void enableAuto(boolean enable) {
   Component[] comps = _controlPanel.getComponents();
   if (enable) {
     int idx = 0;
     while (idx < comps.length) {
       if (comps[idx].equals(_manualPanel)) {
         break;
       }
       idx++;
     }
     _controlPanel.remove(idx);
     _autoRunPanel =
         makeAutoRunPanel(
             jmri.InstanceManager.getDefault(SignalSpeedMap.class).getInterpretation());
     _controlPanel.add(_autoRunPanel, idx);
   } else {
     int idx = 0;
     while (idx < comps.length) {
       if (comps[idx].equals(_autoRunPanel)) {
         break;
       }
       idx++;
     }
     _controlPanel.remove(idx);
     _manualPanel = makeTrainIdPanel(null);
     _controlPanel.add(_manualPanel, idx);
   }
   pack();
 }
 private void removeInstanceList(InstanceListPane listPane) {
   SectionTitlePane titlePane = (SectionTitlePane) listToTitle.get(listPane);
   centerPane.remove(titlePane);
   centerPane.remove(listPane);
   centerPane.validate();
   centerPane.repaint();
   listToTitle.remove(listPane);
 }
예제 #7
0
 public void hide(boolean refresh) {
   container.remove(layout);
   if (showMeasurements.isSelected()) {
     container.remove(measurements);
     showMeasurements.setSelected(false);
   }
   if (refresh) core.refreshDisplay();
 }
예제 #8
0
 public void blankScreen() {
   int numc = calCorrectAnswer();
   lblmess.setText("Your score is: " + numc + "/10");
   panel.remove(choice1);
   panel.remove(choice2);
   panel.remove(choice3);
   panel.remove(choice4);
   btnext.setText("Try again");
 }
예제 #9
0
 @Override
 public void delete() {
   traitPanel.remove(abilityLabel);
   traitPanel.remove(separatorLabel);
   traitPanel.remove(specialtyLabel);
   traitPanel.remove(getValueDisplay().getComponent());
   traitPanel.remove(deleteButton);
   traitPanel.revalidate(); // Remove this line to keep the positions of specialties constant.
   traitPanel.repaint();
 }
예제 #10
0
 public void reduceComponentElementPanel() {
   if (isExpanded) {
     m_element.data.put(IS_EXPANDED_KEY, Boolean.FALSE);
     isExpanded = false;
     setHeaderLabel();
     expandButton.setIcon(plus);
     containingPanel.remove(componentElementPanel);
     if (CompositeElementEditor.IS_JAVA) {
       containingPanel.remove(closeBrace);
     }
     revalidate();
     // this.repaint();
   }
 }
 private void updateMacroListEditor(boolean isStructure) {
   if (mIsStructure != isStructure) {
     mIsStructure = isStructure;
     if (isStructure) {
       String[] idcodeList = mTextArea.getText().split("\\n");
       if (mStructurePane == null) {
         DefaultCompoundCollectionModel.IDCode collectionModel =
             new DefaultCompoundCollectionModel.IDCode();
         mStructurePane = new CompoundCollectionPane<String>(collectionModel, true);
         mStructurePane.setSelectable(true);
         mStructurePane.setEditable(true);
         mStructurePane.setClipboardHandler(new ClipboardHandler());
         mStructurePane.setShowValidationError(true);
         mStructurePane.setStructureSize(80);
         mStructurePane.setPreferredSize(
             new Dimension(240, Math.max(240, Math.min(640, 80 * idcodeList.length))));
         mStructurePane.setEnabled(mRadioButton.isSelected() && !mRadioButtonSort.isSelected());
       }
       mStructurePane.getModel().clear();
       StereoMolecule mol = new StereoMolecule();
       for (String idcode : idcodeList) {
         try {
           idcode = idcode.trim();
           if (idcode.length() != 0) {
             new IDCodeParser().parse(mol, idcode); // test validity of idcode
             mStructurePane.getModel().addCompound(idcode);
           }
         } catch (Exception e) {
         }
       }
       mDialogPanel.remove(mScrollPane);
       mDialogPanel.add(mStructurePane, "1,7,3,7");
       mDialogPanel.validate();
       getDialog().pack();
     } else {
       StringBuilder sb = new StringBuilder();
       for (int i = 0; i < mStructurePane.getModel().getSize(); i++) {
         sb.append(mStructurePane.getModel().getCompound(i));
         sb.append('\n');
       }
       mTextArea.setText(sb.toString());
       mDialogPanel.remove(mStructurePane);
       mDialogPanel.add(mScrollPane, "1,7,3,7");
       mDialogPanel.validate();
       getDialog().pack();
       mScrollPane.repaint();
     }
   }
 }
 public void removeFromSlot(TabSlot slot, Display content) {
   switch (slot) {
     case ATTACHMENTS:
       attachments.remove(convertDisplay(content).asComponent());
       break;
     case SUBSCRIBERS:
       subscribers.remove(convertDisplay(content).asComponent());
       break;
     case LINKS:
       links.remove(convertDisplay(content).asComponent());
       break;
     default:
       assert false;
   }
 }
예제 #13
0
 private void showHideFields() {
   if (typeSelection.getSelectedItem() == MappingTypes.LITERAL) {
     if (!literalEntry.isShowing()) {
       changeableContentContainer.remove(fieldDrop);
       changeableContentContainer.add(literalEntry);
     }
   } else {
     if (!fieldSelection.isShowing()) {
       changeableContentContainer.remove(literalEntry);
       changeableContentContainer.add(fieldDrop);
     }
   }
   changeableContentContainer.validate();
   changeableContentContainer.repaint();
 }
  public void back() {
    rightPanel.getBlackCheckers().setText((game.getBlackPlayer().eatenCheckers()));
    rightPanel.getWhiteCheckers().setText((game.getWhitePlayer().eatenCheckers()));

    if (game.getTurn() == 1) {
      rightPanel.getNames().setText("White Turn");
    } else {
      rightPanel.getNames().setText("Black Turn");
    }

    for (int i = 0; i < tem.length; i++) {
      for (int j = 0; j < tem[i].length; j++) {

        tem[i][j].setClicked(false);
        tem[i][j].setHighlighted(false);
        CheckerButton.setOneButtonClicked(false);
        tem[i][j].validate();
        tem[i][j].repaint();

        gamePanel.remove(tem[i][j]);

        rightPanel.validate();
        rightPanel.repaint();
        this.validate();
        this.repaint();
      }
    }
  }
 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
예제 #16
0
  /**
   * Spusti se pri zmacknuti tlacitka. Pokud je pod mysi obraz figury, zjisti, zda se muze pohnout
   * (pokud ano, upravi ho pro tahnuti, nastavi ho do figLabel) a zobrazi kontextovou napovedu.
   */
  private void eCatcherMousePressed(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_eCatcherMousePressed
    if (figLabel != null || finished) {
      return;
    }
    BoardSquare bsquare = (BoardSquare) eCatcher.getComponentAt(evt.getPoint());

    JPanel fsquare = (JPanel) figurePan.getComponent(bsquare.getIndex());
    sourceBSquare = bsquare;
    Point defLocation = fsquare.getLocation();
    xAdjustment = (int) defLocation.getX() - evt.getX();
    yAdjustment = (int) defLocation.getY() - evt.getY();
    if (fsquare.getComponentCount() == 0) {
      return;
    }
    figLabel = (JLabel) fsquare.getComponent(0);

    setFocus(gui.getFocus(bsquare.getColumn(), bsquare.getRow()));
    if (!gui.canMove(bsquare.getColumn(), bsquare.getRow())) {
      figLabel = null;
      return;
    }
    fsquare.remove(figLabel);
    boardPane.add(figLabel, 0);
    figLabel.setLocation(evt.getX() + xAdjustment, evt.getY() + yAdjustment);
    figLabel.setSize(figLabel.getWidth(), figLabel.getHeight());
  } // GEN-LAST:event_eCatcherMousePressed
예제 #17
0
파일: EditorPane.java 프로젝트: hencjo/jOOQ
 private JPanel addResultPane() {
   JPanel resultPane = new JPanel(new BorderLayout());
   resultPane.setOpaque(false);
   int componentCount = southPanel.getComponentCount();
   if (componentCount == 0) {
     southPanel.add(resultPane, BorderLayout.CENTER);
     southPanel.revalidate();
     southPanel.repaint();
   } else {
     JTabbedPane tabbedPane;
     Component component0 = southPanel.getComponent(0);
     if (component0 instanceof JTabbedPane) {
       tabbedPane = (JTabbedPane) component0;
     } else {
       JPanel query1Panel = (JPanel) component0;
       southPanel.remove(0);
       tabbedPane = new JTabbedPane();
       tabbedPane.addTab("Query 1", query1Panel);
       southPanel.add(tabbedPane, BorderLayout.CENTER);
       southPanel.revalidate();
       southPanel.repaint();
     }
     tabbedPane.addTab("Query " + (tabbedPane.getTabCount() + 1), resultPane);
   }
   return resultPane;
 }
예제 #18
0
 @Override
 public void updatePanel(Solution solution) {
   NurseRoster nurseRoster = (NurseRoster) solution;
   List<ShiftDate> shiftDateList = nurseRoster.getShiftDateList();
   List<Shift> shiftList = nurseRoster.getShiftList();
   Set<Employee> deadEmployeeSet = new LinkedHashSet<Employee>(employeeToPanelMap.keySet());
   deadEmployeeSet.remove(null);
   for (Employee employee : nurseRoster.getEmployeeList()) {
     deadEmployeeSet.remove(employee);
     EmployeePanel employeePanel = employeeToPanelMap.get(employee);
     if (employeePanel == null) {
       employeePanel = new EmployeePanel(this, shiftDateList, shiftList, employee);
       employeeListPanel.add(employeePanel);
       employeeToPanelMap.put(employee, employeePanel);
     }
     employeePanel.clearShiftAssignments();
   }
   unassignedPanel.clearShiftAssignments();
   for (ShiftAssignment shiftAssignment : nurseRoster.getShiftAssignmentList()) {
     Employee employee = shiftAssignment.getEmployee();
     EmployeePanel employeePanel = employeeToPanelMap.get(employee);
     employeePanel.addShiftAssignment(shiftAssignment);
   }
   for (Employee deadEmployee : deadEmployeeSet) {
     EmployeePanel deadEmployeePanel = employeeToPanelMap.remove(deadEmployee);
     employeeListPanel.remove(deadEmployeePanel);
   }
   for (EmployeePanel employeePanel : employeeToPanelMap.values()) {
     employeePanel.update();
   }
 }
예제 #19
0
 private void removeEquipSets(Set<String> eqSetIds) {
   for (String key : eqSetIds) {
     JRadioButton w = eqSetWidgets.remove(key);
     eqSets.remove(w);
     eqSetPanel.remove(w);
   }
 }
예제 #20
0
파일: InGame.java 프로젝트: eR3tbvK/1.96
  public void drawPanel() {
    try {
      // System.out.println("right before the while loop of the thread");
      // layeredPane.add(background,99);

      panel.remove(layeredPane);
      Iterator<PlayerMob> allPlayers = players.iterator();
      PlayerMob aPlayer = null;
      /*while(allPlayers.hasNext()){
      	aPlayer = (PlayerMob) allPlayers.next();
      	//System.out.println("INTHELOOP:info.getUsername ="******" myChat.getUsername ="******"for loop index catch");
      	continue;
      }*/

    } catch (NullPointerException ed) {
      System.err.println("for loop null catch");
      // startDrawingPanelThread();
    } catch (Exception ev) {
      System.err.println("for loop catch");
      ev.printStackTrace();
    }
  }
 private void clearDeleteRecord() {
   if (deleteList != null) {
     java.util.List list = deleteList.getSelection();
     if (list.size() > 0) {
       try {
         java.util.List dbIDs = new ArrayList(list.size());
         for (Iterator it = list.iterator(); it.hasNext(); ) {
           GKInstance instance = (GKInstance) it.next();
           dbIDs.add(instance.getDBID());
         }
         fileAdaptor.clearDeleteRecord(dbIDs);
       } catch (IOException e) {
         System.err.println("SynchronizationDialog.clearDeleteRecord(): " + e);
         e.printStackTrace();
       }
       deleteList.deleteInstances(list);
       // Check if deleteList needs to be removed
       if (deleteList.getDisplayedInstances().size() == 0) {
         centerPane.remove(deleteList);
         centerPane.validate();
         centerPane.repaint();
       }
     }
   }
 }
  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
예제 #23
0
  private void createAndMarkAndAddTable(String[][] rowData2, String[] columnNames2) {

    jtNotenAnzeige =
        new JTable(rowData2, columnNames2) {

          private static final long serialVersionUID = 1L;

          public boolean isCellEditable(int row, int column) {
            return true;
          }
        };

    jtNotenAnzeige.setRowSelectionAllowed(false);
    jtNotenAnzeige.getTableHeader().setReorderingAllowed(false);
    jtNotenAnzeige.setDefaultRenderer(Object.class, new ColorTableCellRenderer());

    if (scrollPane != null) {
      tablePanel.remove(scrollPane);
    }

    scrollPane = new JScrollPane(jtNotenAnzeige);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBounds(10, 21, 525, 261);
    tablePanel.add(scrollPane);
  }
예제 #24
0
  /**
   * Scale image to the given percentage. Caller chooses whether enclosing window is to grow with
   * the resize, or not.
   *
   * @param targetPercentage Desired final percentage of image's original size.
   * @param expandWindow If true then the surrounding window grows/shrinks with the
   *     enlargement/reduction
   */
  public void percentScaleImage(int targetPercentage, boolean expandWindow) {

    Image img = _fullSizeImgIcon.getImage();

    ImageIcon imgIcon = new ImageIcon(img);
    int width = imgIcon.getIconWidth();

    int newWidth = new Double(width * targetPercentage / 100f).intValue();
    imgIcon.setImage(getScaledImage(imgIcon, newWidth));

    _panel.remove(_label);
    _label = new JLabel(imgIcon);
    _panel.add(_label);

    if (expandWindow) pack();
    else validate();

    setTitle(
        _titleBarStartTxt
            + ": "
            + targetPercentage
            + "% of "
            + _fullSizeImgIcon.getImage().getWidth(null)
            + "x"
            + _fullSizeImgIcon.getImage().getHeight(null)
            + " ("
            + imgIcon.getImage().getWidth(null)
            + "x"
            + imgIcon.getImage().getHeight(null)
            + ").");
  }
예제 #25
0
  private void createandAddTable(String[][] rowData2, String[] columnNames2) {

    jtNotenAnzeige =
        new JTable(rowData2, columnNames2) {

          private static final long serialVersionUID = 1L;

          public boolean isCellEditable(int row, int column) {
            // set table column uneditable
            return false;
          }
        };
    jtNotenAnzeige.setRowSelectionAllowed(false);
    jtNotenAnzeige.getTableHeader().setReorderingAllowed(false);

    // / scrollPane removen weil dann tabelle !
    if (scrollPane != null) {
      tablePanel.remove(scrollPane);
    }

    scrollPane = new JScrollPane(jtNotenAnzeige);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBounds(10, 21, 525, 261);
    tablePanel.add(scrollPane);
  }
 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
예제 #27
0
  /**
   * Removes the specified <code>JSChannelsPane</code> from the view.
   *
   * @param chnPane The <code>JSChannelsPane</code> to be removed.
   * @return <code>true</code> if the specified code>JSChannelsPane</code> is actually removed from
   *     the view, <code>false</code> otherwise.
   */
  public boolean removeChannelsPane(JSChannelsPane chnPane) {
    chnPane.removeListSelectionListener(this);

    tabbedPane.remove(chnPane);
    boolean b = super.removeChannelsPane(chnPane);
    for (int i = 0; i < miList.size(); i++) {
      A4n.MoveChannelsTo a = (A4n.MoveChannelsTo) miList.get(i).getAction();
      if (a.getChannelsPane().equals(chnPane)) {
        miList.remove(i);
        break;
      }
    }

    updateTabsMenu();

    if (getChannelsPaneCount() == 1) {
      A4n.closeChannelsTab.setEnabled(false);
      A4n.editTabTitle.setEnabled(false);
      tabbedPane.remove(getChannelsPane(0));
      channelsPane.remove(tabbedPane);
      channelsPane.add(getChannelsPane(0));
    }

    return b;
  }
예제 #28
0
 // @pre: param key is key of the bottom-most row in kvp
 public void removeBottomRow(String key) {
   if (keysVisible) {
     kvpPanel.remove(keyKeyComponentMap.remove(key));
   }
   kvpPanel.remove(keyValueComponentMap.remove(key));
   for (JPanel j : keyExtraComponentsMap.remove(key)) {
     kvpPanel.remove(j);
   }
   kvpPanel.remove(keyDetailComponentMap.remove(key));
   for (GridBagConstraints c : columnConstraints) {
     c.gridy--;
   }
   keyDetailConstraints.gridy--;
   kvpPanel.invalidate();
   kvpPanel.updateUI();
 }
예제 #29
0
 /**
  * Usuwa kontakt z wyświetlanej listy.
  *
  * @param contact
  * @throws NoSuchContactViewException Jeżeli kontakt nie został wcześniej dodany.
  */
 public void removeContact(final ViewContact contact) throws NoSuchContactViewException {
   final ContactPanel contactPanel = contactPanels.remove(contact);
   if (contactPanel == null) {
     throw new NoSuchContactViewException("W oknie glownym nie ma takiego kontaktu");
   }
   contactsListPanel.remove(contactPanel);
 }
 public void setTermTablePanel(TermTablePanel ttp) {
   if (termTablePanel != null) main.remove(termTablePanel);
   termTablePanel = ttp;
   main.add(ttp);
   uacalc.validate();
   repaint();
 }