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();
  }
Exemple #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());
  }
Exemple #3
0
 public void hide(boolean refresh) {
   container.remove(layout);
   if (showMeasurements.isSelected()) {
     container.remove(measurements);
     showMeasurements.setSelected(false);
   }
   if (refresh) core.refreshDisplay();
 }
 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");
 }
 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();
 }
Exemple #6
0
  public static void main(String[] args) {
    final JavaMixer sm = new JavaMixer();
    final JFrame jf = new JFrame("Mixer Test");
    final JPanel jp = new JPanel();
    jf.add(jp);
    jp.add(sm.getTree());
    jf.setSize(600, 500);
    jf.setVisible(true);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    sm.getTree()
        .addTreeSelectionListener(
            e -> {
              TreePath path = e.getPath();
              if (path.getLastPathComponent() instanceof ControlNode) {
                ControlNode controlNode = (ControlNode) path.getLastPathComponent();
                if (!(controlNode.getControl() instanceof CompoundControl)) {
                  if (jp.getComponentCount() > 1) jp.remove(1);
                  jp.add(controlNode.getComponent(), 1);
                  jp.repaint();
                }
              }
            });
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedInputVolume());
    jp.repaint();
    sm.setMicrophoneInput();
    sm.setMuteForMicrophoneOutput();
  }
 // @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();
 }
  /**
   * method to negotiate draganddrop when mouse is pressed
   *
   * @param e
   */
  public void mousePressed(MouseEvent e) {
    /** Set up click point and set ActivePanel */
    Point p = e.getPoint();
    System.out.println(p);
    if (!setActivePanel(p)) return;

    /** record where the initial click occurred */
    OriP = activePanel;

    /** Check whether click was over an image label */
    selectedComponent = getImageLabel(p);
    if (selectedComponent == null) return;

    /** Check whether click was over waste box */
    if (selectedComponent.getName().equals("WasteBox")) return;

    /**
     * remove selected component from active panel add it to the glass panel set the offset and
     * original position
     */
    Rectangle labelR = selectedComponent.getBounds();
    Rectangle panelR = activePanel.getBounds();
    //  if(labelR.contains(p.x - panelR.x, p.y - panelR.y))
    //  {
    activePanel.remove(selectedComponent);
    selected = true;
    glassPanel.add(selectedComponent);
    offset.x = p.x - labelR.x - panelR.x;
    offset.y = p.y - labelR.y - panelR.y;
    dragging = true;
    Original = labelR.getLocation();
    //  }
  }
 public void setTermTablePanel(TermTablePanel ttp) {
   if (termTablePanel != null) main.remove(termTablePanel);
   termTablePanel = ttp;
   main.add(ttp);
   uacalc.validate();
   repaint();
 }
Exemple #10
0
 public void setDemo(String demo) {
   setTitle("Jogl Demo: " + demo);
   if (animator == null) {
     animator = new Animator();
     animator.setIgnoreExceptions(true);
   }
   // stop();
   if (drawable != null) {
     gradientPanel.remove(drawable);
     animator.remove(drawable);
     drawable = null;
   }
   if (demo.equals("gears")) {
     drawable = new JGears();
     type = GEARS;
   }
   // else if(demo.equals("graphics")){
   //    type=GRAPHICS;
   //   drawable=new JGLGraphics();
   // }
   if (drawable != null) {
     gradientPanel.add(drawable, BorderLayout.CENTER);
     animator.add(drawable);
   }
 }
Exemple #11
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
 /*
  * Delete a function.
  */
 public void deletePlot(Function f) {
   f.cancel();
   plotter.removePlot(f);
   int index = funcList.indexOf(f);
   innerFuncTab.remove(index);
   funcList.remove(index);
   map.remove(f);
 }
 private static int restorePanel(JPanel component, int i) {
   int removed = 0;
   while (component.getComponentCount() > i) {
     component.remove(component.getComponentCount() - 1);
     removed++;
   }
   return removed;
 }
 public WizardPanel removeWizardPanel(int index) {
   wizardPanelsContainer.remove(index);
   WizardPanel panel = (WizardPanel) getWizardPanelList().remove(index);
   for (int i = index; i < getWizardPanelList().size(); i++) {
     wizardPanelsContainer.add((WizardPanel) getWizardPanelList().get(i), i + "");
   }
   return panel;
 }
