/*
* Copyright 2006-2013 ICEsoft Technologies Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package test;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.icepdf.ri.common.SwingViewBuilder;
/**
* The ViewerComponentExample
class is an example of how to use
* SwingController
and SwingViewBuilder
* to build a PDF viewer component. A file specified at the command line is
* opened in a JFrame which contains the viewer component.
*
* @since 2.0
*/
public class AnnotationTester {
public static void main(String[] args) {
// Get a file from the command line to open
//String filePath = args[0];
JFrame applicationFrame = new JFrame();
applicationFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
applicationFrame.setTitle("Test von Annotationen");
MySwingController _ICEpdfController = new MySwingController();
_ICEpdfController.setIsEmbeddedComponent(true);
// add interactive mouse link annotation support via callback
_ICEpdfController.getDocumentViewController().setAnnotationCallback(
new org.icepdf.ri.common.MyAnnotationCallback(
_ICEpdfController.getDocumentViewController()));
// Build a SwingViewFactory configured with the controller
SwingViewBuilder _ICEpdfViewBuilder = new SwingViewBuilder(_ICEpdfController);
applicationFrame.setJMenuBar(_ICEpdfViewBuilder.buildCompleteMenuBar());
// Look and Feel setzen
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(applicationFrame);
} catch (Exception e) {
e.printStackTrace();
}
JPanel lPanel = new JPanel();
lPanel.setLayout(new BorderLayout());
// lPanel.add(this._erbean.getEReviewPanel(), BorderLayout.CENTER);
lPanel.add(_ICEpdfViewBuilder.buildViewerPanel(), BorderLayout.CENTER);
applicationFrame.setContentPane(lPanel);
// show the component
applicationFrame.pack();
applicationFrame.setVisible(true);
}
}