How to locate the fonts being used by my Java Swing app on the system? -


i noticed fonts different when run java swing app netbeans , when run jar file c: drive on windows 7.

i told fonts used in jars apps come system, different fonts when run netbeans, keep app consistent ide , user perspective, how locate fonts being loaded app netbeans can copy them app , package them part of jar app, doable ? if after copy them app, how load them inside app ?

here code , images :

import java.awt.*; import java.awt.event.windowadapter; import java.awt.event.windowevent; import javax.swing.*;  public class test_jpanel extends jpanel {   public static final long serialversionuid=26362862l;   static dimension screen_size=toolkit.getdefaulttoolkit().getscreensize();   thread empty_jpanel_thread;    public test_jpanel()   {     setpreferredsize(new dimension(300,600));     string table="<html>\n"+                  "  <center><br>\n"                  +"test table<p>\n"                  +"    <table border=0 cellpadding=1 cellspacing=1 width=286>\n"                  +"      <tr><td width=118 align=right>[ 1]&nbsp;&nbsp;</td><td>111 - aaa</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 2]&nbsp;&nbsp;</td><td>222 - bbb</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 3]&nbsp;&nbsp;</td><td>333 - ccc</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 4]&nbsp;&nbsp;</td><td>444 - ddd</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 5]&nbsp;&nbsp;</td><td>555 - eee</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 6]&nbsp;&nbsp;</td><td>666 - fff</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 7]&nbsp;&nbsp;</td><td>777 - ggg</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 8]&nbsp;&nbsp;</td><td>888 - hhh</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[ 9]&nbsp;&nbsp;</td><td>999 - iii</td><td></td></tr>\n"                  +"      <tr><td width=118 align=right>[10]&nbsp;&nbsp;</td><td>000 - jjj</td><td></td></tr>\n"                  +"    </table>\n"                  +"  </center>\n"                  +"<hr width=100%>\n"                  +"</html>";     jlabel alabel=new jlabel(table);     alabel.setfont(new font("dialog",0,18));     alabel.setopaque(true);     alabel.setpreferredsize(new dimension(285,413));     add(alabel);    }    static void create_and_show_gui()   {     final test_jpanel demo=new test_jpanel();      jframe frame=new jframe("test_jpanel");     frame.add(demo);     frame.addwindowlistener(new windowadapter() { public void windowclosing(windowevent e)  { system.exit(0); } });     frame.pack();     frame.setlocationrelativeto(null);     frame.setvisible(true);   }    public static void main(string[] args) { swingutilities.invokelater(new runnable() { public void run() { create_and_show_gui(); } }); } } 

enter image description here

this not answer looking in question, answer problem fixed. found problem less font difference, more html table spacing, replaced "cellpadding=1" "cellpadding=0" when running in jar, fixed problem.

so app first detects if it's running ide or running jar, when run ide, cellpadding=1 , when run jar, cellpadding=0, make app same in 2 situations.

i hope can fixed java side instead of app.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -