예제 #1
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == ctl) {
     this.menu();
   } else if (e.getSource() == exit) {
     exitPerform();
   } else if (e.getSource() == rank) {
     if (count != 0) {
       card.show(mainPanel, "four");
       rankPanel.setMemory(memory, count - 1);
       buttonPanel.removeAll();
       buttonPanel.setBounds(width - 200, height - 80, 190, 50);
       buttonPanel.add(exit);
       check = 4;
       count--;
     }
   } else if (e.getSource() == back) {
     if (secondPanel.clip != null) {
       secondPanel.clip.stop();
       System.out.printf("test");
     }
     check = 0;
     card.previous(mainPanel);
     buttonPanel.removeAll();
     ctl.setText("- Play -");
     buttonPanel.add(ctl);
     buttonPanel.add(rank);
     buttonPanel.add(exit);
     buttonPanel.setOpaque(false);
     buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100);
   }
 }
  protected void showErrorPage(final ErrorInfo info) {
    storeState();
    hideProgress();
    myRootComponent = null;

    myErrorMessages.removeAll();

    if (info.myShowStack) {
      info.myMessages.add(
          0, new FixableMessageInfo(true, info.myDisplayMessage, "", "", null, null));

      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      info.myThrowable.printStackTrace(new PrintStream(stream));
      myErrorStack.setText(stream.toString());
      myErrorStackLayout.show(myErrorStackPanel, ERROR_STACK_CARD);
    } else {
      myErrorStack.setText(null);
      myErrorStackLayout.show(myErrorStackPanel, ERROR_NO_STACK_CARD);
    }

    for (FixableMessageInfo message : info.myMessages) {
      addErrorMessage(
          message, message.myErrorIcon ? Messages.getErrorIcon() : Messages.getWarningIcon());
    }

    myErrorPanel.revalidate();
    myLayout.show(this, ERROR_CARD);

    DesignerToolWindowManager.getInstance(getProject()).refresh(true);
    repaint();
  }
  private void updateEditorText() {
    disposeNonTextEditor();

    final PsiElement elt = myElements[myIndex].getNavigationElement();
    Project project = elt.getProject();
    PsiFile psiFile = getContainingFile(elt);
    final VirtualFile vFile = psiFile.getVirtualFile();
    if (vFile == null) return;
    final FileEditorProvider[] providers =
        FileEditorProviderManager.getInstance().getProviders(project, vFile);
    for (FileEditorProvider provider : providers) {
      if (provider instanceof TextEditorProvider) {
        updateTextElement(elt);
        myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
        break;
      } else if (provider.accept(project, vFile)) {
        myCurrentNonTextEditorProvider = provider;
        myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
        myBinaryPanel.removeAll();
        myBinaryPanel.add(myNonTextEditor.getComponent());
        myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
        break;
      }
    }
  }
 public void testCardLayout() throws Exception {
   JComponent rootComponent = getInstrumentedRootComponent("TestCardLayout.form", "BindingTest");
   assertTrue(rootComponent.getLayout() instanceof CardLayout);
   CardLayout cardLayout = (CardLayout) rootComponent.getLayout();
   assertEquals(10, cardLayout.getHgap());
   assertEquals(20, cardLayout.getVgap());
 }
 protected void showFirstPage() {
   if (tabbedPanel.getTabCount() <= 0) cardLayout.show(finalPanel, "FirstPanel");
   else {
     cardLayout.show(finalPanel, "TabbedPanel");
     tabbedPanel.setSelectedIndex(0);
   }
 }
예제 #6
0
    public void keyPressed(KeyEvent e) {
      if (e.getKeyCode() == KeyEvent.VK_P) {
        if (pauseFlag) { // eğer oyun pause halindeyse
          startTimer();
          pauseFlag = false;
          // pause paneli görünmez yap
          // pp.setVisible(false);

        } else { // oyun oynanırken P ye basılırsa/pause haline geçilirse
          stopTimer();
          pauseFlag = true;

          //        			CardLayout c1 = (CardLayout)(mgf.getCanvas().getLayout());
          //        			c1.show(mgf.getCanvas(), "Pause Panel");
          System.out.println("Paused by game manager");
        }
      }

      if (e.getKeyCode() == KeyEvent.VK_Q) {

        System.out.println("Q pressed");
        // oyunu pause lamak faln gerekeblir
        gm.resetGameLevel();
        gm.resetGamePoint();
        gm.initGame();

        CardLayout c2 = (CardLayout) (mgf.getCanvas().getLayout());
        c2.show(mgf.getCanvas(), "GUI");
      }
    }
