java.awt.CardLayout Java Examples

The following examples show how to use java.awt.CardLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SymbolizerDetailsPanel.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Show panel for selected tree item.
 *
 * @param parentClass the parent class
 * @param classSelected the class selected
 */
@Override
public void show(Class<?> parentClass, Class<?> classSelected) {
    String key = null;
    if (classSelected != null) {
        key = classSelected.toString();
    } else {
        key = EMPTY_PANEL_KEY;
    }

    PopulateDetailsInterface panel = getPanel(parentClass, key);
    if (panel != null) {
        CardLayout cl = (CardLayout) (detailsPanel.getLayout());
        currentDisplayedPanel = encodePanelKey(key, panel);
        cl.show(detailsPanel, currentDisplayedPanel);

        SelectedSymbol selectedSymbol = SelectedSymbol.getInstance();
        panel.populate(selectedSymbol);
    }
    repaint();
}
 
Example #2
Source File: BlazeSelectWorkspaceControl.java    From intellij with Apache License 2.0 6 votes vote down vote up
public BlazeSelectWorkspaceControl(BlazeNewProjectBuilder builder, Disposable parentDisposable) {
  this.builder = builder;
  this.userSettings = builder.getUserSettings();
  availableWorkspaceTypes =
      BlazeWizardOptionProvider.getInstance()
          .getSelectWorkspaceOptions(this.builder, parentDisposable);
  Preconditions.checkState(
      !availableWorkspaceTypes.isEmpty(), "No project workspace types available to be selected.");

  cardLayout = new CardLayout();
  cardPanel = new JPanel(cardLayout);
  cardPanel.putClientProperty("BorderFactoryClass", PlainSmallWithoutIndent.class.getName());
  cardPanel.setOpaque(false);
  availableWorkspaceTypes.forEach(
      type -> cardPanel.add(type.getUiComponent(), type.getOptionName()));
  workspaceTypeList = new WorkspaceTypeList(availableWorkspaceTypes);
  workspaceTypeList.addListSelectionListener(e -> updateSelection());
  component = initPanel();

  selectInitialItem();
}
 
Example #3
Source File: ResultViewPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public ResultViewPanel(SearchTask searchTask) {
    setLayout(resultViewCards = new CardLayout());
    this.searchComposition = searchTask.getComposition();
    this.searchTask = searchTask;
    SearchResultsDisplayer<?> displayer =
            searchComposition.getSearchResultsDisplayer();
    setName(displayer.getTitle());
    displayer.setInfoNode(this.createListener().getInfoNode());
    resultsPanel = new JPanel();
    resultsPanel.setLayout(
            new BoxLayout(resultsPanel, BoxLayout.PAGE_AXIS));
    SearchResultsDisplayer<?> disp =
            searchComposition.getSearchResultsDisplayer();
    visualComponent = disp.getVisualComponent();
    lookup = (visualComponent instanceof Lookup.Provider)
            ? ((Lookup.Provider) visualComponent).getLookup()
            : Lookup.EMPTY;
    resultsPanel.add(visualComponent);
    add(resultsPanel, CARD_NAME_RESULTS);
    showInfo(UiUtils.getText("TEXT_WAITING_FOR_PREVIOUS"));         //NOI18N
}
 
Example #4
Source File: CardTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    String arg = e.getActionCommand();

    if ("first".equals(arg)) {
        ((CardLayout) cards.getLayout()).first(cards);
    } else if ("next".equals(arg)) {
        ((CardLayout) cards.getLayout()).next(cards);
    } else if ("previous".equals(arg)) {
        ((CardLayout) cards.getLayout()).previous(cards);
    } else if ("last".equals(arg)) {
        ((CardLayout) cards.getLayout()).last(cards);
    } else {
        ((CardLayout) cards.getLayout()).show(cards, arg);
    }
}
 
