java.lang.NoSuchMethodError: createImageUsingNativeSize error in 1.8.0_45

2015-07-23 Thread Paul Taylor
This code that was used in some circumstances for dealing with single 
images dragged and drop from certain webbrowsers (firefox) gave no 
issues in 1.8.0_25


image  = (Image) 
trans.getTransferData(image/x-java-image;class=java.awt.Image);


but now in 1.8.0_45 causing

java.lang.NoSuchMethodError: createImageUsingNativeSize
at sun.lwawt.macosx.CDataTransferer.getImageForByteStream(Native Method)
at 
sun.lwawt.macosx.CDataTransferer.platformImageBytesToImage(CDataTransferer.java:238)
at 
sun.awt.datatransfer.DataTransferer.translateBytes(DataTransferer.java:1659)

at sun.lwawt.macosx.CDataTransferer.translateBytes(CDataTransferer.java:142)
at 
sun.awt.dnd.SunDropTargetContextPeer.getTransferData(SunDropTargetContextPeer.java:269)
at 
sun.awt.datatransfer.TransferableProxy.getTransferData(TransferableProxy.java:73)
at 
java.awt.dnd.DropTargetContext$TransferableProxy.getTransferData(DropTargetContext.java:376)
at 
com.jthink.jaikoz.draganddrop.ImageHandler.createImageCell(ImageHandler.java:30)


Is this a bug in the new version of OSX Java or am I simply doing 
something wrong, is there a simple workaround ?


Paul




Re: Swing Look And Feel for Yosemite

2014-11-11 Thread Paul Taylor

On 11/11/2014 02:02, Phil Race wrote:

On 11/10/14 9:45 AM, David DeHaven wrote:
We still use it for the occasional generic Java 7/8/9 on Mac 
question that comes up from time to time. It is far preferable that 
the question be posted to the more specific lists, but sometimes it 
isn't clear where that belongs. There's enough of us monitoring the 
list that we can provide guidance on where to go but not enough that 
it should be used for all Mac specific question


And, some Apple folks might be still peeking at this list in their 
free time and chime
in with useful information. But they are very unlikely to be reading 
the swing list.

Yep
Just don't take that as meaning all mac questions go here first. After 
all we don't

have a windows port list or an ubuntu port list ...

No, but Apple a special case there is alot more divergence between the 
OSX Gui, and the Windows/Linux guis. And Apple seems much more likely to 
making changes in its new OS versions that scupper us java devs.


Paul


Re: OSX failing to get a url for image even though it is a supported dataflavour for the transferable

2014-09-23 Thread Paul Taylor

On 22/09/2014 14:03, Scott Palmer wrote:

The XML has an array of two strings.  Are you sure you aren't getting
the error from the second blank string?

Scott
Ah, good point BUT why would getTransferData() return an empty value, I 
dont see I have any control over that ?


Paul


OSX failing to get a url for image even though it is a supported dataflavour for the transferable

2014-09-22 Thread Paul Taylor
Customer reporting this error when trying to copy and paste an image 
from amazon, although we check the transferable object support a 
particular dataflavor, it fails when try and use that data flavour to 
get a url. Ive not seen this error before and recently moved to Java 
1.8.0_20 so I'm assuming the issues lies with Java 8 ?


java.net.MalformedURLException: no protocol: ?xml version=1.0 
encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN 
http://www.apple.com/DTDs/PropertyList-1.0.dtd;

plist version=1.0
array
stringhttp://ecx.images-amazon.com/images/I/41NTPXC8EHL.jpg/string
string/string
/array
/plist

at java.net.URL.init(URL.java:586)
at java.net.URL.init(URL.java:483)
at java.net.URL.init(URL.java:432)
at 
sun.lwawt.macosx.CDataTransferer.translateBytes(CDataTransferer.java:135)
at 
sun.awt.datatransfer.ClipboardTransferable$DataFactory.getTransferData(ClipboardTransferable.java:71)
at 
sun.awt.datatransfer.ClipboardTransferable.getTransferData(ClipboardTransferable.java:168)


Code Extract

public static DataFlavor imageUrlFlavor =  new 
DataFlavor(application/x-java-url;class=java.net.URL);

public void getImage(Transferable trans)

if(trans.isDataFlavorSupported(FileDropTarget.imageUrlFlavor))
{
imageUrl  = (URL) 
trans.getTransferData(FileDropTarget.imageUrlFlavor);

}




Re: What do we need to change to sign java appbundle since updating from 10.9.4 to 10.9.5

2014-09-19 Thread Paul Taylor

On 18/09/2014 20:22, Hendrik Schreiber wrote:

On Sep 18, 2014, at 20:49, Paul Taylor paul_t...@fastmail.fm wrote:


On 18/09/2014 18:16, Danno Ferrin wrote:

On the javapacakger (javafxpackager) side of the house we dodge this by not 
using the symlinked JLI.

The JDK as it is installed installs a symlink to the libjli.dylib in 
...app/Contents/MacOS is actually a symlink.  I don't know if you copy it if it 
will still work, it may want to live in 
...app/Contents/Home/jre/lib/jli/libjli.dylib.  This is referenced in the 
default info.plist

The way we dodge this for the javapackager is we create our own launch native 
that opens up the libjli from the location deep in the JRE.  And we don't ship 
the symlink.

I can confirm that javapackager 8u20 signs and launchers with 10.9.5, but I 
haven't tried to submit it to the app store since the signing requirements 
changes.

So I don't know how you launch, but the info.plist cannot refer to the 
symlinked libjli.dylib if it is symlinked, and it may not even be allowed to 
exist as a symlink in ...app/Contents/MacOS.  So if you can remove the symlink 
before signing that may help.

Im using a fork of Java Application Bundler from InfiniteKind - 
https://bitbucket.org/infinitekind/appbundler -Im not deploying to the appstore 
its just uploaded to my website.

So following your advice  I found that libjli.dylib in 
Contents/PlugsIns/jdk1.8.0_20.jdk/Contents/MacOS pointed to ../Home/jre/lib/jli 
- replacing the symbolic link with a copy of the file has allowed the signing 
to work, and when installed the application stills seem to work, thankyou :)
'
I assume if it doesn't work then you'll have a problem with javafxpackager 
applications as well.

Any thoughts from dev team about removing this symbolic link in the jdk ?

Perhaps AppBundler should simply not copy the MacOS folder.
I don't see how it's needed when bundle the JRE as plugin and launch with the 
AppBundler stub.

-hendrik


Ive raised this issue on AppBundler 
https://bitbucket.org/infinitekind/appbundler/issue/1/appbundle-built-on-mac-osx-1095-cannot-be


Paul


What do we need to change to sign java appbundle since updating from 10.9.4 to 10.9.5

2014-09-18 Thread Paul Taylor
Can somebody help me with this please I just updated from OSX 10.9.4 to 
10.9.5, and it  looks like I have to change how I sign Java application 
after updating because Im now getting this output after signing with


export 
CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
/usr/bin/codesign --sign Developer ID Application: P Taylor 
--force --deep --verbose /Applications/SongKong.app


Im getting:

/Applications/SongKong.app: the main executable or Info.plist must 
be a regular file (no symlinks, etc.)
In subcomponent: 
/Applications/SongKong.app/Contents/PlugIns/jdk1.8.0_20.jdk


and verification with

/usr/bin/codesign --verify --deep  --verbose /Applications/SongKong.app

gives me

/Applications/SongKong.app: code object is not signed at all
In architecture: x86_64

What do I have to change to fix this ?

Paul



Re: What do we need to change to sign java appbundle since updating from 10.9.4 to 10.9.5

2014-09-18 Thread Paul Taylor

On 18/09/2014 18:16, Danno Ferrin wrote:

On the javapacakger (javafxpackager) side of the house we dodge this by not 
using the symlinked JLI.

The JDK as it is installed installs a symlink to the libjli.dylib in 
...app/Contents/MacOS is actually a symlink.  I don't know if you copy it if it 
will still work, it may want to live in 
...app/Contents/Home/jre/lib/jli/libjli.dylib.  This is referenced in the 
default info.plist

The way we dodge this for the javapackager is we create our own launch native 
that opens up the libjli from the location deep in the JRE.  And we don't ship 
the symlink.

I can confirm that javapackager 8u20 signs and launchers with 10.9.5, but I 
haven't tried to submit it to the app store since the signing requirements 
changes.

So I don't know how you launch, but the info.plist cannot refer to the 
symlinked libjli.dylib if it is symlinked, and it may not even be allowed to 
exist as a symlink in ...app/Contents/MacOS.  So if you can remove the symlink 
before signing that may help.
Im using a fork of Java Application Bundler from InfiniteKind - 
https://bitbucket.org/infinitekind/appbundler -Im not deploying to the 
appstore its just uploaded to my website.