Exemple #15
0
 public void setToolBarMode(boolean enable) {
   if (enable) {
     if (!outerpanel.isAncestorOf(toolbar)) {
       outerpanel.add(toolbar, BorderLayout.PAGE_START);
     }
   } else {
     outerpanel.remove(toolbar);
   }
 }
Exemple #16
0
 void setMessage(Animator a) {
   anim = a;
   who.setText(a.author());
   ref.setText(a.description());
   pan.remove(last);
   last = a.container();
   pan.add(last, "Center");
   if (T != null) T.interrupt();
 }
    void setSortCol(int sortCol, boolean reverse) {
      if (sortCol == modelCol) {

        if (!hasSortIndicator) compPanel.add(reverse ? upLabel : downLabel, BorderLayout.EAST);
        else if (reverse != this.reverse) {
          compPanel.remove(1);
          compPanel.add(reverse ? upLabel : downLabel, BorderLayout.EAST);
        }

        this.reverse = reverse;
        hasSortIndicator = true;

        // System.out.println("setSortCol on "+modelCol+" "+sortCol+" "+reverse);
      } else if (hasSortIndicator) {
        compPanel.remove(1);
        hasSortIndicator = false;
        // System.out.println("setSortCol off "+modelCol+" "+sortCol+" "+reverse);
      }
    }
 public void refreshPlayers() {
   List<PlayerPanel> deadPlayerPanels = new LinkedList<PlayerPanel>();
   for (PlayerPanel pPanel : players) {
     if (!pPanel.getReference().isAlive()) deadPlayerPanels.add(pPanel);
   }
   players.remove(deadPlayerPanels);
   for (PlayerPanel pPanel : deadPlayerPanels) {
     playersView.remove(pPanel);
   }
 }
 @Override
 public void apply() throws ConfigurationException {
   myEditor.apply();
   if (myModifiableModel.isChanged()) {
     ApplicationManager.getApplication().runWriteAction(() -> myModifiableModel.commit());
     myEditor.disposeUIResources();
     myTopPanel.remove(myEditor.getComponent());
     createEditor();
   }
 }
Exemple #20
0
 public void setStatusBarMode(boolean enable) {
   if (enable) {
     if (!outerpanel.isAncestorOf(statusbar)) {
       outerpanel.add(statusbar, BorderLayout.SOUTH);
     }
   } else {
     outerpanel.remove(statusbar);
     pack();
   }
 }
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the remove button
   if (e.getSource() == remove_button) {
     int row = table.getSelectedRow();
     model.removeRow(row);
     table.clearSelection();
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the remove all button
   if (e.getSource() == remove_all_button) {
     model.clearAll();
     table.setRowSelectionInterval(0, 0);
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the filter button
   if (e.getSource() == filter_button) {
     filter.showDialog();
     if (filter.okPressed()) {
       // Update the display with new filter
       model.setFilter(filter);
       table.repaint();
     }
   }
   // Check if the user pressed the start button
   if (e.getSource() == start_button) {
     start();
   }
   // Check if the user pressed the stop button
   if (e.getSource() == stop_button) {
     stop();
   }
   // Check if the user wants to switch layout
   if (e.getSource() == layout_button) {
     details_panel.remove(details_soap);
     details_soap.removeAll();
     if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
       details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
     } else {
       details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
     }
     details_soap.setTopComponent(request_panel);
     details_soap.setRightComponent(response_panel);
     details_soap.setResizeWeight(.5);
     details_panel.add(details_soap, BorderLayout.CENTER);
     details_panel.validate();
     details_panel.repaint();
   }
   // Check if the user is changing the reflow option
   if (e.getSource() == reflow_xml) {
     request_text.setReflowXML(reflow_xml.isSelected());
     response_text.setReflowXML(reflow_xml.isSelected());
   }
 }
  /**
   * Sets the content pane of this JCollapsiblePane. Components must be added to this content pane,
   * not to the JCollapsiblePane.
   *
   * @param contentPanel
   * @throws IllegalArgumentException if contentPanel is null
   */
  public void setContentPane(Container contentPanel) {
    if (contentPanel == null) {
      throw new IllegalArgumentException("Content pane can't be null");
    }

    if (wrapper != null) {
      super.remove(wrapper);
    }
    wrapper = new WrapperContainer(contentPanel);
    super.addImpl(wrapper, BorderLayout.CENTER, -1);
  }
