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

The following examples show how to use java.awt.CardLayout#show() . 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: MapRender.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Data source loaded.
 *
 * @param geometryType the geometry type
 * @param isConnectedToDataSourceFlag the is connected to data source flag
 */
@Override
public void dataSourceLoaded(
        GeometryTypeEnum geometryType, boolean isConnectedToDataSourceFlag) {

    this.geometryType = geometryType;
    featureList = DataSourceFactory.getDataSource().getFeatureSource();

    userLayerFeatureListMap = DataSourceFactory.getDataSource().getUserLayerFeatureSource();
    gridCoverage = DataSourceFactory.getDataSource().getGridCoverageReader();

    calculateMapBounds();

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

    if ((geometryType == GeometryTypeEnum.UNKNOWN) || !isConnectedToDataSourceFlag) {
        cardLayout.show(mapPanel, NOMAP_PANEL);
    } else {
        cardLayout.show(mapPanel, MAP_PANEL);

        internalRenderStyle();
    }
}
 
Example 2
Source File: ResearcherPanel.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the scientific study and researcher to display. If either parameter is
 * null, display blank pane.
 * 
 * @param study      the scientific study.
 * @param researcher the researcher.
 */
void setStudyResearcher(ScientificStudy study, Person researcher) {
	this.study = study;
	this.researcher = researcher;

	CardLayout cardLayout = (CardLayout) getLayout();
	if ((study == null) || (researcher == null)) {
		cardLayout.show(this, Msg.getString("ResearcherPanel.blank")); //$NON-NLS-1$
	} else {
		cardLayout.show(this, Msg.getString("ResearcherPanel.researcher")); //$NON-NLS-1$

		if (researcher.equals(study.getPrimaryResearcher())) {
			researcherHeader.setText(Msg.getString("ResearcherPanel.primaryResearcher")); //$NON-NLS-1$
			scienceLabel.setText(study.getScience().getName()); // $NON-NLS-1$
		} else {
			researcherHeader.setText(Msg.getString("ResearcherPanel.collaborativeResearcher")); //$NON-NLS-1$
			ScienceType collabScience = study.getCollaborativeResearchers().get(researcher.getIdentifier());
			scienceLabel.setText(collabScience.getName()); // $NON-NLS-1$
		}

		nameButton.setText(researcher.getName());

		update();
	}
}
 
Example 3
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 4
Source File: SimulateControlPanel.java    From VanetSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * stop simulation
 */
public void stopSimulation(){
	CardLayout cl = (CardLayout)(startStopJPanel_.getLayout());
	cl.show(startStopJPanel_, "start"); //$NON-NLS-1$
	Runnable job = new Runnable() {
		public void run() {
			VanetSimStart.getSimulationMaster().stopThread();
		}
	};
	new Thread(job).start();	
	
	
}
 
Example 5
Source File: JPanelConfigHardware.java    From nordpos with GNU General Public License v3.0 5 votes vote down vote up
private void jcboMachineDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachineDisplayActionPerformed
    CardLayout cl = (CardLayout) (m_jDisplayParams.getLayout());
    if (jcboMachineDisplay.getSelectedItem().equals("extended")) {
        cl.show(m_jDisplayParams, "extended");
    } else {
        cl.show(m_jDisplayParams, "empty");
    }
}
 
Example 6
Source File: CreateMissionWizard.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/** Go to previous wizard panel. */
public void buttonClickedPrev() {
	getCurrentWizardPanel().clearInfo();
	displayPanelIndex--;
	CardLayout layout = (CardLayout) infoPane.getLayout();
	layout.show(infoPane, getCurrentWizardPanel().getPanelName());
	nextButton.setEnabled(true);
	if (displayPanelIndex == 0) prevButton.setEnabled(false);
}
 
Example 7
Source File: SimulateControlPanel.java    From VanetSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * starts simulation
 */
public void startSimulation(){
	if(VanetSimStart.getMainControlPanel().getEditPanel().getEditMode() == true) ErrorLog.log(Messages.getString("SimulateControlPanel.simulationNotPossibleInEditMode"), 6, this.getName(), "startSim", null); //$NON-NLS-1$ //$NON-NLS-2$
	else {
		CardLayout cl = (CardLayout)(startStopJPanel_.getLayout());
		cl.show(startStopJPanel_, "pause"); //$NON-NLS-1$
		VanetSimStart.getSimulationMaster().startThread();
	}		
}
 
Example 8
Source File: DescriptionInfoTab.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void install()
{
	selectionModel.addListSelectionListener(this);
	currentPage.restoreModels();
	CardLayout pages = (CardLayout) pagePanel.getLayout();
	pages.show(pagePanel, currentPage.id);
}
 
Example 9
Source File: JPanelConfigHardware.java    From nordpos with GNU General Public License v3.0 5 votes vote down vote up
private void jcboMachinePLUDeviceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboMachinePLUDeviceActionPerformed
    CardLayout cl = (CardLayout) (m_jPLUParams.getLayout());
    if (jcboMachinePLUDevice.getSelectedItem().equals("extended")) {
        cl.show(m_jPLUParams, "extended");
    } else {
        cl.show(m_jPLUParams, "empty");
    }
}
 
Example 10
Source File: FileChooserDemo.java    From jdk8u_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 11
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 12
Source File: FileChooserDemo.java    From openjdk-jdk8u 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 13
Source File: InventoryDialog.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
private void setPlayerCharacterPanelOnTop(ActionEvent e) {
	CardLayout cardLayout = (CardLayout) rootInventoryPanel.getLayout();
	cardLayout.show(rootInventoryPanel, "player");
	playercharacterToggleButton.setFont(Fonts.FONT);
	playercharacterToggleButton.setSelected(true);
	targetToggleButton.setFont(Fonts.FONT);
	targetToggleButton.setSelected(false);
}
 
Example 14
Source File: FileChooserDemo.java    From TencentKona-8 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 15
Source File: MemoryMergePanel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void create() {
	setLayout(new BorderLayout());

	JPanel boxPanel = new JPanel();
	boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));

	cardLayout = new CardLayout();
	cardPanel = new JPanel(cardLayout);
	cardPanel.setBorder(BorderFactory.createTitledBorder("Resolve Block Conflict"));
	ChangeListener listener = new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			mergeManager.setApplyEnabled(true);
		}
	};
	commentPanel = new CommentsConflictPanel(listener);
	cardPanel.add(commentPanel, COMMENT_PANEL_ID);

	namePanel = new BlockConflictPanel(listener);
	cardPanel.add(namePanel, CONFLICT_PANEL_ID);

	cardLayout.show(cardPanel, CONFLICT_PANEL_ID);

	countPanel = new ConflictCountPanel();
	boxPanel.add(countPanel);
	boxPanel.add(Box.createVerticalStrut(10));
	boxPanel.add(cardPanel);

	add(boxPanel, BorderLayout.CENTER);
	add(createUseForAllCheckBox(), BorderLayout.SOUTH);
}
 
Example 16
Source File: MavenRunOptions.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void loadOptions(ActionEvent e) {
    ActionToGoalMapping mapp = handle.getActionMappings((ModelHandle2.Configuration) cbConfiguration.getSelectedItem());
    List<NetbeansActionMapping> lst = mapp.getActions();
    run = null;
    debug = null;
    for (NetbeansActionMapping m : lst) {
        if (ActionProvider.COMMAND_RUN.equals(m.getActionName())) {
            run = m;
        }
        if (ActionProvider.COMMAND_DEBUG.equals(m.getActionName())) {
            debug = m;
        }
    }
    if (run == null) {
        run = ModelHandle2.getDefaultMapping(ActionProvider.COMMAND_RUN, project);
    }
    if (debug == null) {
        debug = ModelHandle2.getDefaultMapping(ActionProvider.COMMAND_DEBUG, project);
    }
    /*
    if (run == null) {
        // disable
        Queue<JComponent> comps = new ArrayDeque<>();
        comps.add(nestedOptions);
        while (!comps.isEmpty()) {
            JComponent c = comps.poll();
            c.setEnabled(false);
            if (c.getComponentCount() > 0) {
                Component[] children = c.getComponents();
                for (Component cc : children) {
                    if (cc instanceof JComponent) {
                        comps.offer((JComponent)cc);
                    }
                }
            }
        }
    } else {
        nestedOptions.readOptions(run.getProperties());
    }
    */
    CardLayout cl = (CardLayout)detailPanel.getLayout();
    if (run == null) {
        cl.show(detailPanel, "disabled");
    } else {
        nestedOptions.readOptions(run.getProperties());
        cl.show(detailPanel, "jshell");
    }
}
 
Example 17
Source File: JTicketsBagLocationMap.java    From nordpos with GNU General Public License v3.0 4 votes vote down vote up
private void showView(String view) {
    CardLayout cl = (CardLayout) (getLayout());
    cl.show(this, view);
}
 
Example 18
Source File: PreviewPanel.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
private void showCardRight(String card) {
    CardLayout cl = (CardLayout) (displayWithPreview.getLayout());
    cl.show(displayWithPreview, card);
}
 
Example 19
Source File: JPrincipalApp.java    From nordpos with GNU General Public License v3.0 4 votes vote down vote up
private void showView(String sView) {
    CardLayout cl = (CardLayout) (m_jPanelContainer.getLayout());
    cl.show(m_jPanelContainer, sView);
}
 
Example 20
Source File: ToolPanel.java    From chipster with MIT License 2 votes vote down vote up
/**
 * Activate a certain card in the operation panel.
 * 
 * Currently you can choose between categorized operations and
 * a list of filtered operations.
 */
private void showOperationCard(String card) {
    CardLayout cl = (CardLayout)(operationCardPanel.getLayout());
    cl.show(operationCardPanel, card);
}