Danny Wreczycki

Greenhorn
+ Follow
since Sep 23, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Danny Wreczycki

venkatesh mamidipelli wrote:i want to create a cross platform app using java any suggessions??



If you are going to just use api attached to Java yours app going to be crossplatform out of the box ;D Most libraries you can find online also gonna work on any platform unless you are about to use os specific features.
9 years ago
First I do not understand why do you use beans. Second try rewrite filters to match BufferedImageOp implementations and try it. Im not similiar with image processing algorithms so I cannot validate yours code but take a look at image processing library from jhlabs.com and check code for grayscale and convolution filters. Good luck in fixing this issue ;D
9 years ago

Alicia Perry wrote:

Ulf Dittmer wrote:Welcome to the Ranch.

Ugh, NetBeans-created Swing code is the worst. The problem is that the getResource approach will only load the resource once per lifetime of the JVM. If the file changes you need to read it via file operations, most easily using the javax.imageio.ImageIO.read methods.



Thank you! So if I write the code without using NetBeans builder what should I write?
it is enough if I create a label and associate an image or should I use other functions?



Its really depends of your needs. Lets assume all you want is to just display image with orginal resolution without additional filters and so on. In order to do so you can just create new method called for example

public void changeImage(String pathToImage) {
label.setImage(pathToImage); // setup new imageicon for the label
label.repaint(); // repaint label so new image will be displayed
}

But if you want to perform additional tasks to image itself you should pick BufferedImage instead. In order to use BufferedImage instead of ImageIcon you need to subclass for example awt.Label and override paintComponent() method.

Take a look here https://coderanch.com/t/635062/GUI/java/Display-JPEG.
9 years ago
Hello again, I just released my first app with is using this solution. App is called Xbpad and lets you map mouse and keyboard to Xbox360 controller in ease way. I will soon also post source code of the app so you can take a look how to use dlls. App is hosted on sourceforge Xbpad
9 years ago
I been bored a little so deciced to provide you simple app with actually display an image. Take a look at code and feel free to tweak.



9 years ago
Okey I find workaround, and can share if anybody need similiar solution.

First I made simple dll in CodeBlocks and compliled it with mingw.

Source for main.cpp



Source for header file main.h



Now Java part coming together with JNA



You can use it instead of awt.Robot when you need just simulating keyboard events. Its quite nice solution since awt.Robot its limited to predefinied keystrokes so you cannot use it together with special keys like volume up/volume down becouse these keys are not declared for robot.


// So sorry for my bad english
9 years ago

Paul Clapham wrote:I don't know what's wrong with your code because you didn't tell us. What makes you think it doesn't work? Or to put it another way, what evidence can you tell us about?

In the meantime I'm going to guess that you named a method "keyRealesed" and when you try to call the keyReleased method nothing happens because it doesn't exist. Or it doesn't compile for that reason.




Its do nothing simple nothing, not even throws errors so I cannot even quess whats wrong.
9 years ago
Hello there i cannot get JNA and sendinput to works. Please take a look at my code and if you are familiar with jna point me what exacly im doing wrong.



Ive got stuck at this point and im not able to find any workaround.
9 years ago

Claude Moore wrote:Danny, thank you for sharing your solution with us, I'm glad you managed it. About java.awt.Robot, from docs it seems that authors wrote it with automatic-testing of Gui in mind.. maybe they limited it to generate events jre is able to handle...



Nah from decription you can read robot its used to handle native system input events for the purposes of test automation of entire JDK. For my curiosity in my spare time i will fork openJDK remove method with in my opinion couse problems and try results. I can also share native windows dlls with little explanation hows they work for using non supported keycodes by Java just le me know you need it. Cheers.
9 years ago
I solved the problem by writing simple dll (invoking sendInput from win api) and using it with JNA. For now its the best solution I managed to work but i kinda do not understand why fuctionality of awt.robot is so limited whenever missing functionality could be easly added.



@Paul Clapham
I understand yours point of view but i belive purpose of awt.robot its not only for controlling Java application writed in AWT/SWING due to facts im able to receives and sends events to robot while application is minimalized or has no focus.
9 years ago
Hello out there I would like to integrate that function in my code but I have no idea how to to use it. Could you provide me some code snippet how simply can i use it to press given key with given keycode.
9 years ago
Take a look this project. Its not finished calc I made while learning basics of java and swing. Its Eclipse project so just import into your ide and feel free to tweaking. calcsimple
9 years ago
Hello there I'm new to java world, still learning and trying to understand as much as I can. I'm doing it by practice since I think its the best way. Currently I'm trying to develop app with map my xbox controller to system keyboard and mouse. Using some nice free and open source libraries I almost reach my goal but unfortunately I figured one big problem. To simulate keyboard events I use awt.robot its works as a charm with definied in KeyEvent class values for virtual keys codes but does not work for special keys like Volume_Up and Volume_Down. I did small research and figured thats becouse awt.robot before simulate key stroke do test if key value is declared in KeyEvent class. So my application is limited only for keys codes declared there, I think its big issuse since its very limited compared for example to keys declared in Winuser.h (http://msdn.microsoft.com/pl-pl/library/windows/desktop/dd375731(v=vs.85).aspx). I spent some time to trying obey these issue and belive java reflection could do the trick. All I need is to override awt.Robot method to do not check if keycode is declared in KeyEvent class or I need to override KeyEvent class and add some more keycodes declared there as static ints.

Please if you got idea how this can be done, posts here also if you know any good resource where me, completly begginer could easly learn java reflection api post aswell.
Also another solution with im thinking about is forking openjdk, removing unwanted method (private void checkKeycodeArgument(int keycode) from awt.robot) and build it.

I'm so sorry for my bad english, please understand Im self learned from web.
9 years ago
Hello I writed a sepia filter using JHLabs library, filter is used in my application built entirely in swing and java2d (http://sourceforge.net/projects/paintysnapshot/?source=directory). Do you have maybe some code tips and advice since i think the way how im applying filter is not effective. Please take a look at code.

10 years ago
Hello there please take a look at http://www.indiegogo.com/projects/painty/x/1680012. Its my image editor entirely written in Java using Swing and many open source libraries. Im developing it as photoshop replacement. Write what do you think about my project, im able in about 6 months to extend functionality to actually met Photoshop but I need little support.

At the moment program utilize imagemagick parser im4java, Jmagick, Geotools. Loci Bioformats and ImageIO addons for reading/writing images. JAI, JAITools and basic Java2D functionality for handling image manipulation and also for cacheing very big bitmaps on disc.
10 years ago