0

when i whats use extends JFrame in my class this error display: Access restriction: The type JLabel is not accessible due to restriction on required library C: \Program Files\Java\jre1.8.0_45\lib\rt.jar

what should i do?

mfathi
  • 119
  • 1
  • 4
  • 1
    A tip for once you've solved the immediate problem: *"i whats use extends JFrame"* Don't extend `JFrame`, it is a poor practice. Just use an instance of a standard `JFrame`. – Andrew Thompson Jun 28 '15 at 11:49
  • @AndrewThompson - sorry for the intrusion, didn't know if a new question was appropriate. Why is it poor practise? Closest I could find is - http://stackoverflow.com/questions/9742018/is-it-always-a-bad-idea-to-extend-jframe which doesn't give much in the definitive. – Gorbles Jun 29 '15 at 13:07
  • 1
    @Gorb *"doesn't give much in the definitive."* From the accepted answer. *"only subclass if you need to **customize** the Swing component."* And by 'customize' a programmer would read `@Override` somewhere in the new class definition. The words 'customize' does not just mean change the look and feel or the icon or transparency of a frame, but instead to change the standard `JFrame` methods. – Andrew Thompson Jun 29 '15 at 13:12
  • Ah, sorry, didn't see it was accepted. That makes sense regardless - your clarification about `@Override` is appreciated. – Gorbles Jun 29 '15 at 13:42

0 Answers0