예제 #7
0
  @Override
  public void actionPerformed(ActionEvent arg0) {
    ArrayList<Bullet> bs = boat.getBulletsList();

    for (int i = 0; i < bs.size(); i++) {
      Bullet b = (Bullet) bs.get(i);
      if (b.isVisible()) b.move();
      else bs.remove(i);
    }

    for (int i = 0; i < buoys.size(); i++) {
      Buoy b = (Buoy) buoys.get(i);
      if (!(b.isVisible())) {
        gamePoint += b.getPoint();
        buoys.remove(i);
        // System.out.println("Remaining Buoys: " + buoys.size());
      }
    }

    for (int i = 0; i < bonuses.size(); i++) {
      Bonus b = (Bonus) bonuses.get(i);
      if (!(b.isVisible())) {
        gamePoint += b.getPoint();
        bonuses.remove(i);
      }
    }
    // level olayı burada hallediliyor!!
    // en son level kalmadığında highscore' a bak yazdır
    if (nextLevelFlag) {
      System.out.println("next Level a geçtin");
      currentLevel++;
      System.out.println("level: " + currentLevel);
      initGame(); // oyunu restart edecek
      nextLevelFlag = false;
      if (currentLevel
          > LAST_LEVEL) { // tüm levellar bittikten sonra terminate/ana menüye dönüş, tam bu anda
                          // high score yazdır. Ancak oyunu bitirenler highscore table a girmeye hak
                          // kazanır.
        // High scores to table
        try {
          writeHighScoreToFile(computeTotalScore());
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        currentLevel = 1;
        gamePoint = 0;
        initGame();
        CardLayout c2 = (CardLayout) (mgf.getCanvas().getLayout());
        c2.show(mgf.getCanvas(), "GUI");
        // System.exit(0);
      }
    } else {

    }

    boat.move();
    checkCollisions();
    repaint();
  }
  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();
    }
  }
예제 #9
0
 /**
  * Retrieves the currently selected legend in the tree and shows the corresponding dialog in the
  * card layout; shows the empty panel if no legend is selected.
  */
 protected void showDialogForCurrentlySelectedLegend() {
   ISELegendPanel selected = legendTree.getSelectedPanel();
   if (selected != null) {
     cardLayout.show(dialogContainer, selected.getId());
   } else {
     cardLayout.show(dialogContainer, NO_LEGEND_ID);
   }
 }
예제 #10
0
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == login.b1) { // double click event
     card.show(getContentPane(), "WR");
   } else if (e.getSource() == login.b2) {
     card.show(getContentPane(), "");
   }
 }
 public void showPropertiesPanel() {
   final CardLayout cardLayout = (CardLayout) myPropertiesPanelWrapper.getLayout();
   if (myCurrentPanel != null) {
     cardLayout.show(myPropertiesPanelWrapper, PROPERTIES_CARD);
   } else {
     cardLayout.show(myPropertiesPanelWrapper, EMPTY_CARD);
   }
   myPropertiesPanelWrapper.repaint();
 }
예제 #12
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
 public void setSelected(AnActionEvent e, boolean state) {
   myGroupByChangeList = state;
   VcsConfiguration.getInstance(myProject).UPDATE_GROUP_BY_CHANGELIST = myGroupByChangeList;
   final CardLayout cardLayout = (CardLayout) myCenterPanel.getLayout();
   if (!myGroupByChangeList) {
     cardLayout.show(myCenterPanel, CARD_STATUS);
   } else {
     cardLayout.show(myCenterPanel, CARD_CHANGES);
   }
 }
 private void selectInitialCard() {
   myHavePackages = false;
   for (PsiElement psiElement : myElementsToMove) {
     if (!(psiElement instanceof PsiClass)) {
       myHavePackages = true;
       break;
     }
   }
   CardLayout cardLayout = (CardLayout) myCardPanel.getLayout();
   cardLayout.show(myCardPanel, myHavePackages ? "Package" : "Class");
 }
  /*
   * Button or JTextField clicked
   */
  public void switchCards(String s) {
    System.out.println("Switching to " + s);

    CardLayout cl = (CardLayout) (mainPanels.getLayout());
    cl.show(mainPanels, s);
    mainPanels.revalidate();

    CardLayout cl2 = (CardLayout) (sidePanels.getLayout());
    cl2.show(sidePanels, s);
    sidePanels.revalidate();
  }
