Java Code Examples for java.awt.CardLayout

The following examples show how to use java.awt.CardLayout. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: intellij   Source File: BlazeSelectWorkspaceControl.java    License: 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 2
Source Project: openjdk-8   Source File: CardTest.java    License: 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 3
Source Project: openjdk-jdk9   Source File: CardTest.java    License: 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 4
Source Project: TencentKona-8   Source File: CardTest.java    License: 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
@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 6
Source Project: Java-MP3-player   Source File: PlayerTest.java    License: 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 7
Source Project: sldeditor   Source File: FilterPanelv2.java    License: 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 8
Source Project: hottub   Source File: java_awt_CardLayout.java    License: 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 9
Source Project: ApkToolPlus   Source File: QuantDetailPane.java    License: 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 10
Source Project: zap-extensions   Source File: TechPanel.java    License: 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 11
@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 12
Source Project: DeconvolutionLab2   Source File: SystemInfo.java    License: 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 13
Source Project: azure-devops-intellij   Source File: MergeBranchForm.java    License: 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 14
Source Project: netbeans   Source File: RepositorySelectorBuilder.java    License: 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 15
/**
 * 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 16
Source Project: netbeans   Source File: HardStringWizardPanel.java    License: 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 17
Source Project: zap-extensions   Source File: ClientsPanel.java    License: 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 18
Source Project: jdk8u-jdk   Source File: CardTest.java    License: 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 19
Source Project: netbeans   Source File: ResultViewPanel.java    License: 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 20
Source Project: netbeans   Source File: InitPanel.java    License: 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 21
Source Project: pumpernickel   Source File: QOptionPane.java    License: 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 22
Source Project: sldeditor   Source File: GeoServerStyleTree.java    License: GNU General Public License v3.0 5 votes vote down vote up
/** Initialise. */
public void initialise() {
    rootNode = new DefaultMutableTreeNode(NOT_CONNECTED);

    treeModel = new DefaultTreeModel(rootNode);

    tree.setModel(treeModel);

    CardLayout cardLayout = (CardLayout) styleCardPanel.getLayout();
    cardLayout.show(styleCardPanel, EMPTY_PANEL);
}
 
Example 23
@Override
protected CardLayout getAnotherObject() {
    CardLayout layout = new CardLayout();
    layout.addLayoutComponent(new JLabel("a"), "a");
    layout.addLayoutComponent(new JLabel("b"), "b");
    layout.addLayoutComponent(new JLabel("c"), "c");
    layout.addLayoutComponent(new JLabel("d"), "d");
    return layout;
}
 
Example 24
Source Project: WorldGrower   Source File: InventoryDialog.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void setTargetInventoryOnTop(ActionEvent e) {
	CardLayout cardLayout = (CardLayout) rootInventoryPanel.getLayout();
	cardLayout.show(rootInventoryPanel, "target");
	playercharacterToggleButton.setFont(Fonts.FONT);
	playercharacterToggleButton.setSelected(false);
	targetToggleButton.setFont(Fonts.FONT);
	targetToggleButton.setSelected(true);
}
 
Example 25
Source Project: netbeans   Source File: RepositorySelectorBuilder.java    License: Apache License 2.0 5 votes vote down vote up
private void displayEmptyPanel() {
    if (!emptyPanelInitialized) {
        cardsPanel.add(new JPanel(), EMPTY_PANEL);
        emptyPanelInitialized = true;
    }
    ((CardLayout) cardsPanel.getLayout()).show(cardsPanel, EMPTY_PANEL);

    if (repositoryFormVisible) {
        repositoryFormsPanel.removeChangeListener(repositoryFormPanelListener);
        repositoryFormVisible = false;
    }
    setDataValid(true);
}
 
Example 26
/**
 * Creates the data source connector panel.
 *
 * @return the component
 */
private Component createDataSourceConnectorPanel() {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    Map<Class<?>, DataSourceConnectorInterface> dscMap =
            DataSourceConnectorFactory.getDataSourceConnectorList();

    //
    // Set up the card layout from the available data source connectors
    //
    dscPanel = new JPanel();
    dscPanel.setLayout(new CardLayout());

    for (Entry<Class<?>, DataSourceConnectorInterface> entry : dscMap.entrySet()) {
        DataSourceConnectorInterface dsConnector = entry.getValue();
        JPanel panelToAdd = dsConnector.getPanel();
        dscPanel.add(panelToAdd, dsConnector.getDisplayName());
    }
    mainPanel.add(dscPanel, BorderLayout.CENTER);

    JPanel panel1 = new JPanel();
    panel1.setLayout(new FlowLayout(FlowLayout.LEADING));
    JLabel label =
            new JLabel(
                    Localisation.getString(
                            DataSourceConfigPanel.class, "DataSourceConfigPanel.dataSource"));

    panel1.add(label);

    mainPanel.add(panel1, BorderLayout.NORTH);

    return mainPanel;
}
 
Example 27
@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 Project: jdk8u-dev-jdk   Source File: CardTest.java    License: 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 29
@Override
protected CardLayout getAnotherObject() {
    CardLayout layout = new CardLayout();
    layout.addLayoutComponent(new JLabel("a"), "a");
    layout.addLayoutComponent(new JLabel("b"), "b");
    layout.addLayoutComponent(new JLabel("c"), "c");
    layout.addLayoutComponent(new JLabel("d"), "d");
    return layout;
}
 
Example 30
Source Project: nordpos   Source File: JPanelConfigHardware.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void jcboMachinePrinterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachinePrinterActionPerformed
    CardLayout cl = (CardLayout) (m_jPrinterParams1.getLayout());
    if (jcboMachinePrinter.getSelectedItem().equals("printer")) {
        cl.show(m_jPrinterParams1, "printer");
    } else if (jcboMachinePrinter.getSelectedItem().equals("extended")) {
        cl.show(m_jPrinterParams1, "extended");
    } else {
        cl.show(m_jPrinterParams1, "empty");
    }
}