MCPcopy Create free account
hub / github.com/ArtifexSoftware/mupdf / Viewer

Method Viewer

platform/java/example/Viewer.java:253–403  ·  view source on GitHub ↗
(String documentPath)

Source from the content-addressed store, hash-verified

251 }
252
253 public Viewer(String documentPath) {
254 pixelScale = getRetinaScale();
255 screenDPI = getScreenDPI();
256 screenSize = getScreenSize();
257
258 currentDPI = zoomList[findNextLargerZoomLevel(screenDPI - 1)];
259
260 setTitle("MuPDF: ");
261
262 outlinePanel = new Panel(new BorderLayout());
263 {
264 outlineList = new List();
265 outlineList.addItemListener(this);
266 outlinePanel.add(outlineList, BorderLayout.CENTER);
267 }
268 this.add(outlinePanel, BorderLayout.WEST);
269 outlinePanel.setMinimumSize(new Dimension(300, 300));
270 outlinePanel.setPreferredSize(new Dimension(300, 300));
271 outlinePanel.setVisible(false);
272
273 Panel rightPanel = new Panel(new BorderLayout());
274 {
275 Panel toolpane = new Panel(new GridBagLayout());
276 {
277 GridBagConstraints c = new GridBagConstraints();
278 c.fill = GridBagConstraints.HORIZONTAL;
279 c.anchor = GridBagConstraints.WEST;
280
281 Panel toolbar = new Panel(new FlowLayout(FlowLayout.LEFT));
282 {
283 firstButton = new Button("|<");
284 firstButton.addActionListener(this);
285 prevButton = new Button("<");
286 prevButton.addActionListener(this);
287 nextButton = new Button(">");
288 nextButton.addActionListener(this);
289 lastButton = new Button(">|");
290 lastButton.addActionListener(this);
291 pageField = new TextField(4);
292 pageField.addActionListener(this);
293 pageLabel = new Label("/ " + pages);
294
295 toolbar.add(firstButton);
296 toolbar.add(prevButton);
297 toolbar.add(pageField);
298 toolbar.add(pageLabel);
299 toolbar.add(nextButton);
300 toolbar.add(lastButton);
301 }
302 c.gridy = 0;
303 toolpane.add(toolbar, c);
304
305 toolbar = new Panel(new FlowLayout(FlowLayout.LEFT));
306 {
307 zoomOutButton = new Button("Zoom-");
308 zoomOutButton.addActionListener(this);
309 zoomInButton = new Button("Zoom+");
310 zoomInButton.addActionListener(this);

Callers

nothing calls this directly

Calls 9

getRetinaScaleMethod · 0.95
getScreenDPIMethod · 0.95
getScreenSizeMethod · 0.95
valueOfMethod · 0.80
startMethod · 0.80
packMethod · 0.80
addMethod · 0.45
openDocumentMethod · 0.45

Tested by

no test coverage detected