I noticed the fonts look different when I run my Java Swing app from Netbeans and when I run it as a jar file from my C: drive on Windows 7.
I was told the fonts used in jars apps come from the system, so they look different from the fonts when run from Netbeans, so to keep my app look consistent from my IDE and from user perspective, how to locate the fonts being loaded into my app from Netbeans so I can copy them into my app and package them as part of my jar app, is this doable ? If so after I copy them into my app, how to load them inside my app ?
Here is the code and 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] </Td><Td>111 - AAA</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 2] </Td><Td>222 - BBB</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 3] </Td><Td>333 - CCC</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 4] </Td><Td>444 - DDD</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 5] </Td><Td>555 - EEE</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 6] </Td><Td>666 - FFF</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 7] </Td><Td>777 - GGG</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 8] </Td><Td>888 - HHH</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[ 9] </Td><Td>999 - III</Td><Td></Td></Tr>\n"
+" <Tr><Td Width=118 Align=Right>[10] </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(); } }); }
}