This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 124 - Pages: 9 [ Previous | 1 ... 3 4 5 6 7 8 9 | Next ] - Last Post: 25-Jul-2015 21:51 Last Post By: ctwist Threads: [ Previous | Next ]
JeffTucker

Posts: 6,962
Registered: 31-Jan-2006
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 18:07   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
It seems like BeanShell has problems with inner classes sometimes.

TomCee and I stumbled onto this a few years ago. Using anonymous inner classes in the Matrix onload.bsh worked, but was almost spectacularly slow. It was evident that BeanShell could not handle it gracefully. That was one of things that finally drove me to bite the bullet, bring my GUI setup into NetBeans, and start compiling the beast.
ctwist

Posts: 546
Registered: 27-Sep-2003
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 18:37   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Last night I had another look at your code.

I have completed the conversion to compiled Java. The panorama setting works reliably.

To switch to this, you don't need to install Netbeans or Eclipse. Instead, you can just install the Java JDK. Then whenever you change a Java class, you run the Java compiler (just run a simple command file). If this reports any errors, fix them. Otherwise you are ready to test.

Let me know if you want me to upload this.
TomCee

Posts: 307
Registered: 11-Jul-2005
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 18:46   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
yeah, David should remember that. He provided us a timer for loading times :D
AndreWolff

Posts: 1,775
Registered: 14-Dec-2007
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 19:15   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
To switch to this, you don't need to install Netbeans or Eclipse. Instead, you can just install the Java JDK.
I just did this, but I can't find the icon to start it, there is only a Java Mission Control icon, but I don't think this has anything to do with compiling Java.
Let me know if you want me to upload this.
I can always try it, so please do. But please give me a hint how to start the compiler with your sources.
JeffTucker

Posts: 6,962
Registered: 31-Jan-2006
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 19:21   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
I just did this, but I can't find the icon to start it...

The Java JDK is not an application. You can't "launch" it. It's a toolkit. If you want to use the compiler, it's a command-line executable (javac.exe) that requires arguments, flags, etc. That's why I just work within NetBeans, which really is an application with a user interface, one-click compiling, etc. It rides on top of the Java JDK.
AndreWolff

Posts: 1,775
Registered: 14-Dec-2007
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 23:19   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks jGromit for your answer. I was already afraid that I should install NetBeans as well.

Is there a NetBeans tutorial which is also valid for the latest version of jAlbum, Java SDK and NetBeans?
JeffTucker

Posts: 6,962
Registered: 31-Jan-2006
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 05-Jun-2015 23:45   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
NetBeans is usually bundled with the Java JDK:

http://www.oracle.com/technetwork/articles/javase/jdk-netbeans-jsp-142931.html

If you already have JDK 8u45, you can just download NetBeans:

https://netbeans.org/downloads/

In one respect, things are about to get simpler. The current version of jAlbum is still compatible with Java 6, which meant that you had to be a little careful about not using any post-Java 6 methods, and had to compile to Java 6 standards. Messy. But jAlbum 13 will require Java 8, so the time has come to stop worrying about that.

I've already posted a thread about how to set up and use NetBeans: http://jalbum.net/forum/thread.jspa?threadID=49244
ctwist

Posts: 546
Registered: 27-Sep-2003
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 06-Jun-2015 01:11   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Replace onload.bsh with these files, then make an album.

This is based on your onload.bsh dated 27 May. I tested one of the filechoosers; it didn't work. Maybe you already know how to fix it.

In the src folder there is a separate Java class for each panel. You will recognize the code; I have just moved it around.

To revert to bsh (if it goes horribly wrong), restore your old onload.bsh. The files in the src and plugins folders will be ignored.

Change the source code as you do now, presumably with a text editor. After changing a .java file, run the command file compile_all.bat. This compiles all the .java files, reports errors, creates .class files and moves these into the plugins folder.

If jAlbum is installed in a different folder, you will have to edit compile_all.bat, and change the paths.

After you have decided that this is a better way, the next step is to move up to Eclipse or Netbeans. These have an intelligent front end that assists and speeds up your coding.
AndreWolff

Posts: 1,775
Registered: 14-Dec-2007
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 06-Jun-2015 11:29   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Attachment screenshot.3.png (4,2 KB)
ctwist wrote:
Replace onload.bsh with these files, then make an album.
You did a lot of work to provide me a compiled version!

Thank you! Thank you! Thank you!

I did replace onload.bsh by your files and it works perfect, the panorama panel but also the filechoosers, I see no problems with the filechoosers.

I see only 2 problems:
I see is that my name is now wrongly spelled: André instead of André and
the selection of an mp3 file does not work.

May be the last problem is caused because you commented out the
getFileToRes(String[] ext, JTextField name)
version of getFileToRes. However Laza says that it should be possible to declare two versions of this function, see http://jalbum.net/forum/thread.jspa?messageID=296706 aqnd it works in the uncompiled version.

I use the 64 bits version of jAlbum and the files are in folder C:\Program Files (x86)\jAlbum_64, so I did edit the batch file.

But compiling all does not work, I get message 'javac' is not recognized as an internal or external command, see enclosed screen-shot.
ctwist

Posts: 546
Registered: 27-Sep-2003
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 06-Jun-2015 12:52   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
You did a lot of work to provide me a compiled version!

Thank you! Thank you! Thank you!