Example #5
Source File: InitPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void initComponents() {        
    if (!oPanel.isPrepared()) {
        initComponent = new JLabel(NbBundle.getMessage(InitPanel.class, "LBL_computing")); // NOI18N
        initComponent.setPreferredSize(new Dimension(850, 450));
        // avoid flicking ?
        Color c = UIManager.getColor("Tree.background"); // NOI18N
        if (c == null) {
            //GTK 1.4.2 will return null for Tree.background
            c = Color.WHITE;
        }
        initComponent.setBackground(c);    // NOI18N               
        initComponent.setHorizontalAlignment(SwingConstants.CENTER);
        initComponent.setOpaque(true);
        
        CardLayout card = new CardLayout();
        setLayout(card);            
        add(initComponent, "init");    // NOI18N
        card.show(this, "init"); // NOI18N        
        Utilities.attachInitJob(this, this);
    } else {
        finished();  
    }
}
 
Example #6
Source File: CardTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    String arg = e.getActionCommand();

    if ("first".equals(arg)) {
        ((CardLayout) cards.getLayout()).first(cards);
    } else if ("next".equals(arg)) {
        ((CardLayout) cards.getLayout()).next(cards);
    } else if ("previous".equals(arg)) {
        ((CardLayout) cards.getLayout()).previous(cards);
    } else if ("last".equals(arg)) {
        ((CardLayout) cards.getLayout()).last(cards);
    } else {
        ((CardLayout) cards.getLayout()).show(cards, arg);
    }
}
 
Example #7
Source File: ClientsPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
/** */
public ClientsPanel(ExtensionPlugNHack extension) {
    super();
    this.extension = extension;
    this.extension.addMonitoredPageListenner(this);

    this.setLayout(new CardLayout());
    this.setSize(274, 251);
    this.setName(Constant.messages.getString("plugnhack.client.panel.title"));
    this.setIcon(ExtensionPlugNHack.CLIENT_ACTIVE_ICON);
    this.setDefaultAccelerator(
            this.extension
                    .getView()
                    .getMenuShortcutKeyStroke(KeyEvent.VK_C, KeyEvent.SHIFT_DOWN_MASK, false));
    this.setMnemonic(Constant.messages.getChar("plugnhack.client.panel.mnemonic"));

    this.add(getClientsPanel(), getClientsPanel().getName());
}
 
Example #8
Source File: HardStringWizardPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Reads settings at the start when the panel comes to play. Overrides superclass method. */
   @Override
   public void readSettings(I18nWizardDescriptor.Settings settings) {
super.readSettings(settings);
       getUI().setSourceMap(getMap());

       hasFoundStrings = foundStrings(getMap());

       JPanel panel = (JPanel)getComponent();
       if (hasFoundStrings) {
           panel.add(getUI(), CARD_GUI);
           ((CardLayout) panel.getLayout()).show(panel, CARD_GUI);
       } else {
           panel.add(getMessageComp(), CARD_MSG);
           ((CardLayout) panel.getLayout()).show(panel, CARD_MSG);
       }
   }
 
Example #9
Source File: MergeBranchForm.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
    sourceBranchLabel = new JLabel();
    this.$$$loadLabelText$$$(sourceBranchLabel, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("MergeBranchDialog.Source"));
    contentPanel.add(sourceBranchLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    sourceText = new TextFieldWithBrowseButton.NoPathCompletion();
    contentPanel.add(sourceText, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setEnabled(true);
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("MergeBranchDialog.Target"));
    contentPanel.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    targetCombo = new JComboBox();
    contentPanel.add(targetCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    changesToMergePanel = new JPanel();
    changesToMergePanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.add(changesToMergePanel, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    changesToMergePanel.setBorder(BorderFactory.createTitledBorder(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("MergeBranchDialog.ChangesToMerge")));
    changesTypeCombo = new JComboBox();
    changesToMergePanel.add(changesTypeCombo, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    changesetsPanel = new JPanel();
    changesetsPanel.setLayout(new CardLayout(0, 0));
    changesToMergePanel.add(changesetsPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    label1.setLabelFor(targetCombo);
}
 
Example #10
Source File: CardTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    String arg = e.getActionCommand();

    if ("first".equals(arg)) {
        ((CardLayout) cards.getLayout()).first(cards);
    } else if ("next".equals(arg)) {
        ((CardLayout) cards.getLayout()).next(cards);
    } else if ("previous".equals(arg)) {
        ((CardLayout) cards.getLayout()).previous(cards);
    } else if ("last".equals(arg)) {
        ((CardLayout) cards.getLayout()).last(cards);
    } else {
        ((CardLayout) cards.getLayout()).show(cards, arg);
    }
}
 
Example #11
Source File: CardTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    String arg = e.getActionCommand();

    if ("first".equals(arg)) {
        ((CardLayout) cards.getLayout()).first(cards);
    } else if ("next".equals(arg)) {
        ((CardLayout) cards.getLayout()).next(cards);
    } else if ("previous".equals(arg)) {
        ((CardLayout) cards.getLayout()).previous(cards);
    } else if ("last".equals(arg)) {
        ((CardLayout) cards.getLayout()).last(cards);
    } else {
        ((CardLayout) cards.getLayout()).show(cards, arg);
    }
}
 
Example #12
Source File: RepositorySelectorBuilder.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void displayRepositoryForm(RepositoryImpl repository, String initialErrMsg) {
    makeSureRepositoryFormsPanelExists();

    boolean wasRepositoryFormVisible = repositoryFormVisible;

    boolean firstUsed = repositoryFormsPanel.displayForm(repository, initialErrMsg);
    ((CardLayout) cardsPanel.getLayout()).show(cardsPanel, NEW_REPO_PANEL);

    if (!wasRepositoryFormVisible) {
        repositoryFormsPanel.addChangeListener(repositoryFormPanelListener);
        setDataValid(repositoryFormsPanel.isValidData());
        repositoryFormVisible = true;
    }

    if (firstUsed) {
        notifyResizeListeners();
    }
}
 
Example #13
Source File: java_awt_CardLayout.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void validate(CardLayout before, CardLayout after) {
    super.validate(before, after);
    try {
        Vector a = (Vector) VECTOR.get(after);
        Vector b = (Vector) VECTOR.get(before);
        int size = a.size();
        if (size != b.size()) {
            throw new Error("different content");
        }
        for (int i = 0; i < size; i++) {
            super.validator.validate(NAME.get(a.get(i)), NAME.get(b.get(i)));
            super.validator.validate(COMP.get(a.get(i)), COMP.get(b.get(i)));
        }
    }
    catch (Exception exception) {
        throw new Error(exception);
    }
}
 
Example #14
Source File: PlayerTest.java    From Java-MP3-player with MIT License 6 votes vote down vote up
void Player() {
	contentPane = new ImagePanel();
	setBounds(100, 100, 538, 354);

	this.setVisible(true);
	setContentPane(contentPane);
	contentPane.setLayout(null);
	pane = new JScrollPane(PlayList);
	pane.setVisible(false);

	contentPane.setBackground(new Color(0, 0, 128));
	panel = new JPanel();
	panel.setBounds(0, 214, 511, 110);

	control_panel = new JPanelsSliding();
	control_panel.setLocation(0, 217);
	control_panel.setSize(535, 107);
	control_panel.setLayout(new CardLayout(0, 0));
	control_panel.add(panel, "name_37092408351471");

	contentPane.add(control_panel);
}
 
Example #15
Source File: SystemInfo.java    From DeconvolutionLab2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void mouseClicked(MouseEvent e) {
	if (e.getSource() instanceof AbstractMeter) {
		AbstractMeter meter = (AbstractMeter) e.getSource();
		if (meter.isExpanded()) {
			meter.collapse();
			cards.setVisible(false);
		}
		else for(AbstractMeter m : meters) {
			if (m.isExpanded())
				m.collapse(); 
			meter.expand();
			cards.setVisible(true);
		}
		((CardLayout) (cards.getLayout())).show(cards, meter.getMeterName());
		pack();
	}
	bnClear.setEnabled(signal.isExpanded());
}
 
Example #16
Source File: ResourcesCapsule.java    From DeconvolutionLab2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
 if (e.getSource() == bnJava)
 	((CardLayout) (cards.getLayout())).show(cards, java.getMeterName());
 if (e.getSource() == bnMemory)
 	((CardLayout) (cards.getLayout())).show(cards, memory.getMeterName());
 if (e.getSource() == bnProcessor)
 	((CardLayout) (cards.getLayout())).show(cards, processor.getMeterName());
 if (e.getSource() == bnFFT)
 	((CardLayout) (cards.getLayout())).show(cards, fft.getMeterName());
 if (e.getSource() == bnSignal)
 	((CardLayout) (cards.getLayout())).show(cards, signal.getMeterName());
 if (e.getSource() == bnFile)
 	((CardLayout) (cards.getLayout())).show(cards, file.getMeterName());
   
}
 
Example #17
Source File: TechPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
public TechPanel(ExtensionWappalyzer extension) {
    super();
    this.extension = extension;
    this.setLayout(new CardLayout());
    this.setSize(474, 251);
    this.setName(Constant.messages.getString("wappalyzer.panel.title"));
    this.setIcon(ExtensionWappalyzer.WAPPALYZER_ICON);
    this.setDefaultAccelerator(
            this.extension
                    .getView()
                    .getMenuShortcutKeyStroke(
                            KeyEvent.VK_T,
                            KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK,
                            false));
    this.setMnemonic(Constant.messages.getChar("wappalyzer.panel.mnemonic"));
    this.add(getPanelCommand(), getPanelCommand().getName());
    this.getEnableToggleButton().setSelected(extension.isWappalyzerEnabled());
}
 
Example #18
Source File: QuantDetailPane.java    From ApkToolPlus with Apache License 2.0 6 votes vote down vote up
public QuantDetailPane(BrowserServices services) {
	internalFrame = (BrowserInternalFrame) services;
	this.services = services;
	ClassFile classFile = services.getClassFile();
	MethodInfo[] methods = classFile.getMethods();
	this.setLayout(new CardLayout());

	for (int i = 0; i < methods.length; i++) {
		String methodIndex = Integer.toString(i);
		int codeLength = 0;
		int maxStack = 0;
		int maxLocals = 0;
		for (int j = 0; j < methods[i].getAttributes().length; j++) {
			if (methods[i].getAttributes()[j] instanceof CodeAttribute) {
				CodeAttribute ca = ((CodeAttribute) methods[i].getAttributes()[j]);
				codeLength = ca.getCode().length;
				maxStack = ca.getMaxStack();
				maxLocals = ca.getMaxLocals();
				break;
			}
		}

		addMiscPane(methodIndex, maxStack, maxLocals, codeLength, classFile);
	}
}
 
Example #19
Source File: java_awt_CardLayout.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void validate(CardLayout before, CardLayout after) {
    super.validate(before, after);
    try {
        Vector a = (Vector) VECTOR.get(after);
        Vector b = (Vector) VECTOR.get(before);
        int size = a.size();
        if (size != b.size()) {
            throw new Error("different content");
        }
        for (int i = 0; i < size; i++) {
            super.validator.validate(NAME.get(a.get(i)), NAME.get(b.get(i)));
            super.validator.validate(COMP.get(a.get(i)), COMP.get(b.get(i)));
        }
    }
    catch (Exception exception) {
        throw new Error(exception);
    }
}
 
Example #20
Source File: FilterPanelv2.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/** Optional check box selected. */
private void optionalCheckBoxSelected() {
    if (selectedNode instanceof ExpressionNode) {
        ExpressionNode expressionNode = (ExpressionNode) selectedNode;
        expressionNode.setOptionalParamUsed(optionalCheckBox.isSelected());

        CardLayout cardLayout = (CardLayout) dataPanel.getLayout();

        showDataPanel(cardLayout, expressionNode);

        if (!optionalCheckBox.isSelected()
                && (selectedNode.getParent() instanceof ExpressionNode)) {
            ExpressionNode parentNode = (ExpressionNode) selectedNode.getParent();
            if (parentNode != null) {

                int index = parentNode.getIndex(selectedNode);

                FunctionInterfaceUtils.handleFunctionInterface(parentNode, index);

                parentNode.setDisplayString();
                displayResult();
            }
        }
    }
}
 
Example #21
Source File: ScriptsListPanel.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
private void initialize() {
    this.setLayout(new CardLayout());
    this.setName(Constant.messages.getString("scripts.list.panel.title"));
    this.setIcon(ExtensionScriptsUI.ICON);
    this.setDefaultAccelerator(
            extension
                    .getView()
                    .getMenuShortcutKeyStroke(
                            KeyEvent.VK_S,
                            KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK,
                            false));
    this.setMnemonic(Constant.messages.getChar("scripts.list.panel.mnemonic"));

    this.add(getListPanel(), getListPanel().getName());
}
 
Example #22
Source File: SettingsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void lstCategoriesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstCategoriesValueChanged
    int idx = lstCategories.getSelectedIndex();
    CardLayout cardLayout = (CardLayout) pnlCards.getLayout();
    if ((idx >= 0) && (idx < CARDS.length)) {
        cardLayout.show(pnlCards, CARDS[idx]);
    }
}
 