예제 #16
0
    public void stateChanged(@NotNull ChangeEvent e) {
      ImageDocument document = imageComponent.getDocument();
      BufferedImage value = document.getValue();

      CardLayout layout = (CardLayout) contentPanel.getLayout();
      layout.show(contentPanel, value != null ? IMAGE_PANEL : ERROR_PANEL);

      updateInfo();

      revalidate();
      repaint();
    }
 public void setCanGroupByChangeList(final boolean canGroupByChangeList) {
   myCanGroupByChangeList = canGroupByChangeList;
   if (myCanGroupByChangeList) {
     myLoadingChangeListsLabel = new JLabel(VcsBundle.message("update.info.loading.changelists"));
     add(myLoadingChangeListsLabel, BorderLayout.SOUTH);
     myGroupByChangeList = VcsConfiguration.getInstance(myProject).UPDATE_GROUP_BY_CHANGELIST;
     if (myGroupByChangeList) {
       final CardLayout cardLayout = (CardLayout) myCenterPanel.getLayout();
       cardLayout.show(myCenterPanel, CARD_CHANGES);
     }
   }
 }
예제 #18
0
  public void enableConsole(boolean primary) {
    if (primary == myPrimary) {
      // nothing to do
      return;
    }

    CardLayout cl = (CardLayout) (getLayout());
    cl.show(this, primary ? PRIMARY_CONSOLE_PANEL : SECONDARY_CONSOLE_PANEL);

    getSubConsoleView(primary).getComponent().requestFocus();

    myPrimary = primary;
  }
예제 #19
0
 public void changePanel() {
   card.next(mainPanel);
   buttonPanel.removeAll();
   ctl.setText("- Play -");
   buttonPanel.add(ctl);
   buttonPanel.add(rank);
   buttonPanel.add(exit);
   buttonPanel.setOpaque(false);
   buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100);
   count++;
   memory[count] = new Memory();
   menuPanel.setMemory(memory[count]);
   secondPanel.setMemory(memory[count]);
   gamePanel.setMemory(memory[count]);
   rankPanel.setMemory(memory, count);
   check = 0;
   System.out.println(
       count
           + " "
           + memory[count - 1].name
           + " "
           + memory[count - 1].song
           + " "
           + memory[count - 1].score);
 }
 protected void addPage(String _typeOfPage, String _name, String _code, boolean _enabled) {
   cardLayout.show(finalPanel, "TabbedPanel");
   _name = getUniqueName(_name);
   Editor page = createPage(_typeOfPage, _name, _code);
   page.setFont(myFont);
   page.setColor(myColor);
   int index = tabbedPanel.getSelectedIndex();
   if (index == -1) {
     pageList.addElement(page);
     if (tabbedPanel.getTabCount() == 0) {
       tabbedPanel.addTab(
           page.getName(),
           null,
           page.getComponent(),
           tooltip); // This causes an exception sometimes
     } else {
       tabbedPanel.insertTab(
           page.getName(), null, page.getComponent(), tooltip, tabbedPanel.getTabCount());
     }
     index = 0;
   } else {
     index++;
     pageList.insertElementAt(page, index);
     tabbedPanel.insertTab(page.getName(), null, page.getComponent(), tooltip, index);
   }
   tabbedPanel.setSelectedComponent(page.getComponent());
   page.setActive(_enabled);
   if (!_enabled) tabbedPanel.setTitleAt(index, page.getName() + " (D)");
   updatePageCounterField(pageList.size());
   // tabbedPanel.validate(); This hangs the computer when reading a file at start-up !!!???
   tabbedPanel.repaint();
   changed = true;
 }
예제 #21
0
파일: GenXml.java 프로젝트: abel533/EasyXls
 private void prev1() {
   prevBtn.setEnabled(true);
   nextBtn.setEnabled(true);
   doneBtn.setEnabled(false);
   card.previous(pane);
   step--;
 }
예제 #22
0
파일: GenXml.java 프로젝트: abel533/EasyXls
 private void next1() {
   // 显示xml基本信息
   card.next(pane);
   nextBtn.setEnabled(false);
   doneBtn.setEnabled(true);
   step++;
 }
예제 #23
0
  public void actionPerformed(ActionEvent evt) {

    currentCard++;
    if (currentCard >= ask.length) {
      System.exit(0);
    }
    cards.show(this, "Card " + currentCard);
  }
 protected final void showDesignerCard() {
   myErrorMessages.removeAll();
   myErrorStack.setText(null);
   myLayeredPane.revalidate();
   myHorizontalCaption.update();
   myVerticalCaption.update();
   myLayout.show(this, DESIGNER_CARD);
 }
