java

Applet Runner 2.5

Screenshot of Applet Runner running in IntelliJ IDEA

I’ve just released Applet Runner and Applet Runner Pro version 2.5.

Applet Runner is a plugin for JetBrains IDE’s (IntelliJ IDEA, Android Studio, …), Eclipse and NetBeans that allows to run applets in embedded your IDE. Applet Runner Pro offers more possibilities like running the applets in a standalone application, customizing the toolbar, define a start-up url, restrict applets to a whitelist domain or blacklist based on regular expression.

What’s new in 2.5:

Many new applets in bookmarks

  • Control Dashboard: Monitor resources like website in your IDE
  • M2 Repo Cleaner: Clean old files in your maven repository
  • Screen Highlighter: Highlight part of the screen
  • Website Optimizer: Optimize your static websites
  • Tree Data Explorer: Combine XML, JSON and YAML viewer
  • Sheet Stats: Statistics of Excel files
  • Discotheek: Transform your monitor in a spotlight
  • Post On Screen: Show text with gradient color
  • Decoration: Image batch processor
  • Pastel: Simpler version of Decoration
  • Poster Font: Text to image title
  • Poster Font Light: Simpler version of Poster Font
  • VR Photo Converter: Convert VR180 photo to cross-eyed view or SBS
  • Dictaphone: Record and replay audio from your computer
  • The Desktop Watchmaker
  • Screenshot Crop

Other changes

  • Added .java to possible files that can be opened
  • Try to compile .java file if .class not found or less recent on local files
  • Compile standard project if pom.xml, build.gradle or build.xml is found
  • Moved some bookmarks to new categories: Multimedia & Developers
  • Some bug fixes and small improvements

Applet Runner Pro

  • Possibility to pass javac.release=<version> query parameter for .java URL’s
  • Option to reload applet when the local file changes (also recompile for .java)
Applet Runner (Pro) what’s new in version 2.5

Eclipse Plugin Applet Runner 2.0.0 Released

Applet Runner 2 plugin running in Eclipse IDE

I’m pleased to announce the release of Applet Runner 2.0.0 Eclipse IDE plugin.

What’s new:

  • Office
    • PDF Viewer
    • Microsoft Word Viewer (docx)
    • Excel & CSV Viewer (xlsx, xls, cvs)
    • Powerpoint Viewer (pptx)
    • MP3 Player (mp3, ogg)
    • Video Player (mp4, mkv, mp3, avi, …)
  • Text Utilities
    • Clipboard History
    • JSON Viewer
    • XML Viewer
    • YAML Viewer
  • Tetris game
  • Terminal (JediTerm)
  • HTML Browser (Browser FX) for Windows
  • Ant Commander Pro file manager as trial
  • Bug fixed and small improvements (See changes.txt)
Web Browser running in Applet Runner plugin in Eclipse IDE

Please share this post or video

Applet Runner 2023.2.0 JetBrains IDE Plugin Released

Applet Runner plug with PDF Viewer in IntelliJ IDEA

I’m pleased to announce the release of Applet Runner 2023.2.0 JetBrains IDE plugin. This plugin runs in IntelliJ IDEA, Android Studio, PyCharm, WebStorm, PhpStorm and Rider.

This version brings new tools to the IDE. Many new type of files can be opened and more things can be done without you leaving your favorite IDE. What’s new:

  • Office
    • PDF Viewer
    • Microsoft Word Viewer (docx)
    • Excel & CSV Viewer (xlsx, xls, cvs)
    • Powerpoint Viewer (pptx)
    • MP3 Player (mp3, ogg)
    • Video Player (mp4, mkv, mp3, avi, …)
  • Text Utilities
    • Clipboard History
    • JSON Viewer
    • XML Viewer
    • YAML Viewer
  • Tetris game
  • HTML Browser (Browser FX) for Windows or if JavaFX runtime is loaded
  • Ant Commander Pro file manager as trial
  • Bug fixed and small improvements (See changes.txt)
Demo of new applets available in Applet Runner 2023.2.0 JetBrains plugin

Please share with colleagues and friends.

A YAML Viewer for IntelliJ IDEA

Yaml viewer running in IntelliJ IDEA