So following your advice  I found that libjli.dylib in 
Contents/PlugsIns/jdk1.8.0_20.jdk/Contents/MacOS pointed to 
../Home/jre/lib/jli - replacing the symbolic link with a copy of the 
file has allowed the signing to work, and when installed the application 
stills seem to work, thankyou :)

'
I assume if it doesn't work then you'll have a problem with 
javafxpackager applications as well.


Any thoughts from dev team about removing this symbolic link in the jdk ?

Paul


Re: java.awt.FileDialog does not work properly bundled but not sandboxed app

2014-05-29 Thread Paul Taylor

On 29/05/2014 11:27, Robert Krüger wrote:

Hi,

I am not really sure I understand your posting correctly. Are you
saying that your impression is that java.awt.FileDialog in mode
FileDialog.LOAD does not work properly in an app bundle, regardless of
sandboxing? If that is so, then I can confirm that this is not the
case.

You are not by any chance starting the app with a splash screen with
-splash? If so that is likely to be the reason for your problems as
java.awt.FileDialog is completely broken then (see
https://bugs.openjdk.java.net/browse/JDK-8009203,
https://bugs.openjdk.java.net/browse/JDK-8006420). If I understand the
feedback of an Oracle dev a few days ago on this list correctly, this
is fixed in J9 and will be backported for the next J8 update. We even
implemented our own splash screen because of this.

Cheers,

Robert



+1 this is what I was saying about splashscreen completely screwing up a 
gui application.
Using Appbundler and without splash screen I use java.awt.FIleDialog 
fine ( see http://jthink.net/songkong, and select File/Open Folder )


Paul


Re: HiDPI/Retina support for -splash option

2014-05-23 Thread Paul Taylor

On 22/05/2014 20:05, Hendrik Schreiber wrote:

Hi,

I'm under the impression that the VM option -splash does not honor the @2x 
notation for HiDPI images.
Am I missing something, is that being worked on, or is there a bug report for 
this (I couldn't find one)?

It's a little disappointing when you spend so much time on getting Retina right 
and then you realize that the very first impression the user gets when starting 
your app is a bad one, i.e. a blurry splash screen.

Thanks!

-hendrik
But isnt there a much larger problem,  the -splash option still broken 
only to be fixed in https://bugs.openjdk.java.net/browse/JDK-8024185. To 
clarify using the splash option will prevent my main application from 
working.


Paul


Unable to get Applescript Engine on some computers

2014-02-27 Thread Paul Taylor

In my code I have:

ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName(AppleScript);

this works fine for me, but for some customers in returns null for engine.

We are using Java 1.8.0 25.0-b69 64bit (build 129)

Customer was on Mac OS X 10.9.2 x86_64, I've upgraded to same version 
still don't get the problem.


Applescript does exist because earlier in my code I run some applescript 
using osascript and Runtime class and that works fine


Any ideas ?

Paul



Re: Unable to get Applescript Engine on some computers

2014-02-27 Thread Paul Taylor

On 27/02/2014 11:50, Andrew Thompson wrote:



On Feb 27, 2014, at 6:10 AM, Alan Bateman alan.bate...@oracle.com wrote:

The JDK does include the AppleScriptEngine but is missing the service 
configuration file that is needed to locate it. There is a bug open for this 
but it does raise the question as to whether the JDK really needs to bundle 
this scripting engine or not.

I think the issue here is right now a lot of customers still have at least some 
fragments of Apple's Java 6 installed which makes this work.

As more machines come to exist which have only ever had Java 7 or greater on 
them we'd see this issue more often, unless it is fixed.

Right now I think this masking makes it impossible to estimate how widely used 
this engine is.
This is a terrible slip up, I assume you do java builds on clean machine 
so I assume you don't have a single until test for checking talking to 
Applescript engine.


I dread to think how many potential customers have tried my application 
and given up when it fails to update iTunes ( a key part on of the 
appilication for many OSX users), and Ive been unaware


Paul


Re: Unable to get Applescript Engine on some computers

2014-02-27 Thread Paul Taylor

On 27/02/2014 12:16, Paul Taylor wrote:

On 27/02/2014 11:50, Andrew Thompson wrote:


On Feb 27, 2014, at 6:10 AM, Alan Bateman alan.bate...@oracle.com 
wrote:


The JDK does include the AppleScriptEngine but is missing the 
service configuration file that is needed to locate it. There is a 
bug open for this but it does raise the question as to whether the 
JDK really needs to bundle this scripting engine or not.
I think the issue here is right now a lot of customers still have at 
least some fragments of Apple's Java 6 installed which makes this work.


As more machines come to exist which have only ever had Java 7 or 
greater on them we'd see this issue more often, unless it is fixed.


Right now I think this masking makes it impossible to estimate how 
widely used this engine is.
This is a terrible slip up, I assume you do java builds on clean 
machine so I assume you don't have a single until test for checking 
talking to Applescript engine.


I dread to think how many potential customers have tried my 
application and given up when it fails to update iTunes ( a key part 
on of the appilication for many OSX users), and Ive been unaware


Paul

I wanted to replicate the issue before fixing so I renamed 
/System/Library/Java/Extensions/AppleScriptEngine.jar and 
libAppleScriptEngine.jniLib but it stills works.

I searched the whole hard disk and couldn't find any other copies
What do I need to do to make it fail ?

Paul


Re: Unable to get Applescript Engine on some computers

2014-02-27 Thread Paul Taylor

On 27/02/2014 13:17, Alan Bateman wrote:

On 27/02/2014 13:11, Paul Taylor wrote:

:

I wanted to replicate the issue before fixing so I renamed 
/System/Library/Java/Extensions/AppleScriptEngine.jar and 
libAppleScriptEngine.jniLib but it stills works.

I searched the whole hard disk and couldn't find any other copies
What do I need to do to make it fail ?
Is the renamed JAR file still in /System/Library/Java/Extensions? If 
so then move it where because that directory is used by the extensions 
mechanism (all JAR files in there are searched).


-Alan.

Ah yes, I renamed to .old file thinking that would do it, but moving it 
out completely does replicate the issue


thanks Paul


Re: Unable to get Applescript Engine on some computers

2014-02-27 Thread Paul Taylor

On 27/02/2014 11:07, Michael Hall wrote:

On Feb 27, 2014, at 4:52 AM, Paul Taylor paul_t...@fastmail.fm wrote:


In my code I have:

ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName(AppleScript);

this works fine for me, but for some customers in returns null for engine.

We are using Java 1.8.0 25.0-b69 64bit (build 129)

Customer was on Mac OS X 10.9.2 x86_64, I've upgraded to same version still 
don't get the problem.

Applescript does exist because earlier in my code I run some applescript using 
osascript and Runtime class and that works fine

l don't know that it was precisely determined what caused this. Possibly some 
change in an OS upgrade where Apple removed something from their java 
distribution?
Although we didn't know it, we were relying on the Apple code being in place.
Your three options would be…

1)
Provide the code in the jar and dylib yourself. This is what I did and what I 
made available on github at…
https://github.com/mik3hall/AppleScriptEngine
All you really need are the jar and dylib.
Put the dylib in the application's MacOSX folder. appbundler adds that to 
LD_LIBRARY_PATH.
Put the jar in the application's Java folder, this should get it into class 
path.
Done and should work on any configuration.


FYI I tried this, and it worked !
Brilliant thanks solved a big problem for me

Paul


Disabling AppNap from java

2014-02-22 Thread Paul Taylor

I think Im having problems with AppNap with my application, although it is 
difficult to understand when/if it is kicking in.

'The correct way to disable App Nap is to use the -[NSProcessInfo 
beginActivityWithOptions:reason:] and -[NSProcessInfo endActivity] APIs within 
your app via JNI, and only when your app is actually doing work.' - Mike 
Swingler

Has anything been done to disable AppNap from java without having to use JNI

Paul



Re: Disabling AppNap from java

2014-02-22 Thread Paul Taylor

On 22/02/2014 20:43, Eirik Bakke wrote:

JNA might be a simpler way to call native functions:
https://github.com/twall/jna

-- Eirik

On 2/22/14, 8:51 AM, Paul Taylor paul_t...@fastmail.fm wrote:


I think Im having problems with AppNap with my application, although it
is difficult to understand when/if it is kicking in.

'The correct way to disable App Nap is to use the -[NSProcessInfo
beginActivityWithOptions:reason:] and -[NSProcessInfo endActivity] APIs
within your app via JNI, and only when your app is actually doing work.'
- Mike Swingler

