org.jpedal.objects.javascript.jsobjects.JSConsole Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer for NetBeans plugin
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* JSConsole.java
* ---------------
*/
package org.jpedal.objects.javascript.jsobjects;
import javax.swing.JDialog;
import javax.swing.JTextArea;
import org.jpedal.objects.javascript.JSApp;
public class JSConsole {
private JDialog consoleDialog;
private JTextArea consoleArea;
// This isn't part of the Adobe JS API, but is a common method in web JS
public void log(final String s) {
if (JSApp.showOutput) {
System.out.println("JAVASCRIPT: " + s);
}
if (consoleArea != null) {
consoleArea.append(s + '\n');
}
}
public void println(final String s) {
if (JSApp.showOutput) {
System.out.println("JAVASCRIPT: " + s);
}
if (consoleArea != null) {
consoleArea.append(s + '\n');
}
}
public void show() {
if (JSApp.showOutput) {
System.out.println("console.show()");
}
if (consoleDialog != null) {
consoleDialog.setVisible(true);
}
}
public void clear() {
if (JSApp.showOutput) {
System.out.println("console.clear()");
}
if (consoleArea != null) {
consoleArea.setText(null);
consoleArea.getCaret().setVisible(true);
}
}
public void hide() {
if (JSApp.showOutput) {
System.out.println("console.hide()");
}
if (consoleDialog != null) {
consoleDialog.setVisible(false);
}
}
}