I’ve just released a new free YAML Viewer that runs in IntelliJ IDEA and other JetBrains IDE’s such as Android Studio.

You can open yml/yaml local files or paste YAML from the clipboard. If you have a large file, the tree navigator and the breadcrumb will help view to view only a small part of the YAML.

To run it, download the free Applet Runner plugin from JetBrains marketplace and execute the free YAML viewer located at https://www.japplis.com/tree-data-explorer/online/yaml-viewer.html.

Applet Runner 1.3 released

I’m please to announce the release of Applet Runner 1.3. Applet Runner is a free IDE plug-in (Eclipse, IntelliJ IDEA/JetBrains, NetBeans) that lets you run Java applications embedded in the IDE.

Applet Runner running in NetBeans with Japplis Toolbox applet

What’s new:

  • Applet.stop() is called when the applet is closed
  • If you buy Applet Runner Pro, you will be able to fill in the license key in Applet Runner for NetBeans and Eclipse
  • Better codebase detection if the URL class location contains ‘/com/’ or ‘/org/’
  • Many improvements in the application framework (about 150)
    • Fixed license agreement window not appearing on top of other windows
    • Translate Ctrl, Shift, Alt to the correct keyboard sign for Mac OS X
    • Added SettingPanel#getLabel that can also handle tooltips
    • If Flat IntelliJ look and feel is selected -> unlock the possibility to provide an IntelliJ Theme
    • Improved quality of taking a screenshot of a component
    • Improved creating square buttons for IconFontSwing#decorateButton
    • Catch possible error when getting the clipboard data flavor
    • Fixed start-up error if FlatLaf not in classpath
    • Added possibility to skip entering the license key the first day of the installation
    • Added scroll bar if the setting panel doesn’t fit in the window

Note that Applet Runner Pro 1.3 has also been released. Applet Runner Pro allows to have multiple applets running at the same time and is available as standalone application for Windows, Mac OS & Linux.

Paving the on-ramp – Day 2 – SwingUtilities.showInFrame

There is recently an increased interest to ease the learning curve of Java for students on Day 1 of class. Brian Goetz (the architect of Java) made a proposal to eliminate some code. My proposition is a (independent) continuation to ease the learning of Java.

Day 1 (as proposed by Brian Goetz)

