Вопрос

Я хотел бы использовать класс TrueTyPefont от Sun.Font.truetypefont Package в моем апплете, но Eclipse поддерживает жалобу на конструктор, не быть видимым:

import sun.font.TrueTypeFont;
.
.
.    
new TrueTypeFont("a", new Object(), 1, false);
.

Выход:

    - The constructor TrueTypeFont(String, Object, int, boolean) is not visible
.

Есть ли способ исправить это?Есть ли способ бросить класс Font для TrueTypeFont?Мне нужно получить данные, предоставляемые методами TrueTyPefefont.

Это было полезно?

Решение

You have multiple problems there:

  • sun.font.TrueTypeFont is an implementation class that you shouldn't be playing around with.
  • It's constructor is "package private" (default access) which means you can't access it from another package (which is what Eclipse happens to be telling you).
  • Even if you could access it, an [untrusted] applet cannot access sun.* classes (controlled by the package.access security property).
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top