• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

A conundrum with seting Graphics font size

 
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Setting the font size is not working. This is the code:

However, in the same application the following works:

I have tried variations, Graphics2D, whatever. I don't know what I am doing wrong.
 
Rancher
Posts: 3262
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your SSCCE demonstrating the problem.
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob:

These are my three classes:


 
Rob Camick
Rancher
Posts: 3262
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is NOT a SSCCE. Your question is about font size. You need to create a simple program that does some simple custom painting on a panel. It will probably be about 20-30 lines of code. Once you get that simple program working you can compare that code with your real program to see what the difference is. Once you know what the difference is you should be able to solve your problem.
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your patience Rob. I created a simple JPanel:

I put the panel in a form and it works fine. I am not claiming that the method dawString of Graphics doesn't work. My problem is that in the classes that I presented earlier it doesn't behave as expected and I don't know what I am doing wrong.
 
Rob Camick
Rancher
Posts: 3262
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So then you start modifying the simple example so that it looks more like your real program. Then when it stops working you have isolated the problem. Then maybe we can help you.
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Rob for your good advise. I removed code from my original classes and copied the code from the new class and now everything works. No w the problem is that I am not getting key pressed events in my new class, but it is so simple that I will post a new question with it.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic