本文整理了Java中java.awt.CardLayout.addLayoutComponent()
方法的一些代码示例,展示了CardLayout.addLayoutComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CardLayout.addLayoutComponent()
方法的具体详情如下:
包路径:java.awt.CardLayout
类名称:CardLayout
方法名:addLayoutComponent
[英]Adds the specified component to this card layout's internal table of names. The object specified by constraints
must be a string. The card layout stores this string as a key-value pair that can be used for random access to a particular card. By calling the show
method, an application can display the component with the specified name.
[中]将指定的组件添加到此卡布局的内部名称表中。constraints
指定的对象必须是字符串。卡布局将此字符串存储为一个键值对,可用于随机访问特定卡。通过调用show
方法,应用程序可以显示具有指定名称的组件。
代码示例来源:origin: Multibit-Legacy/multibit-hd
@Override
public void addLayoutComponent(Component comp, Object constraints) {
super.addLayoutComponent(comp, constraints);
if (!(comp instanceof JComponent)) return;
JComponent component = (JComponent) comp;
cards.add(component);
if (firstCard == null)
firstCard = component;
lastCard = component;
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@Override
public void addLayoutComponent(Component comp, Object constraints) {
super.addLayoutComponent(comp, constraints);
if (constraints instanceof String) {
comps.put((String) constraints, comp);
cards.put(comp, (String) constraints);
}
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing
@Override
public void addLayoutComponent(Component comp, Object constraints) {
super.addLayoutComponent(comp, constraints);
contexts.add((Serializable) constraints);
if (log.isDebugEnabled()) {
log.debug(this + " new constraints : " + constraints);
}
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime
@Override
public void addLayoutComponent(Component comp, Object constraints) {
super.addLayoutComponent(comp, constraints);
contexts.remove(constraints);
contexts.add((Serializable) constraints);
if (log.isDebugEnabled()) {
log.debug(this + " new constraints : " + constraints);
}
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime
@Override
public void addLayoutComponent(Component comp, Object constraints) {
super.addLayoutComponent(comp, constraints);
contexts.remove(constraints);
contexts.add((Serializable) constraints);
if (log.isDebugEnabled()) {
log.debug(this + " new constraints : " + constraints);
}
}
代码示例来源:origin: vasl-developers/vasl
private void addOption(String name, Component c) {
for (int i = 0; i < optionList.getModel().getSize(); ++i) {
if (optionList.getModel().getElementAt(i).equals(name))
return;
}
((DefaultListModel) optionList.getModel()).addElement(name);
options.add(c, name);
card.addLayoutComponent(c, name);
}
代码示例来源:origin: stackoverflow.com
// original cardPanel1 name is "card1"
CardLayout lay = (CardLayout)parentPanel.getLayout();
lay.removeLayoutComponent(cardPanel1);
lay.addLayoutComponent(cardPanel1, "card4");
// cardPanel1 can now be shown using "card4" name
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb
@Override
final protected void addTabWork(JComponent comp) {
final String cardName = cardName(comp);
cardContainer.add(cardName, comp);
cardLayout.addLayoutComponent(comp, cardName);
components.add(comp);
notify(comp);
}
代码示例来源:origin: stackoverflow.com
cl.addLayoutComponent(homePermissionsPanel, HOME);
cl.addLayoutComponent(administrationPermissionsPanel, ADMIN);
cl.show(cardContainerPanel, (String)evt.getItem());
代码示例来源:origin: stackoverflow.com
menu.add(playGame);
gui.add(menu);
cl.addLayoutComponent(menu, "menu");
cl.addLayoutComponent(pipes, "game");
代码示例来源:origin: stackoverflow.com
public class MyFrameManager {
private JFrame frame;
private CardLayout frameLayout;
public MyFrameManager() {
super();
frame = new JFrame("My App");
frame.setLayout(frameLayout = new CardLayout());
frame.setSize(320, 240);
// Adding to the layout all possible interfaces, each referenced by its name
for (PossibleInterfacesEnum e : PossibleInterfacesEnum.values()) {
frameLayout.addLayoutComponent(e.getInstance(), e.name());
}
}
public void showInterface(PossibleInterfacesEnum e) {
frameLayout.show(frame.getContentPane(), e.name());
if (!frame.isVisible()) {
frame.setVisible(true);
}
}
}
代码示例来源:origin: stackoverflow.com
menu.add(playGame);
gui.add(menu);
cl.addLayoutComponent(menu, "menu");
cl.addLayoutComponent(pipes, "game");
代码示例来源:origin: stackoverflow.com
ImagePanel imgPanel = new ImagePanel(name, image);
cardPanel.add(imgPanel, name);
cardLayout.addLayoutComponent(imgPanel, name);
代码示例来源:origin: stackoverflow.com
ImagePanel imgPanel = new ImagePanel(name, image, clr);
cardPanel.add(imgPanel, name);
cardLayout.addLayoutComponent(imgPanel, name);
代码示例来源:origin: stackoverflow.com
ImagePanel imgPanel = new ImagePanel(name, image, clr);
cardPanel.add(imgPanel, name);
cardLayout.addLayoutComponent(imgPanel, name);
代码示例来源:origin: stackoverflow.com
ImagePanel imgPanel = new ImagePanel(name, image, clr);
cardPanel.add(imgPanel, name);
cardLayout.addLayoutComponent(imgPanel, name);
内容来源于网络,如有侵权,请联系作者删除!