Has anything been done to disable AppNap from java without having to use
JNI

Paul



I think JNA or its own is Wndows only isnt it, but there is something 
called rococoa.
To be honest I was hoping someone else had encountered this particular 
problem with AppNap and had something to share.


Paul


Re: Java 7 application halting OSX when left unatteended

2014-01-31 Thread Paul Taylor

On 31/01/2014 10:58, Hendrik Schreiber wrote:

This smells like App Nap.
See http://krypted.com/mac-os-x/disable-app-nap-in-mavericks/

-hendrik

I'm just testing it with AppNap will report back later, if this doesnt 
fix it I'll dig out by 10.8 machine and see if the problem occurs there 
as well


Paul


Re: Properly code-signing an app with bundled JRE

2014-01-28 Thread Paul Taylor

On 28/01/2014 18:12, Hendrik Schreiber wrote:

Hey..

it seems that Apple has changed the way codesign works. On Mavericks with 
current XCode, Unless you use the --deep option, your app isn't signed at all. 
And when you use --deep, it works fine as long as you don't bundle a JRE as 
plugin.

Is anybody else having this issue... and perhaps a solution?

Thanks,

-hendrik

PS: I'd be very surprised, if the official Oracle recommendation 
(http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html)
 actually still worked.
  ___
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list  (java-...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/java-dev/paul_t100%40fastmail.fm

This email sent to paul_t...@fastmail.fm
I can confirm I had to change it to use --deep option a while ago for it 
to work, I do bundle it with a jre and it still works, but maybe not as 
a plugin not sure what you mean here.


Paul



Re: Dragging an image from Webpage within Firefox no longer provides it as DataFlavour java.net.URL/java.util.List on OSX with Java 7

2014-01-13 Thread Paul Taylor

On 13/01/2014 16:27, Hendrik Schreiber wrote:

On Jan 13, 2014, at 14:14, Paul Taylor paul_t...@fastmail.fm wrote:


Hi, yes it is fixed in early access version of Java 8

http://download.java.net/jdk8/changes/jdk8-b119.html?q=download/jdk8/changes/jdk8-b119.html

Was this fixed by http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8027913 or 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7124253?

Have you verified the fix?

When dragging a JPEG (which is not embedded in HTML) from a web browser to my 
app, I never get a URL or a File list flavor. What I reliably see is:

java.awt.datatransfer.DataFlavor[mimetype=image/x-java-image;representationclass=java.awt.Image]

and depending on the browser a bunch of other text/... flavors. But I'd much 
rather have a URL or a file...

This is on OS X 10.9.1 and FireFox 26, Chrome 31 and Safari 7.0.1, Java build 
1.8.0-ea-b121.

Cheers,

-hendrik


I verified it was now working , but in my use case the jpeg is within 
the html file so maybe that is the difference


paul


Re: Dragging an image from Webpage within Firefox no longer provides it as DataFlavour java.net.URL/java.util.List on OSX with Java 7

2014-01-13 Thread Paul Taylor

On 13/01/2014 16:47, Hendrik Schreiber wrote:

On Jan 13, 2014, at 17:38, Paul Taylor paul_t...@fastmail.fm wrote:


I verified it was now working , but in my use case the jpeg is within the html 
file so maybe that is the difference

I just tried that as well: no difference :-(

Which OS X and Java version did you test with?
I tried 10.9.1 and java 1.8.0-b121.

-hendrik
Hmm, maybe are talking about different things I had two issues, one was 
fixed by the final version of java 7, and issue with Chrome was fixed 
with Java 8 build 119 but its a while ago now I'm not sure on the details


Paul


Re: Using the Apple menu (Apple.laf.useScreenMenuBar) the menu items are always in English whatever set as Preferred Language

2013-12-25 Thread Paul Taylor

On 25/12/2013 13:26, Petr Pchelko wrote:

Hello, Paul.

Sorry for the delayed answer.

The problem is that we are relying on Cocoa to create these menu items. 
However, to properly understand the locale Cocoa needs a special key in the 
Info.plist file (CFBundleAllowMixedLocalizations). However when you are running 
a java application as java -jar … there’s no Info.plist file, so Cocoa does not 
use the locale preferences and displays everything in English. We have the same 
problem with a native FileDialog.

The problem does not seem to be fixable internally in JDK, because there’s no 
API to tell Cocoa that we wish to use CFBundleAllowMixedLocalizations key. The 
only possible workaround right now is to use the javafxpackager tool and create 
a native bundle with your application. Bundled apps have an Info.plist and 
Cocoa localization works well with them.

For more info please look at the following JDK bug: 
https://bugs.openjdk.java.net/browse/JDK-8019464 It’s about the FileDialog, but 
everything there applies to the default menu items as well.

With best regards. Petr.

Thanks, my application is actually packaged using this fork of 
appbundler https://bitbucket.org/infinitekind/appbundler


So will
keyCFBundleAllowMixedLocalizations/key

work for that as well ?

paul



Dragging an image from Webpage within Firefox no longer provides it as DataFlavour java.net.URL/java.util.List on OSX with Java 7

2013-11-25 Thread Paul Taylor
So on Windows with Java 7  I receive an image dragged frrm a webpage in 
these flavours (plus others) but these are two I'm interested in


25/11/2013 
10.31.07:com.jthink.jaikoz.draganddrop.FileDropTarget:drop:SEVERE: 
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-url;representationclass=java.net.URL]
25/11/2013 
10.31.07:com.jthink.jaikoz.draganddrop.FileDropTarget:drop:SEVERE: 
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-file-list;representationclass=java.util.List]


On OSX with Java 6 I received at least one of the two above, but now 
with Java 7 (1.7.0_40) I no longer receive either


I found these bugs that seem related

https://bugs.openjdk.java.net/browse/JDK-7124379
https://bugs.openjdk.java.net/browse/JDK-8005932

Could I have a comment on this please.

Paul


Re: Problem with InetAddress.getLocalHost() on Java 7

2013-11-11 Thread Paul Taylor

On 11/11/2013 15:35, Alan Bateman wrote:

On 11/11/2013 09:09, Paul Taylor wrote:
Trouble is I cannot replicate the problem myself even if remove 
entries from /etc/hosts it is only a problem some of my customers are 
having


Paul
The reports on this issue (assuming it is the same thing as 
JDK-7180557) were sparse and it took a while to find a system where 
this duplicated. The comments in the bug might be useful to help you 
duplicate it.


-Alan.



ok, thanks Alan


Re: How do I make my Java 7 OSX App draggable on toolbar only ?

2013-11-04 Thread Paul Taylor

On 31/10/2013 17:30, Paul Taylor wrote:
Things were working okay with Java 6 ( and some custom libs) but now 
by default a Java 7 application is only movable on Mac if you click 
near the top of the window (like on Windows), however if I set


toolbar.getRootPane().putClientProperty(apple.awt.draggableWindowBackground) 