Example #23
Source File: ZestResultsPanel.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
public ZestResultsPanel(ExtensionZest extension) {
    super();
    this.extension = extension;
    this.setLayout(new CardLayout());
    this.setName(Constant.messages.getString("zest.results.panel.title"));
    this.setIcon(ExtensionZest.ZEST_ICON);
    this.setDefaultAccelerator(
            this.extension
                    .getView()
                    .getMenuShortcutKeyStroke(KeyEvent.VK_Z, KeyEvent.SHIFT_DOWN_MASK, false));
    this.setMnemonic(Constant.messages.getChar("zest.results.panel.mnemonic"));

    this.add(getZestPanel(), getZestPanel().getName());
}
 
Example #24
Source File: CardTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
CardPanel(ActionListener actionListener) {
    listener = actionListener;
    setLayout(new CardLayout());
    add("one", create(new FlowLayout()));
    add("two", create(new BorderLayout()));
    add("three", create(new GridLayout(2, 2)));
    add("four", create(new BorderLayout(10, 10)));
    add("five", create(new FlowLayout(FlowLayout.LEFT, 10, 10)));
    add("six", create(new GridLayout(2, 2, 10, 10)));
}
 
Example #25
Source File: SwitchablePane.java    From DroidUIBuilder with Apache License 2.0 5 votes vote down vote up
/**
	 * 核心GUI初始化方法.
	 * 
	 * @param cards
	 */
	protected void initGUI(Object[][] cards)
	{
		// 实例化子各主要面板
		mainPane = new JPanel(new BorderLayout());
		cardPane = new JPanel(new CardLayout());
		FlowLayout btnPaneLayout = new FlowLayout(FlowLayout.CENTER);
		btnPaneLayout.setVgap(0);
		btnPane = new JPanel(btnPaneLayout);
		
		// 加入向前按钮
		addToBtnPane(initPreviousButton());
		// 加入页号按钮
		for(int i=0;i<cards.length;i++ )
		{
			Object[] cardInfo = cards[i];
//			String num = (String)cardInfo[0];
			JComponent c = (JComponent)cardInfo[0];
			String toolTipText = (String)cardInfo[1];
			
			// 此key即进分页组件的顺序号(从1开始),又将做为它
			// 位于CardLayout中的name(constraints),一举多得
			final String key = (i+1)+"";
			// 先在把要显示的内容组件加入到内容子面板中
			this.addCard(key, c, toolTipText);
			// 再把该分页内容组件对应的页号按钮加入到按钮面板中
			addToBtnPane(createPageButton(key, toolTipText));
		}
		// 加入向后按钮
		addToBtnPane(initNextButton());
		
		// 总体布局
		mainPane.add(cardPane, BorderLayout.CENTER);
		mainPane.add(btnPane, BorderLayout.SOUTH);
	}
 