예제 #25
0
  public void menu() {
    if (check == 0) {
      buttonPanel.removeAll();
      buttonPanel.setBounds(width - 200, height - 80, 200, 50);
      card.next(mainPanel);
      ctl.setText("- Play -");
      buttonPanel.add(back);
      buttonPanel.add(ctl);
      menuPanel.savename();
      check = 1;
      secondPanel.musiclist.clearSelection();
      gamePanel.setSecond(0);
    } else if (check == 1) {
      if (memory[count].getSong() == null) {
        Container con = getContentPane();

        String title = "--Warning--";
        String message = "Please Choice a Music Before Playing!";
        int type = JOptionPane.WARNING_MESSAGE;

        JOptionPane.showMessageDialog(con, message, title, type);
      } else {
        card.next(mainPanel);
        secondPanel.clip.stop();
        buttonPanel.removeAll();
        buttonPanel.setBounds(width - 200, height - 80, 190, 50);
        ctl.setText("- Stop -");
        buttonPanel.add(ctl);
        buttonPanel.add(exit);
        check = 2;
        gamePanel.playmusic();
        gamePanel.setRun(true);
      }
    } else if (check == 2) {
      ctl.setText("- Resume -");
      gamePanel.clip.stop();
      gamePanel.setRun(false);
      check = 3;
    } else if (check == 3) {
      ctl.setText("- Stop -");
      gamePanel.clip.start();
      gamePanel.setRun(true);
      check = 2;
    }
  }
  public void addColorChooserPanel(final AbstractColorChooserPanel ccp) {
    final String displayName = ccp.getDisplayName();
    if (displayName == null) {
      // Return if we haven't initialized yet
      return;
    }

    if (ccp.getClass()
        .getName()
        .equals("ch.randelshofer.quaqua.colorchooser.Quaqua15ColorPicker")) {
      northPanel.add(ccp, BorderLayout.WEST);
    } else {
      Icon displayIcon = ccp.getLargeDisplayIcon();
      JToggleButton tb = new JToggleButton(null, displayIcon);
      tb.setToolTipText(displayName);
      tb.setFocusable(false);
      tb.setHorizontalTextPosition(SwingConstants.CENTER);
      tb.setVerticalTextPosition(SwingConstants.BOTTOM);
      tb.setFont(UIManager.getFont("ColorChooser.font"));
      tb.putClientProperty("Quaqua.Button.style", "toolBarTab");
      JPanel centerView = new JPanel(new BorderLayout());
      centerView.add(ccp);
      chooserPanelHolder.add(centerView, displayName);
      toolBarButtonGroup.add(tb);
      toolBar.add(tb);

      if (toolBar.getComponentCount() == 1
          || lastSelectedChooserName != null && lastSelectedChooserName.equals(displayName)) {
        tb.setSelected(true);
        CardLayout cl = (CardLayout) chooserPanelHolder.getLayout();
        cl.show(chooserPanelHolder, displayName);
      }

      tb.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
              if (evt.getStateChange() == ItemEvent.SELECTED) {
                CardLayout cl = (CardLayout) chooserPanelHolder.getLayout();
                cl.show(chooserPanelHolder, displayName);
                lastSelectedChooserName = displayName;
              }
            }
          });
    }
  }
예제 #27
0
  public void show(@NotNull Issue issue) {
    this.issue = issue;
    currentForm = (create) ? createMainForm : updateTabbedPane;
    currentForm.updateUI(issue.getReview(), issue, true);

    cardLayout.show(centerPanel, currentForm.getClass().getName());

    super.show();
  }
예제 #28
0
 /** Connect the vector of QV's into the main View */
 public void installQVs() {
   Exam thisExam = theTD.curX;
   Vector qv = thisExam.getListData();
   for (int i = 0; i < qv.size(); i++) {
     // Use question number (1-origin) as string name.
     // System.out.println("Add question " +i +" to " + questionsPanel);
     questionsPanel.add(Integer.toString(i + 1), new QView((Q) qv.elementAt(i)));
   }
   myCardLayout.first(questionsPanel);
 }
 protected void removeCurrentPage() {
   int index = tabbedPanel.getSelectedIndex();
   if (index < 0) return;
   tabbedPanel.removeTabAt(index);
   pageList.removeElementAt(index);
   updatePageCounterField(pageList.size());
   changed = true;
   if (tabbedPanel.getTabCount() <= 0) cardLayout.show(finalPanel, "FirstPanel");
   ejs.getModelEditor().getVariablesEditor().updateControlValues(false);
 }
예제 #30
0
 private void selectCompiler(BackendCompiler compiler) {
   if (compiler == null) {
     compiler = myDefaultCompiler;
   }
   myCompiler.setSelectedItem(compiler);
   mySelectedCompiler = compiler;
   myCardLayout.show(myContentPanel, compiler.getId());
   myContentPanel.revalidate();
   myContentPanel.repaint();
 }