0

I wrote a program, exported it as ".jar" and ran it on a computer other than my developer desktop PC. The problem arose that the entire JFrame on the laptop was smaller and therefore certain texts were replaced with "..." because the component was too small to display it completely. Now the question arises is there the possibility to change my text size dynamically that it is always getting displayed completely?

Edit 1: My problem is that I first have to get the font size at which my text is replaced by "...".

|that is the code| |that is the code

|that is how the gui should look (It looks like this on my desktop pc)| |that is how the gui should look

|that is how the gui looks on my laptop| that is how the gui looks on my laptop

Hans Wurst
  • 13
  • 5
  • Does this answer your question? [Java/swing font resize not working across platforms](https://stackoverflow.com/questions/29235228/java-swing-font-resize-not-working-across-platforms) – Marc K Jun 30 '20 at 15:11
  • @MarcK I will try it out... Answer in 10 mins – Hans Wurst Jun 30 '20 at 15:15
  • @MarcK the solution did not worked out. – Hans Wurst Jun 30 '20 at 15:36
  • @HansWurst try to find out a good scale of font-size to component size. Check which size the component actually is in your code and adjust the font-size according to the component size. – Felix Jun 30 '20 at 15:44
  • Alternatively, use a layout manager to scale the label to its content, not the other way around. –  Jun 30 '20 at 15:51
  • @codeflush.dev thied what you said, but it did not work – Hans Wurst Jun 30 '20 at 15:58
  • @Taschi yes I think thats the only way how to do it... – Hans Wurst Jun 30 '20 at 16:01
  • In the case of the screenshot, you could also just add a few extra pixels to the label - there's plenty of space to the left and right, anyway. –  Jun 30 '20 at 16:09

1 Answers1

0

I have not really a solution to the problem but I know what was the fault. My windows was scaled to 125% so some text dissapeared...

Hans Wurst
  • 13
  • 5