本文整理匯總了Java中java.awt.CardLayout類的典型用法代碼示例。如果您正苦於以下問題:Java CardLayout類的具體用法?Java CardLayout怎麽用?Java CardLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CardLayout類屬於java.awt包,在下文中一共展示了CardLayout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ResultViewPanel
import java.awt.CardLayout; //導入依賴的package包/類
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
}
示例2: DefaultProjectRenamePanel
import java.awt.CardLayout; //導入依賴的package包/類
/**
* Creates new form DefaultProjectRenamePanel
*/
public DefaultProjectRenamePanel(ProgressHandle handle, Project project, String name) {
this.project = project;
this.handle = handle;
if (name == null) {
name = ProjectUtils.getInformation(project).getDisplayName();
}
initComponents();
projectName.setText(name);
projectName.getDocument().addDocumentListener(this);
updateProjectFolder();
validateDialog();
if (Boolean.getBoolean("org.netbeans.modules.project.uiapi.DefaultProjectOperations.showProgress")) {
((CardLayout) progress.getLayout()).show(progress, "progress");
}
}
示例3: ProjectCopyPanel
import java.awt.CardLayout; //導入依賴的package包/類
/**
* Creates new form ProjectCopyPanel
*/
public ProjectCopyPanel(ProgressHandle handle, Project project, boolean isMove) {
this.project = project;
this.isMove = isMove;
this.handle = handle;
initComponents();
setProject();
projectName.getDocument().addDocumentListener(this);
projectLocation.getDocument().addDocumentListener(this);
if (isMove) {
nameLabel.setVisible(false);
projectName.setVisible(false);
warningTextArea.setVisible(false);
}
if (Boolean.getBoolean("org.netbeans.modules.project.uiapi.DefaultProjectOperations.showProgress")) {
((CardLayout) progress.getLayout()).show(progress, "progress");
}
}
示例4: validate
import java.awt.CardLayout; //導入依賴的package包/類
@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);
}
}
示例5: ConfirmationPanel
import java.awt.CardLayout; //導入依賴的package包/類
@Messages({
"LBL_FormattingQuestion=Recursively format the selected files and folders?",
"LBL_FormattingInProgress=Formatting:"
})
public ConfirmationPanel(ProgressHandle handle) {
initComponents();
setLayout(new CardLayout());
add(new JLabel(Bundle.LBL_FormattingQuestion()), PANEL_QUESTION);
JPanel progress = new JPanel(new BorderLayout());
JLabel inProgressLabel = new JLabel(Bundle.LBL_FormattingInProgress());
inProgressLabel.setBorder(new EmptyBorder(0, 0, 6, 0));
progress.add(inProgressLabel, BorderLayout.NORTH);
progress.add(ProgressHandleFactory.createProgressComponent(handle), BorderLayout.CENTER);
add(progress, PANEL_PROGRESS);
((CardLayout) getLayout()).show(this, PANEL_QUESTION);
}
示例6: initComponents
import java.awt.CardLayout; //導入依賴的package包/類
private void initComponents() {
setLayout(new BorderLayout());
noResultsPanel = new JPanel();
noResultsPanel.setLayout(new BorderLayout());
noResultsPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
final JLabel noResultsLabel = new JLabel(NO_RESULTS_STRING);
noResultsLabel.setFont(noResultsLabel.getFont().deriveFont(14));
noResultsLabel.setEnabled(false);
noResultsPanel.add(noResultsLabel, BorderLayout.NORTH);
resultsTable = new JPanel(new CardLayout());
resultsTable.add(noResultsLabel, "NORESULTS"); // NOI18N
add(resultsTable, BorderLayout.CENTER);
}
示例7: valueChanged
import java.awt.CardLayout; //導入依賴的package包/類
public void valueChanged(ListSelectionEvent evt) {
if (evt.getValueIsAdjusting() == false && browsersModel.isAdjusting() == false) {
int index = browsersList.getSelectedIndex();
String panelID = browsersModel.getPropertyPanelID(index);
((CardLayout) customPropertyPanel.getLayout()).show(customPropertyPanel, panelID);
nameTextField.setText(browsersModel.getBrowserName(index));
if (browsersModel.isDefaultBrowser(index)) {
// if any of default browsers is selected then browser name won't be editable and remove button disabled
nameTextField.setEditable(false);
removeButton.setEnabled(false);
} else {
nameTextField.setEditable(true);
removeButton.setEnabled(true);
}
browsersModel.setSelectedValue(browsersList.getSelectedValue());
}
}
示例8: actionPerformed
import java.awt.CardLayout; //導入依賴的package包/類
@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);
}
}
示例9: createComponent
import java.awt.CardLayout; //導入依賴的package包/類
/** Gets component to display. Implements superclass abstract method.
* @return this instance */
protected Component createComponent() {
JPanel panel = new JPanel(new CardLayout());
// Accessibility
panel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ResourceWizardPanel.class).getString("ACS_ResourceWizardPanel"));
panel.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(1));
String msgKey = testWizard ? "TXT_SelectTestResource" //NOI18N
: "TXT_SelectResource"; //NOI18N
panel.setName(NbBundle.getMessage(ResourceWizardPanel.class, msgKey));
panel.setPreferredSize(I18nWizardDescriptor.PREFERRED_DIMENSION);
panel.add(getUI(), CARD_GUI);
return panel;
}
示例10: readSettings
import java.awt.CardLayout; //導入依賴的package包/類
/** 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);
}
}
示例11: createComponent
import java.awt.CardLayout; //導入依賴的package包/類
/** Gets component to display. Implements superclass abstract method.
* @return this instance */
protected Component createComponent() {
JPanel panel = new JPanel(new CardLayout());
panel.getAccessibleContext().setAccessibleDescription(
NbBundle.getMessage(
TestStringWizardPanel.class,
"ACS_TestStringWizardPanel")); //NOI18N
panel.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX,
Integer.valueOf(2));
panel.setName(
NbBundle.getMessage(TestStringWizardPanel.class,
"TXT_FoundMissingResource")); //NOI18N
panel.setPreferredSize(I18nWizardDescriptor.PREFERRED_DIMENSION);
return panel;
}
示例12: adaptGUI
import java.awt.CardLayout; //導入依賴的package包/類
@Override
protected void adaptGUI() {
DimensionConfig dimensionConfig = getPlotConfiguration().getDimensionConfig(dimension);
if (dimensionConfig != null) {
CardLayout cl = (CardLayout) this.getLayout();
GroupingType groupingType = null;
ValueGrouping grouping = dimensionConfig.getGrouping();
if (grouping != null) {
groupingType = grouping.getGroupingType();
} else {
groupingType = GroupingType.NONE;
}
cl.show(this, groupingType.toString());
}
}
示例13: createBackButton
import java.awt.CardLayout; //導入依賴的package包/類
private JComponent createBackButton() {
JButton backButton = new JButton(new ResourceAction("getting_started.back", new Object[0]) {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
CardLayout layout = (CardLayout)OpenProcessCard.this.getLayout();
layout.show(OpenProcessCard.this, "overview");
OpenProcessCard.this.isOverviewShown = true;
if(OpenProcessCard.this.entryList.getModel().getSize() > 0) {
OpenProcessCard.this.entryList.setSelectedIndex(0);
}
OpenProcessCard.this.entryList.requestFocusInWindow();
}
});
backButton.setFocusable(false);
this.styleButton(backButton);
return backButton;
}
示例14: swap
import java.awt.CardLayout; //導入依賴的package包/類
public void swap(int index1, int index2) {
Component[] components = new Component[imageListElements.size()];
for (int i = 0; i < imageListElements.size(); i++) {
components[i] = multiPanel.getComponent(i);
}
multiPanel.removeAll();
cl = new CardLayout();
multiPanel.setLayout(cl);
for (int i = 0; i < imageListElements.size(); i++) {
Component c = null;
if (i == index1) {
c = components[index2];
}
else if (i == index2) {
c = components[index1];
}
else {
c = components[i];
}
multiPanel.add(c, "Image " + (i+1));
}
imageList.setSelectedIndex(index2);
showSelected();
}
示例15: initializeComponents
import java.awt.CardLayout; //導入依賴的package包/類
public void initializeComponents() {
channelBox = new JCheckBox("Filter by channel", false);
allSets = new SettingsPanel(r);
rSets = new SettingsPanel(r);
gSets = new SettingsPanel(r);
bSets = new SettingsPanel(r);
channelPane = new JTabbedPane();
channelPane.add("Red", rSets);
channelPane.add("Green", gSets);
channelPane.addTab("Blue", bSets);
cardPanel = new JPanel(new CardLayout());
cardPanel.add(allSets, "all");
cardPanel.add(channelPane, "rgb");
}