Java Code Examples for java.awt.CardLayout#first()

The following examples show how to use java.awt.CardLayout#first() . 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: FileSaver.java    From GpsPrune with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize the dialog with the given details
 * @param inModel table model
 * @param inDefaultDelimiter default delimiter character
 */
private void initDialog(TableModel inModel, char inDefaultDelimiter)
{
	// set table model
	_table.setModel(inModel);
	// reset toggler
	_toggler.setListSize(inModel.getRowCount());
	// choose last-used delimiter as default
	switch (inDefaultDelimiter)
	{
		case ','  : _delimiterRadios[0].setSelected(true); break;
		case '\t' : _delimiterRadios[1].setSelected(true); break;
		case ';'  : _delimiterRadios[2].setSelected(true); break;
		case ' '  : _delimiterRadios[3].setSelected(true); break;
		default   : _delimiterRadios[4].setSelected(true);
					_otherDelimiterText.setText("" + inDefaultDelimiter);
	}
	_pointTypeSelector.init(_app.getTrackInfo());
	// set card and enable buttons
	CardLayout cl = (CardLayout) _cards.getLayout();
	cl.first(_cards);
	_nextButton.setEnabled(true);
	_backButton.setEnabled(false);
}
 
Example 2
Source File: SwingClientApplication.java    From chipster with MIT License 6 votes vote down vote up
public SimpleInternalFrame getTreeFrame() throws MicroarrayException {
	if (treeFrame == null) {
		treeFrame = new SimpleInternalFrame("Datasets");
					
		CardLayout cardLayout = new CardLayout();
		JPanel cardPanel = new JPanel(cardLayout);
		
		QuickLinkPanel linkPanel = new QuickLinkPanel();
		this.tree = new TreePanel(manager.getRootFolder(), cardPanel, cardLayout);
					
		cardPanel.add(linkPanel, "LINKS");
		cardPanel.add(tree, "TREE");
		
		treeFrame.add(cardPanel);
		cardLayout.first(cardPanel);
		
		return treeFrame;

	} else {
		return treeFrame;
	}
}
 
Example 3
Source File: FancyDropDownButton.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setArrowButtonVisible(boolean b) {
	CardLayout cl = (CardLayout) arrowButtonPanel.getLayout();
	if (b) {
		cl.first(arrowButtonPanel);
	} else {
		cl.last(arrowButtonPanel);
	}
}
 
Example 4
Source File: PlatformsCustomizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void selectPlatform (Node pNode) {
    Component active = null;
    for (Component c : cards.getComponents()) {
        if (c.isVisible() &&
            (c == jPanel1 || c == messageArea)) {
                active = c;
                break;
        }
    }
    final Dimension lastSize = active == null ?
        null :
        active.getSize();
    this.clientArea.removeAll();
    this.messageArea.removeAll();
    this.removeButton.setEnabled (false);
    if (pNode == null) {
        ((CardLayout)cards.getLayout()).last(cards);
        return;
    }
    JComponent target = messageArea;
    JComponent owner = messageArea;
    JavaPlatform platform = pNode.getLookup().lookup(JavaPlatform.class);
    if (pNode != getExplorerManager().getRootContext()) {
        if (platform != null) {
            this.removeButton.setEnabled (canRemove(platform, pNode.getLookup().lookup(DataObject.class)));
            if (!platform.getInstallFolders().isEmpty()) {
                this.platformName.setText(pNode.getDisplayName());
                for (FileObject installFolder : platform.getInstallFolders()) {
                    File file = FileUtil.toFile(installFolder);
                    if (file != null) {
                        this.platformHome.setText (file.getAbsolutePath());
                    }
                }
                target = clientArea;
                owner = jPanel1;
            }
        }
        Component component = null;
        if (pNode.hasCustomizer()) {
            component = pNode.getCustomizer();
        }
        if (component == null) {
            final PropertySheet sp = new PropertySheet();
            sp.setNodes(new Node[] {pNode});
            component = sp;
        }
        addComponent(target, component);
    }
    if (lastSize != null) {
        final Dimension newSize = owner.getPreferredSize();
        final Dimension updatedSize = new Dimension(
            Math.max(lastSize.width, newSize.width),
            Math.max(lastSize.height, newSize.height));
        if (!newSize.equals(updatedSize)) {
            owner.setPreferredSize(updatedSize);
        }
    }
    target.revalidate();
    CardLayout cl = (CardLayout) cards.getLayout();
    if (target == clientArea) {
        cl.first (cards);
    }
    else {
        cl.last (cards);
    }
}
 
Example 5
Source File: SdksCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void selectPlatform(Node pNode) {
    Component active = null;
    for (Component c : cards.getComponents()) {
        if (c.isVisible()
                && (c == jPanel1 || c == messageArea)) {
            active = c;
            break;
        }
    }
    final Dimension lastSize = active == null
            ? null
            : active.getSize();
    this.clientArea.removeAll();
    this.messageArea.removeAll();
    this.removeButton.setEnabled(false);
    if (pNode == null) {
        ((CardLayout) cards.getLayout()).last(cards);
        return;
    }
    JComponent target = messageArea;
    JComponent owner = messageArea;
    selectedPlatform = pNode.getLookup().lookup(AndroidSdk.class);
    if (pNode != getExplorerManager().getRootContext()) {
        if (selectedPlatform != null) {
            mkDefault.setEnabled(!selectedPlatform.isDefaultSdk());
            this.removeButton.setEnabled(!selectedPlatform.isDefaultSdk());
            if (!selectedPlatform.getInstallFolders().isEmpty()) {
                this.platformName.setText(pNode.getDisplayName());
                for (FileObject installFolder : selectedPlatform.getInstallFolders()) {
                    File file = FileUtil.toFile(installFolder);
                    if (file != null) {
                        this.platformHome.setText(file.getAbsolutePath());
                    }
                }
                target = clientArea;
                owner = jPanel1;
            }
        } else {
            removeButton.setEnabled(false);
            mkDefault.setEnabled(false);
        }
        Component component = null;
        if (pNode.hasCustomizer()) {
            component = pNode.getCustomizer();
        }
        if (component == null) {
            final PropertySheet sp = new PropertySheet();
            sp.setNodes(new Node[]{pNode});
            component = sp;
        }
        addComponent(target, component);
    }
    if (lastSize != null) {
        final Dimension newSize = owner.getPreferredSize();
        final Dimension updatedSize = new Dimension(
                Math.max(lastSize.width, newSize.width),
                Math.max(lastSize.height, newSize.height));
        if (!newSize.equals(updatedSize)) {
            owner.setPreferredSize(updatedSize);
        }
    }
    target.revalidate();
    CardLayout cl = (CardLayout) cards.getLayout();
    if (target == clientArea) {
        cl.first(cards);
    } else {
        cl.last(cards);
    }
}