Cannot remove JLabel (Netbeans)

情到浓时终转凉″ 提交于 2019-12-10 15:35:16

问题


(sorry for my english) When I add JLabel to Form in Netbeans, I couldn´t move with it.I removed it from form. Now I want compile project and it show error message:

error: cannot find symbol jLabel8 = new javax.swing.JLabel();

other jLabels are ok, but this one is wrong. i remove it from form, but it is always in inspector.

check printscreens (1. jLabel8 is wrong, i cant remove it; 2.other labels are ok, in menu is option to delete) :

Screen1:

Screen2:


回答1:


1) to hard to help you with Java Desktop Aplications, because this Framework based on Swing methods is long time depreciated and un_suported, these areas were supported on NetBeans Forums, but looks like as these forums are long time died too,

2) use Standard Swing JComponents, by using Standard LayoutManagers and listening for events by Standard Listeners rather that use Java Desktop Aplications Framework

3) for better help sooner please post here question that contains SSCCE examples for SSCCE,

EDIT

4) in some cases isn't possible directly override basic Swing methods by using this Framework, f.e. starting with to change Java Cup Icon for FrameView




回答2:


Open the .form file corresponding to your frame (you'll find it in <your_netbeans_projects_directory/<your_project>/src).

It's an XML file, there you can delete reference to jLabel8. But I don't recommend to do that if you feel it's to tricky/risky.

A safer solution you can try is deleting the parent component of jLabel8 and create it again.



来源:https://stackoverflow.com/questions/8869489/cannot-remove-jlabel-netbeans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!