[英]How do I create a new object in java that has the properties of another one without declaring it?
例如,我有一个带有设置图标,名称和标签的JButton; 如何制作可以添加到面板的新JButton?
JButton b1=new JButton();
b1.set[whatever needs to be set];
JPanel p=new JPanel();
p.add(new JButton()[that has the properties of b1]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.