Example #26
Source File: QOptionPane.java    From pumpernickel with MIT License 5 votes vote down vote up
private JComponent createDebugPanel() {
	BufferedImage img = (BufferedImage) getClientProperty("debug.ghost.image");

	if (img == null)
		return this;

	final CardLayout cardLayout = new CardLayout();
	final JPanel panel = new JPanel(cardLayout);

	JPanel imagePanel = new JPanel();
	imagePanel.setUI(new PanelImageUI(img));

	JPanel paneWrapper = new JPanel(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.NONE;
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 1;
	paneWrapper.add(this, c);

	panel.add(paneWrapper, "real");
	panel.add(imagePanel, "debug");

	Timer timer = new Timer(2000, new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			String mode = (System.currentTimeMillis() % 4000) > 2000 ? "real"
					: "debug";
			cardLayout.show(panel, mode);
		}
	});
	timer.start();

	return panel;
}
 
Example #27
Source File: FileChooserDemo.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("LeakingThisInConstructor")
WizardDialog(JFrame frame, boolean modal) {
    super(frame, "Embedded JFileChooser Demo", modal);

    cardLayout = new CardLayout();
    cardPanel = new JPanel(cardLayout);
    getContentPane().add(cardPanel, BorderLayout.CENTER);

    messageLabel = new JLabel("", JLabel.CENTER);
    cardPanel.add(chooser, "fileChooser");
    cardPanel.add(messageLabel, "label");
    cardLayout.show(cardPanel, "fileChooser");
    chooser.addActionListener(this);

    JPanel buttonPanel = new JPanel();
    backButton = new JButton("< Back");
    nextButton = new JButton("Next >");
    closeButton = new JButton("Close");

    buttonPanel.add(backButton);
    buttonPanel.add(nextButton);
    buttonPanel.add(closeButton);

    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    backButton.setEnabled(false);
    getRootPane().setDefaultButton(nextButton);

    backButton.addActionListener(this);
    nextButton.addActionListener(this);
    closeButton.addActionListener(this);

    pack();
    setLocationRelativeTo(frame);
}
 
