private void run(String[] args) {
loadAndCheckArgs(args);
// Create a JPanel subclass to render the page
final XHTMLPanel panel = new XHTMLPanel();
// Set the XHTML document to render. We use the simplest form
// of the API call, which uses a File reference. There
// are a variety of overloads for setDocument().
try {
panel.setDocument(new File(fileName));
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
// Put our panel in a scrolling pane. You can use
// a regular JScrollPane here, or our FSScrollPane.
// FSScrollPane is already set up to move the correct
// amount when scrolling 1 line or 1 page
FSScrollPane scroll = new FSScrollPane(panel);
JFrame frame = new JFrame("Flying Saucer: " + panel.getDocumentTitle());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(BorderLayout.CENTER, scroll);
panel.setFontScalingFactor(1.15F);
panel.setMinFontScale(0.01F);
panel.setMaxFontScale(12F);
JButton smaller = new JButton("F-");
smaller.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
panel.decrementFontSize();
System.out.println("decremented");
}
});
JButton def = new JButton("F0");
def.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
panel.resetFontSize();
System.out.println("reset");
}
});
JButton larger = new JButton("F+");
larger.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
panel.incrementFontSize();
System.out.println("incremented");
}
});
JPanel top = new JPanel(new FlowLayout());
top.add(smaller);