I can then move the window by dragging on the toolbar. Unfortunately 
because this property is applied to the rootpane, and then is just one 
rootpane for the frame that the whole applications is a part of the 
window moves where-ever I drag on it, I only want to be able to drag 
on it in the toolbar.


The main part of my application is a JTable and I really don't want 
the window to be moved when I dragclick here because it causes lots of 
problems such as I can now no longer reorder by table columns by 
dragging the table headers because that just moves the whole window. 
How can I limit movement to either:


1. Only the JToolbar
2. Everywhere except the Jtable

whichever is easiest.

thanks Paul

Nevermind I found a solution, I used UnifiedToolbar from 
thehttp://code.google.com/p/macwidgets/ project with Java 6. Since 
moving to Java 7 and no longer using UnifiedToolbar I couldn't see a 
solution but delving into their code simply using WindowsDragger class 
works perfectly well


i.e.

new WindowsDragger(frame, toolbar);
new WindowsDragger(frame, statusbar)

In contrast the apple.awt.draggableWindowBackground option is only 
really useful if happy for the whole frame to be draggable.


Paul




Re: How do I make my Java 7 OSX App draggable on toolbar only ?

2013-11-04 Thread Paul Taylor

On 04/11/2013 09:37, Hendrik Schreiber wrote:

On Nov 4, 2013, at 10:05 AM, Paul Taylor wrote:

Nevermind I found a solution, I used UnifiedToolbar from 
thehttp://code.google.com/p/macwidgets/ project with Java 6. Since moving to 
Java 7 and no longer using UnifiedToolbar I couldn't see a solution but delving 
into their code simply using WindowsDragger class works perfectly well

i.e.

new WindowsDragger(frame, toolbar);
new WindowsDragger(frame, statusbar)

In contrast the apple.awt.draggableWindowBackground option is only really 
useful if happy for the whole frame to be draggable.