Exemple #23
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == easy) {
      invSpeed = 50000;
      bombN = 1;
      timeDifficulty1 = 1000;
      distanceLimit = 400;
      monsterMultiplier = 1;
      multiplier = 1;
      setup();
    } else if (e.getSource() == hard) {
      invSpeed = 30000;
      bombN = 4;
      timeDifficulty1 = 500;
      distanceLimit = 200;
      monsterMultiplier = 2;
      multiplier = 2;
      setup();
    } else if (e.getSource() == back) {
      r = null;
      menu.setVisible(true);
      back.setVisible(false);
      this.revalidate();
      repaint();
    } else if (e.getSource() == howTo) {
      menu.removeAll();

      menu.add(howToBack);
      menu.add(howToIMGL);

      menu.revalidate();
      menu.repaint();
    } else if (e.getSource() == howToBack) {
      menu.remove(howToIMGL);
      menu.remove(howToBack);

      menu.add(keyboardSpeedL1);
      menu.add(keyboardSpeedL2);
      menu.add(easy);
      menu.add(hard);
      menu.add(howTo);
      menu.add(onePlayerRB);
      menu.add(twoPlayerRB);
      menu.add(mouseRB);
      menu.add(keyboardRB);
      menu.add(keyboardSpeedS1);
      menu.add(keyboardSpeedS2);
      menu.add(musicCB);
      menu.add(highscoreL);
      menu.add(menuIMGL);

      menu.revalidate();
      menu.repaint();
    }
  }
 public void remove(int index) {
   Component c = getComponent(index);
   if (c == view) {
     view = null;
     super.remove(index);
   } else if (c == glassPane) {
     throw new IllegalArgumentException("GlassPane can't be removed");
   } else {
     throw new AssertionError("Unknown component with index " + index);
   }
 }
Exemple #25
0
 public void propertyChange(PropertyChangeEvent evt) {
   if (DisplayOptions.isUpdateUIEvent(evt)) {
     SwingUtilities.updateComponentTreeUI(this);
     gradientPanel.remove(drawable);
     JPanel newpanel = createGradientPanel();
     contentPane.remove(gradientPanel);
     gradientPanel = newpanel;
     gradientPanel.add(drawable, BorderLayout.CENTER);
     contentPane.add(gradientPanel, BorderLayout.CENTER);
   }
 }
 public void setView(Component view) {
   if (getView() != null) {
     super.remove(getView());
   }
   if (view != null) {
     super.addImpl(view, null, 1);
   }
   this.view = view;
   doLayout();
   revalidate();
   repaint();
 }
 // Resets the game
 public void reset() {
   panel.remove(btnext);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   quizAnswerID = 0;
   map.clear();
   readQuestionAnswer(quizAnswerID);
   btnext.setText("Next");
 }
 @Override
 public void disposeUIResources() {
   if (myEditor != null) {
     myEditor.disposeUIResources();
     myTopPanel.remove(myEditor.getComponent());
     myEditor = null;
   }
   if (myModifiableModel != null) {
     myModifiableModel.dispose();
     myModifiableModel = null;
   }
 }
  private void showAntView(boolean treeView) {
    AntOutputView oldView = getOutputView(treeView);
    AntOutputView newView = getOutputView(!treeView);
    myCurrentView = newView;
    myMessagePanel.remove(oldView.getComponent());
    myMessagePanel.add(newView.getComponent(), BorderLayout.CENTER);
    myMessagePanel.validate();

    JComponent component = IdeFocusTraversalPolicy.getPreferredFocusedComponent(myMessagePanel);
    component.requestFocus();
    repaint();
  }
 public void removeProgressPanel() {
   if (myProgressPanel != null) {
     myMessagePanel.remove(myProgressPanel);
     // fix of 9377
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             myMessagePanel.validate();
           }
         });
     myProgressPanel = null;
   }
 }