class HelloWord {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

Simplifies to

void main() {
println("Hello World");
}

Day 2 (as proposed by me – Anthony Goubard)

import javax.swing.*;

void main() {
    SwingUtilities.invokeAndWait(() -> {
     	JFrame frame = new JFrame("Test");
       	frame.add(new JLabel("Hello World"));
       	frame.pack();
       	frame.setLocationRelativeTo(null);
       	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       	frame.setVisible(true);
    }
}

Simplifies to

import javax.swing.*;

void main() {
    SwingUtilities.showInFrame("Test", () -> new JLabel("Hello World"));
}

The on-ramp

  • No need to understand the concept of the Event Dispatch Thread (EDT) where UI operations should be done
  • No need to understand yet the concept of laying out components (pack())
  • No need to know the class JFrame and 5 of its methods
  • The focus is more on the intention of the program: Showing the text “Hello World” in a window with title “Test”

Other benefits (than the on-ramp)

  • Cleaner Stack overflow Swing examples.
  • Ease of use with JShell.
  • Event Dispatch Thread detection. Let’s face, it when it’s a small program, a lot of people forget to do the UI in the EDT.
  • Single Java execution java HelloWorld.java would require less code.
  • No language or compiler change needed.

Proposed implementation

    // public domain license - Should be in SwingUtilities
    /**
     * Show a window containing the provided component.
     * The window will exit the application on close.
     *
     * @param title the title of the window
     * @param panel the supplier for the component to show in the window
     * @return the created component
     */
    public static <T extends JComponent> T showInFrame(String title, Supplier<T> panel) {
        Function<T, JFrame> frameSupplier = createdPanel -> {
            JFrame frame = new JFrame(title);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(createdPanel);
            frame.setLocationRelativeTo(null);
            frame.pack();
            frame.setVisible(true);
            return frame;
        };
        boolean isInEDT = SwingUtilities.isEventDispatchThread();
        if (isInEDT) {
            T createdPanel = panel.get();
            frameSupplier.apply(createdPanel);
            return createdPanel;
        } else {
            List<T> result = new ArrayList<>();
            List<Exception> exception = new ArrayList<>();
            try {
                SwingUtilities.invokeAndWait(() -> {
                    try {
                        T createdPanel = panel.get();
                        frameSupplier.apply(createdPanel);
                        result.add(createdPanel);
                    } catch (Exception ex) {
                        exception.add(ex);
                    }
                });
            } catch (InterruptedException | InvocationTargetException ex) {
                throw new RuntimeException(ex);
            }
            if (!exception.isEmpty()) {
                Exception ex = exception.get(0);
                if (ex instanceof RuntimeException) throw (RuntimeException) ex;
                else throw new RuntimeException(ex);
            }
            return result.get(0);
        }
    }

Advanced

The created component is returned so you can use it further in your code. With the returned component, you also have access to the created JFrame by using SwingUtilities.windowForComponent method.

I’ve decided to wrap the exception in a RuntimeException is there is an error during the creation of the component. So you get a similar behavior whether you call this method from the Event Dispatch Thread or not.

Even though the example is with a JLabel, I would expect most of the usage will be passing a Suppier<JPanel> and probably like MyPanel::new as it’s quite common in Swing to have classes extending JPanel.

Another possibility would be to return void and use SwingUtilities.invokeLater() method. This way no need to do all the exception code and no need to have List<T> result. Comment in the reddit discussion if it’s your preference (Link below).

My history

Back when I was a student (1995), I remember it took me half a day to try to show a window on Windows 95 as I was using Borland C++. I copied the code word by word from a book as otherwise it wouldn’t work. A few days later while asking a teacher if we could have an interesting project, he told us “Sun Microsystem has just released a new language, it’s in alpha version but let’s do a project with it.”. I took the language, typed Frame frame = new Frame("Test"); frame.show(); and voilà! It was a whoa moment where I realized I would spend a lot of time with this language 😃.

Conclusion

Quite often, you see in conferences presentations about “what’s new in Java xx”, that we may forget that for some people everything is new. Paving the on-ramp doesn’t have to be a compiler or language change, it could be methods, documentation, videos, …

I think the next step would be to create a RFE ticket in the JDK bug system, but first I will wait for comments in the reddit discussion.

Hello World in Java, the difference between now and what it could be

Ant Commander Pro 4.0 beta released

The first public available of Ant Commander Pro 4.0 file manager has been released. You can download it for free at https://www.antcommander.com.

Ant Commander Pro file manager screenshot
Ant Commander Pro Dual table

The main advantages compared to a standard file manager:

  • Smart incremental search (e.g. */ & .java & <5days & > 10 kb & ![junit])
  • Basic Git support
  • Detect (and ask) file conflicts before file operation (like copy/move)
  • Support local file, zip, jar, tar, gz, bzip2, ftp, ftps, sftp, webdav, ram, lst, http(s)
  • Multiple split panels in each tabs
  • Panels: Terminal, SSH, Text editor with syntax highlight
  • > 40 skins
  • Runs always on top, translucent, on Windows, Mac OS X, Linux, embedded in IntelliJ IDEA, Android Studio, Eclipse, NetBeans

Better JSON formatting with Japplis Toolbox 5.1

Japplis Toolbox 5.1 has been released.

Japplis Toolbox is a free desktop software (Windows, Mac OS X, Linux) with more than 50 text utilities.

What’s new:

  • Better JSON formatter (faster, can handle more text, better formatting)
  • New utility: sort by regular expression
    • In case you don’t want to sort by the start of a line, you can specify a regular expression group and it will sort the lines by it
  • When Live is selected, operation is executed on every valid change of the pattern
  • Improved showing Swing properties: border UI applied to view, input keys and actions shown for InputMap UI
  • Loading and saving files use UTF-8 encoding
  • Various bug fixes and small improvements

Japplis Toolbox Pro 5.1 has also been released.

What’s new:

  • Added option in settings to unpack gz files
  • Added option in settings to disable/enable line wrap for input and output text area

JSON formatter

Japplis Toolbox JSON formatter