You are welcome. It wasn't that difficult because I have done this before, and Eclipse prompted me with all the problems that needed to be fixed.
Actually I had a second motive. jGromit provided simple instructions for converting the skin GUI to compiled code. I decided that a more comprehensive example was needed. I will use Slide Show 4 to show what needs to be changed.
I see is that my name is now wrongly spelled: André instead of André
The files should be UTF8 encoded. Maybe I accidentally changed the encoding.
the selection of an mp3 file does not work.
May be the last problem is caused because you commented out the
getFileToRes(String[] ext, JTextField name)
version of getFileToRes. However Laza says that it should be possible to declare two versions of this function, see http://jalbum.net/forum/thread.jspa?messageID=296706 aqnd it works in the uncompiled version.
I commented getFileToRes because Eclipse said that it was not used. It was a private method, which means it can only be called from within SkinUI. All of the calls in SkinUI use the alternative version of getFileToRes. Maybe I accidentally changed something else.
But compiling all does not work, I get message 'javac' is not recognized as an internal or external command, see enclosed screen-shot.
The screenshot shows that you executed compile_all.bat in the wrong folder. It must be in "Slide Show 4\src", since it compiles all .java files in the current folder.
javac.exe must be in the system path. When you installed the JDK, the system path should have been updated. Maybe you need to restart the PC to complete this.

For the next week, I will be riding my Triumph motorbike around West Virginia, so I may be unable to reply for a few days.
AndreWolff

Posts: 1,775
Registered: 14-Dec-2007
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 06-Jun-2015 14:23   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Attachment test.txt (16,1 KB)
ctwist wrote:
The screenshot shows that you executed compile_all.bat in the wrong folder. It must be in "Slide Show 4\src", since it compiles all .java files in the current folder.
javac.exe must be in the system path. When you installed the JDK, the system path should have been updated. Maybe you need to restart the PC to complete this.
I got the compiler working after I changed the bat file into:
C:\Progra~1\Java\jdk1.8.0_45\bin\javac -source 1.6 -target 1.6 -classpath .;c:\progra~1\jAlbum_64\lib\jalbum-core.jar;c:\progra~1\jAlbum_64\plugins *.java > test.txt 2>&1
@echo off
move *.class ..\plugins
But I get a lot of errors:
warning: [options] bootstrap class path not set in conjunction with -source 1.6
CustomUI.java:10: error: package se.datadosen.component does not exist
import se.datadosen.component.*;
^
CustomUI.java:11: error: package se.datadosen.util does not exist
import se.datadosen.util.*;
^
CustomUI.java:12: error: package se.datadosen.jalbum does not exist
import se.datadosen.jalbum.*;
^
etc.
See also enclose file test.txt

Have a nice motorbike week!

At the end of next week I go with my VW camper to Sweden for a holiday, so it will take some time before we get this working!
monkeyboy

Posts: 83
Registered: 21-Jun-2008
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 06-Jun-2015 21:56   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
If you are going to use '-source 1.6 -target 1.6' to compile to Java 6, then you will need to point towards the 'rt.jar' file from Java 6 using the '-bootclasspath' switch in your command line.
If you download and install Java Runtime Enviroment 6 Update 45 x64 from here: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jre-6u45-oth-JPR
... then you could use a command such as the following (pointing towards the 'rt.jar' file in its installation folder):

Also, it looks like you might need to check the paths to your jAlbum program directory. This is the reason for the 'se.datadosen' packages not being found.

Try something like this:
"C:\Program Files\Java\jdk1.8.0_45\bin\javac.exe" -source 1.6 -target 1.6 -bootclasspath "C:\Program Files\Java\jre6\lib\rt.jar" -classpath .;"C:\Program Files (x86)\jalbum\lib\jalbum-core.jar";"C:\Program Files (x86)\jalbum\plugins" *.java
move *.class ..\plugins
AndreWolff

Posts: 1,775
Registered: 14-Dec-2007
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 07-Jun-2015 00:14   in response to: monkeyboy in response to: monkeyboy
 
  Click to reply to this thread Reply
monkeyboy wrote:
If you are going to use '-source 1.6 -target 1.6' to compile to Java 6, then you will need to point towards the 'rt.jar' file from Java 6 using the '-bootclasspath' switch in your command line.
If you download and install Java Runtime Enviroment 6 Update 45 x64 from here: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jre-6u45-oth-JPR
If I look in my Java Control panel I see that I have version 8 Update 45 (build 1.8.0_45-b15).
Apparantly jAlbum works without problems on my Widows 8.1 system, so why should I download the Java 6 RTE?
JeffTucker

Posts: 6,962
Registered: 31-Jan-2006
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 07-Jun-2015 00:28   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
If you want users who have only Java 6 to be able to use your skin, the skin UI must be compiled to Java 6. If you want to compile to Java 6, you must have the Java 6 JDK on your system.

People with older Macs can't get anything beyond Java 6 - they would need OSX 10.8, and older Macs (roughly, pre-2008) can't upgrade beyond OSX 10.7. (People with even older Macs are stuck with Java 5.)

jAlbum 12.7 will run on Java 6. jAlbum 13 will require Java 8 - at that point, we can all stop compiling our skins to the older standards.
monkeyboy

Posts: 83
Registered: 21-Jun-2008
Re: How to set maxImageWidth and maxImageHeight in a Custom panel?
Posted: 07-Jun-2015 00:38   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Your command currently sets '-source 1.6' and '-target 1.6'. (1.6 is Java 6.)
'-source' specifies the version of source code accepted.
'-target' generate class files that target a specified version of the VM.

As long as you compile to Java 6, anyone using Java 6 upwards will be able to use your skin but, in order to do so, you will need to point your command to the Java 6 'rt.jar' boorstrap classes file (and you will need to install Java 6 to get the required 'rt.jar' file).

You could omit '-source 1.6' and '-target 1.6' from your command but then only users with Java 8 would be able to use your skin (as you would then be compiling to Java 8, the default being that you are using 'javac' from the Java 8 SDK).
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums