how to copy properties of a jlabel to another new jlabel

I want to copy my private jlabel object to a new jlabel object and make the new one public. Idea is to allow anyone to access jlabel's properties but not to allow make any changes that will be displayed on the original interface. Below code doesnt work as it simply copies the reference of the original object. public javax.swing.JLabel getCopyOfLabel(int labelno) { javax.swing.JLabel newlbl = new javax.swing.JLabel(); if (labelno == 0) { newlbl = lbl_0_original; return newlbl; } else if (labelno == 1) { newlbl = lbl_1_original; return newlbl; } else { newlbl = lbl_2_original; return newlbl; } } How can I do it the way I want? Can I use clone() on this? Thank You

以上就是how to copy properties of a jlabel to another new jlabel的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