protected void showFirstPage() {
   if (tabbedPanel.getTabCount() <= 0) cardLayout.show(finalPanel, "FirstPanel");
   else {
     cardLayout.show(finalPanel, "TabbedPanel");
     tabbedPanel.setSelectedIndex(0);
   }
 }
 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 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 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);
   }
 }
  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();
    }
  }
Example #7
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();
 }
Example #9
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();
  }
    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);
     }
   }
 }
Example #15
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;
  }
Example #16
0
 private void next1() {
   // 显示xml基本信息
   card.next(pane);
   nextBtn.setEnabled(false);
   doneBtn.setEnabled(true);
   step++;
 }
 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;
 }
 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);
 }
Example #19
0
 private void prev1() {
   prevBtn.setEnabled(true);
   nextBtn.setEnabled(true);
   doneBtn.setEnabled(false);
   card.previous(pane);
   step--;
 }
 protected final void showDesignerCard() {
   myErrorMessages.removeAll();
   myErrorStack.setText(null);
   myLayeredPane.revalidate();
   myHorizontalCaption.update();
   myVerticalCaption.update();
   myLayout.show(this, DESIGNER_CARD);
 }
Example #21
0
  public void actionPerformed(ActionEvent evt) {

    currentCard++;
    if (currentCard >= ask.length) {
      System.exit(0);
    }
    cards.show(this, "Card " + currentCard);
  }
  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;
              }
            }
          });
    }
  }
  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();
  }
Example #25
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);
 }
Example #26
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();
 }
 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);
 }
 public void showPage(Editor anEditor) {
   for (int i = 0, n = tabbedPanel.getComponentCount(); i < n; i++) {
     if (tabbedPanel.getComponent(i) == anEditor.getComponent()) {
       //        System.out.println ("Found editor "+anEditor.getName()+ " at i="+i);
       ejs.showPanel(defaultHeader);
       cardLayout.show(finalPanel, anEditor.getName());
       tabbedPanel.setSelectedComponent(anEditor.getComponent());
       return;
     }
   }
 }
  /**
   * Set the current panel
   *
   * @param panel the panel
   */
  protected void setCurrentPanel(WizardPanel panel) {

    currentPanel = panel;
    currentPanel.prepare();

    cardLayout.show(cardPanel, currentPanel.toString());

    backButton.setEnabled(currentPanel != firstPanel);
    cancelButton.setText("Cancel");
    nextButton.setText("Next");
    cancelButton.setEnabled(true);
  }
Example #30
0
  private void initMainPanel() {
    mainPanel = new JPanel(null);

    searchField = new JTextField();
    searchField.setBounds(50, 50, 830, 20);
    searchField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {}

              @Override
              public void removeUpdate(DocumentEvent e) {
                listSearchTable = null;
              }

              @Override
              public void changedUpdate(DocumentEvent e) {}
            });
    searchField.addActionListener(new Action());

    searchButton =
        new JButton(
            new ImageIcon(
                "/home/mrhappyyy/Programing/Java/Project/Laboratory/Client_Laboratory/src/windows/search.png"));
    searchButton.setBorderPainted(false);
    searchButton.setBounds(900, 35, 50, 50);
    searchButton.addActionListener(new Action());

    updateTable =
        new JButton(
            new ImageIcon(
                "/home/mrhappyyy/Programing/Java/Project/Laboratory/Client_Laboratory/src/windows/refresh.png"));
    updateTable.setBorderPainted(false);
    updateTable.setBounds(900, 100, 50, 50);
    updateTable.addActionListener(new Action());

    productTableModel = new ProductTableModel();
    table = new JTable(productTableModel);
    scroll = new JScrollPane(table);
    scroll.setBounds(50, 85, 830, 450);

    mainPanel.add(searchField);
    mainPanel.add(searchButton);
    mainPanel.add(updateTable);
    mainPanel.add(scroll);

    clarificationPanel.add(mainPanel, "mainPanel");
    updateTable();
    layout.show(clarificationPanel, "mainPanel");
  }