📜 ⬆️ ⬇️

Improved 9-patch editor

Good afternoon, habrazhitel!

image I'm sure with the nine-patch format everyone has long been familiar with, probably even used it more than once in their Android projects (and maybe even somewhere else). Also about it a little less than a year ago, skkap wrote a short article about what kind of format it is and “what it is eaten with.” He also described the tool offered for quick editing of these very files.

Actually, almost a year has passed since that moment, and I stumbled upon that article again and, recalling complaints from my friends about the inconvenience of this very “tool,” decided to see if there were any other options and, to my great surprise, I did not find any. Probably because the format doesn’t represent anything complex and specific (if desired, nine-patch files can be edited in almost any graphical editor that supports png) and, all the more, there is already a ready-made tool (albeit not the most convenient).
')
Then I decided to personally get down to business ...

First sketches


So, in a few days on the basis of my own developed library I managed to achieve quite good, I think, results - I would like to share them with you. Let all angles have not been smoothed out, there are some flaws and, possibly, bugs (well, where there are none), but still ...

Actually, the very small editor application looks like this:
image

Several advantages compared to the previously mentioned "ancient" tulza:
These are advantages related solely to editing nine-patch files in a ready-made visual editor. The jar file of the application itself can be used as a plug-in library for parsing nine-patch images, embedding the editor in your own Java applications, styling components and much more, but I will not spray it - I’ll talk about this in a separate an article in the java blog for anyone interested.

A little description ...


Actually, when working with this editor you will have to deal with several parts of it ...

Main toolbar
image
Editor
image
Image preview
image
In general, that's all. You can see and feel the rest by launching the application on your own.

By the way, by default, this image opens for editing:
image

Actually, the application:
Running jar
imageimageimage


Naturally, you will need jre installed on your OS to run.
The application should work on any OS where JDK 1.6.20+ (or OpenJDK) is available.

In custody


I hope those who often work with nine-patch files this editor will help make life easier :)

Naturally, the editor will continue to develop little by little with the library if there are good suggestions for improving it.

Speaking of birds, the Web Look and Feel library itself, as well as this editor, written on its basis, are distributed under the GPLv3 license and have completely open source code.

Since the newer version of the library on which this editor is based has not yet been released - you can download the source directly from here:
http://weblookandfeel.com/downloads/ninepatch-sources.zip

A library distribution without source from here:
http://weblookandfeel.com/downloads/ninepatch.jar

I will also be happy to hear any comments and suggestions and ...
Thank you for your attention!

# Update


After a few comments, as well as finding a couple of bugs, I made small changes to the library and editor, which was actually changed:
I am also aware of the last remaining problem - incorrect work of the file selector. This problem will be fixed a little later, along with the release of the next version of the Web Look and Feel library.

You can download binaries and sources from the old links - they have already been updated:
Running jar | Source code | Net library

Source: https://habr.com/ru/post/136667/


All Articles