Win a copy of Terraform in Action this week in the Cloud forum!

Miltos Deligiannis

Greenhorn
+ Follow
since Jun 12, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Miltos Deligiannis

Paul Clapham wrote:Java isn't the right choice of language for it.



Yeah i suppose so... Thanks
7 years ago

Ulf Dittmer wrote:If you want to do this specifically inside a browser, then a browser extension might be the way to do it. For example, in Firefox you can get pretty far using XUL - basically JavaScript using some Firefox-specific APIs. See https://developer.mozilla.org/en/docs/Building_an_Extension and http://kb.mozillazine.org/Getting_started_with_extension_development to get started.



That was my first thought and i think that i'll finally go with it... Thanks
7 years ago

Paul Clapham wrote:Okay... let's try a little more clarification. This program would be a separate program from the browser, but it would modify how the browser works? Or it would just extract text from the browser's display and do something with it?

Or would it be code which runs in the browser? If you're focusing on Java, then that would be an applet.



it should be just that: "a separate program from the browser and it would just extract text from the browser's display and do something with it."
7 years ago

Paul Clapham wrote:Well, clearly it is possible because you have posted a screenshot from an app which does exactly that. But perhaps you could clarify: do you just want to write a browser which has this feature? Did you perhaps want to write an application which could look into windows of other Windows applications? A clearer description of your goals would be very helpful.



Well i don't know if this feature of google has been implemented in java.... i need a program that right click manipulate the selected string in the browser. I don't want to write a browser.. I'm thinking of an app that runs with the selected text as argument...
7 years ago
Hello,

I would like to know if ti is possible to build an app that can "do things" with a selected string from a url. Most preferably callable through windows context menu such as google search (see attachment). If possible any directives for starters?

Thanks!
7 years ago

Paul Clapham wrote:I wouldn't expect Ctrl-Alt-A to cause the "select all" to fire, that would be Ctrl-A which would do that. Unless your code is using a KeyListener and fails to notice the difference?



As a matter of fact i tried this with a KeyListener which indeed didn't care if Alt is also pressed. As long as ctrl and A are pressed "select all" would happen. KeyListener is good only cause any custom key combination for a JTextArea works when this JTextArea is focused and that's a good thing as far as i'm concerned. But on the other hand there's this problem with ctrl+a and ctrl+alt+a....

10 years ago

Paul Clapham wrote:Couldn't you choose some other more reasonable keystroke? Like Ctrl-Alt-I or something like that?


I tried that but since at least one of the combination include the character A, when pressing ctrl+Alt+a caused the Ctrl+a (select all) to fire.
10 years ago

Paul Clapham wrote:

Miltos Deligiannis wrote:It means press "Alt" "a" and "i" keys simultaneously. on release, print '\u0101'



I also didn't understand why you wanted to call the getKeyStroke method with more than one char argument, when it looked to me like you should be calling KeyStroke.getKeyStroke('\u0101'). That method doesn't seem to have anything to with the keys pressed.

I don't believe that Java (or in fact most languages) can deal with multiple non-control keys being pressed at once. Have you seen this exact key binding working in other environments?



Actually i've seen it in tavultsoft keyman software.

On the other hand \u0101 is the glyph should get printed on screen.

e.g. Shift+A -> A (capital)
Alt+a+i -> \u0101

but since can't be done.... Anyway thanks. i'll come back if i get a solution
10 years ago

Paul Clapham wrote:For a start I didn't understand what "alt+a+i" meant. I thought you would explain that when you were explaining your actual problem, but you didn't, so I'm going to have to ask what it means. (I can think of three possible meanings for it.)




It means press "Alt" "a" and "i" keys simultaneously. on release, print '\u0101'
10 years ago

Paul Clapham wrote:What do you mean by "handling a combo"? And why do you think you need a Keystroke object to do that?



Well, that's what i thought it needs. Anyway i need Alt+a+i to produce a specific unicode character...
10 years ago

Paul Clapham wrote:Can we go back a step and find out why you are looking for Keystroke objects?



What do you mean? Just to handle those combos
10 years ago
Hello, i have a little problem here.

i have a jTextArea where when user types e.g. Alt+a+i the sequence "ai" is called. I want this cause the jTextarea use Braille font where the sequence "ai" (in greek) is represented by a glyph other than "a"+"i". The problem is that i can't find in the available API (inputMap, KeyStroke, etc.) a method that accepts more than one char argument.


static KeyStroke getKeyStroke(char keyChar)
Returns a shared instance of a KeyStroke that represents a KEY_TYPED event for the specified character.
static KeyStroke getKeyStroke(Character keyChar, int modifiers)
Returns a shared instance of a KeyStroke, given a Character object and a set of modifiers.
static KeyStroke getKeyStroke(char keyChar, boolean onKeyRelease)
Deprecated. use getKeyStroke(char)
static KeyStroke getKeyStroke(int keyCode, int modifiers)
Returns a shared instance of a KeyStroke, given a numeric key code and a set of modifiers.
static KeyStroke getKeyStroke(int keyCode, int modifiers, boolean onKeyRelease)
Returns a shared instance of a KeyStroke, given a numeric key code and a set of modifiers, specifying whether the key is activated when it is pressed or released.
static KeyStroke getKeyStroke(String s)
Parses a string and returns a KeyStroke.
static KeyStroke getKeyStrokeForEvent(KeyEvent anEvent)
Returns a KeyStroke which represents the stroke which generated a given KeyEvent.



Any way around that?
10 years ago

I'm pretty sure Docx4j can open and convert the old formats to the newer 2007 (2010?) formats.


I've seen no indication that docx4j can handle the old binary Office formats. Or did you mean the 2003 XML formats?



Indeed, Docx4j cannot handle legacy doc files. This can be done only through conversion using Apache POI. This is a quote from Doc4j "Getting Started".

Handling legacy binary .doc files
Apache POI's HWPF can read .doc files, and docx4j could use this for basic conversion of .doc to .docx. The problem with this approach is that POI's HWPF code fails on many .doc files.
An effective approach is to use OpenOffice (via jodconverter) to convert the doc to docx, which docx4j can then process. If you need to return a binary .doc, OpenOffice/jodconverter can convert the docx back to .doc.
There is also http://b2xtranslator.sourceforge.net/ . If a pure Java approach were required, this could be converted.



10 years ago

Wim Vanni wrote:I'm pretty sure Docx4j can open and convert the old formats to the newer 2007 (2010?) formats. I haven't used this myself but making a POC for this shouldn't be too hard. If this is succesful you basicly have at that point, XML. Plenty of Java libraries around to handle (and search in) XML, and if needed, adding regexp searching to that shouldn't be difficult either.

You don't have to be a guru. Just learn new ingredients now and then and learn to combine them into extraordinary dishes

Chef Wim



So, does Docx4j need ms word installed?
10 years ago

Ulf Dittmer wrote:The XML supported by Office 2003 is very different from the Office 2007 formats.



That i didn't know. So now, for efficiency, a program should handle .doc (COM), 2003 xml format (is that docx too?) and .docx formats plus independancy... That hurts already...!!
10 years ago