亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 Java 中更改 ICEPDF 的外觀和感覺

在 Java 中更改 ICEPDF 的外觀和感覺

呼如林 2021-10-13 16:40:56
我使用 IcePDF 作為 PDF 查看器,PropertiesManager我可以啟用/禁用功能,例如:    SwingController controller = new SwingController();    PropertiesManager properties = new PropertiesManager(System.getProperties(),            ResourceBundle.getBundle(PropertiesManager.DEFAULT_MESSAGE_BUNDLE));    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_UTILITY_PRINT, false);    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_TOOLBAR_ANNOTATION, false);    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_UTILITYPANE_ANNOTATION, false);    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_TOOLBAR_ROTATE, false);    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_UTILITY_SAVE, false);    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_TOOLBAR_FIT, false);    SwingViewBuilder factory = new SwingViewBuilder(controller, properties);但是我想改變Windows的外觀和感覺,簡單的UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());不起作用。有人可以解決嗎?
查看完整描述

2 回答

?
哈士奇WWW

TA貢獻1799條經驗 獲得超6個贊

我終于在代碼的開頭添加了:


try {

  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

} catch (ClassNotFoundException | InstantiationException | IllegalAccessException

        | UnsupportedLookAndFeelException e) {

  System.err.println("[ err. ] " + e);

}

它有效。


查看完整回答
反對 回復 2021-10-13
?
搖曳的薔薇

TA貢獻1793條經驗 獲得超6個贊

org.icepdf.ri.viewer.Launcher 類設置在查看器 jar 中找到的查看器 RI 的外觀和感覺。這是一個較舊的類,但如果您想覆蓋它,它仍然使用 PropertiesManager。你可以這樣做:

preferences.put("application.lookandfeel", "javax.swing.plaf.metal.MetalLookAndFeel");

這是針對 ICEpdf 6.3.x 的,但如果您使用的是早期版本,則可以使用與原始帖子類似的模式。該值可以是 Swing 的任何有效外觀。


查看完整回答
反對 回復 2021-10-13
  • 2 回答
  • 0 關注
  • 196 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號