0
0
0xDubas2016-10-15 08:52:26
Java
0xDubas, 2016-10-15 08:52:26

Awt.Graphics - draw() works, but drawString() doesn't. Why?

Hello, here is the code:

public class PlayerOverlay extends Window {
    public PlayerOverlay(Window owner) {
        super(owner, WindowUtils.getAlphaCompatibleGraphicsConfiguration());
//        setBackground(new Color(0, 0, 0, 0));
        setBackground(new Color(255,255,204, 120));
    }
    
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 
        
        g2.setColor(Color.red);
        g2.draw(new java.awt.geom.Line2D.Double(0, 0, 500, 500));
        
        g2.setColor(Color.blue);
        g2.drawString("TEEEEXT",  300, 300);
        
        g2.draw(new java.awt.geom.Line2D.Double(0, 500, 500, 0));
    }
}

ec6ea7ad947340449289a670dd534083.png
As you can see in the image, the lines are drawn, but the text is not.
There are suspicions of under-installed system packages, tk. text rendering worked on my home computer but didn't work on my work. The other day I reinstalled the system at home, now the text is not rendered at home either.
I ask for your help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2016-10-15
@Rou1997

Instead of suspicion, my religion instructs me in such cases to study the source code of the library, this is about packages, but if you need as many computers as possible, then use virtual machines and VPS, which I preach to you about!

0
0xDubas, 2016-10-15
@0xDubas

Собственно дело скорее всего в библиотеке VLCJ. С помощью которой, я хочу рисовать поверх фильма.
Сделал пару тестовых приложений, в Swing все отлично рисуется и текст в том числе. А если тоже самое делать поверх фильма, то текст не отрисовывается (тест vlcj/OverlayTest.java отрисовывает объекты, но не пишет текст).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question