There are a few things not quite right with your code.
Firstly, Text
does not extend from anything that is paintable, so paint
will never be called. Convention tends to favor overriding paintComponent
of Swing components anyway.
Also, you should always call super.paintXxx
, this would have highlighted the problem in the first place.
Secondly, components are normally added to some kind container which takes care of painting them for you.
If you want to use Swing components in your program, I'd suggest taking a look at Creating a GUI With JFC/Swing.
If you want to paint text, I'd suggest you take a look at 2D Graphics, in particular Working with Text APIs
An bit more information about what it is you're trying to achieve might also help
Also, I'm not sure if this deliberate or not, but public void main(){
ins't going to act as the main entry point of the program, it should be public static void main(String args[])
, but you might just be using main
as means to call into the class from else where ;)