Example #28
Source File: ExportPanel.java    From KEEL with GNU General Public License v3.0 5 votes vote down vote up
private void backPreviewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backPreviewButtonActionPerformed
    if (tmpTrainingExportedFile != null) {
        tmpTrainingExportedFile.delete();
//    if(tmpTestingExportedFile!=null)
//        tmpTestingExportedFile.delete();
    }
    ((CardLayout) this.getLayout()).show(this, lastSelectedPanel);
    lastSelectedPanel = "Preview";//GEN-LAST:event_backPreviewButtonActionPerformed
    }
 
Example #29
Source File: DefaultSuiteProjectDeletePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public DefaultSuiteProjectDeletePanel(ProgressHandle handle, String projectDisplaName, String projectFolder, boolean hasSourcesToDelete, boolean enableDeleteModulesCheckBox) {
    this.projectDisplaName = projectDisplaName;
    this.projectFolder = projectFolder;
    this.hasSourcesToDelete = hasSourcesToDelete;
    this.enableDeleteModulesCheckBox = enableDeleteModulesCheckBox;
    this.handle = handle;
    initComponents();
    attachListeners();
    if (Boolean.getBoolean("org.netbeans.modules.project.uiapi.DefaultProjectOperations.showProgress")) {
        ((CardLayout) progress.getLayout()).show(progress, "progress");
    }
}
 
Example #30
Source File: GroupingConfigurationPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
public GroupingConfigurationPanel(JTree plotConfigurationTree, PlotInstance plotIntance, PlotDimension dimension) {
	super(plotIntance);
	this.setLayout(new CardLayout());

	this.dimension = dimension;
	createComponents(dimension);
	registerAsPlotConfigurationListener();
	plotConfigurationTree.addTreeSelectionListener(this);

	adaptGUI();

}