In other words: it's not useful.
But it would be great, if there was something that worked the way Paul used it 
originally. I.e. a property that can be set on a panel that makes it so that 
you can drag the window by dragging a panel/container.

-hendrik

Well it can be useful I use

apple.awt.draggableWindowBackground

in my SongKong app, and there is it is fine, but yes the option could really be 
improved on.

Paul




Re: Possible regressionn, popupmenus not appearing to work correctly with cntl-click

2013-10-31 Thread Paul Taylor

On 31/10/2013 11:11, Leonid Romanov wrote:
I see.. While it might pose an inconvenience in some scenarios on OS 
X, I don't think it's an issue, since Apple JDK 6 behaves the same 
way, so I'm going to close the bug.


Okay no problem, I now have it working for me since using 
setComponentPopup(). The only thing I would say is that is if Cntl-Click 
is meant to work the same as Right-Click on OSX in all situations it 
does seem there is a minor issue that it breaks my old code but this is 
no longer a problem for me.


On 29.10.2013, at 15:14, Paul Taylor paul_t...@fastmail.fm 
mailto:paul_t...@fastmail.fm wrote:



On 28/10/2013 12:29, Leonid Romanov wrote:

Hello,
I've filed a bug:
https://bugs.openjdk.java.net/browse/JDK-8027374

Hi, Ive think Ive found the issue for me , I created this test case 
and it works correctly as you say


import javax.swing.*;

public class TableTest
{
public static void main(String[] args) throws Exception
{
JPopupMenu popup = new JPopupMenu(Popup);
popup.add(new JMenuItem(Copy));
JTable test = new JTable(5,5);
test.setComponentPopupMenu(popup);
test.setRowSelectionAllowed(true);
test.setColumnSelectionAllowed(true);
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
JFrame frame = new JFrame();
frame.add(test);
frame.pack();
frame.setVisible(true);
}
}

But if you comment out the line

test.setComponentPopupMenu(popup);

so that there is no popup menu then it doesn't work, CntlClick will 
change the selection.


Whether this is a bug, or correct behaviour Im not sure  ?

But the reason why this is causing an issue for me in my current code 
is that Im not using setComponentPopupMenu()instead I'm adding a 
mouse handler to the table that then decides whether or not to show a 
popup menu so I guess the logic for Jtable must not detect that it 
has a popup menu in this case. I've checked and the method was not 
added to JTable until Java 1.5 and my code was started before then so 
hopefully I can just update my code to  use the method and the 
problem will go away for me.


Paul








How do I make my Java 7 OSX App draggable on toolbar only ?

2013-10-31 Thread Paul Taylor
Things were working okay with Java 6 ( and some custom libs) but now by 
default a Java 7 application is only movable on Mac if you click near 
the top of the window (like on Windows), however if I set


toolbar.getRootPane().putClientProperty(apple.awt.draggableWindowBackground) 



I can then move the window by dragging on the toolbar. Unfortunately 
because this property is applied to the rootpane, and then is just one 
rootpane for the frame that the whole applications is a part of the 
window moves where-ever I drag on it, I only want to be able to drag on 
it in the toolbar.


The main part of my application is a JTable and I really don't want the 
window to be moved when I dragclick here because it causes lots of 
problems such as I can now no longer reorder by table columns by 
dragging the table headers because that just moves the whole window. How 
can I limit movement to either:


1. Only the JToolbar
2. Everywhere except the Jtable

whichever is easiest.

thanks Paul


Re: Moving around Jtable with cursor key balnks out values

2013-10-30 Thread Paul Taylor

On 30/10/2013 12:13, Paul Taylor wrote:
With Java 7 on OSX I find that as I move around my JTable cells with 
cursor keys it causes it to blank out every field in goes into.

Adding:
table.putClientProperty(JTable.autoStartsEdit, Boolean.FALSE)

stops that issue happening, but then I have to press 'Enter' key to 
start editing.


What I want to happen is that cursor keys just move the cursor without 
editing, and pressing any other key will start editing in that field. 
i.e I move to a field and press 'd', then will be displayed in the 
field. This is what happened in Java 6 on OSX (Quaqua) and with Java 7 
on Windows.



Paul



Apparently a bug was submitted for this, see

http://stackoverflow.com/questions/11553197/spurious-calls-to-setvalueat-with-jtables-in-java-7-on-os-x-lion

but seems to have disappeared without being fixed, is it still in JIRA ?

Paul