I'd like to draw an overlay on an image. The overlay is also an image with a black background and a white foreground. Now the white pixels should be drawn on the image in red. This is possible with the code I posted below. However, the problem arises when rotating the stencil (overlay). I get some interpolation errors from the rotation on the boundaries. I tried to clip them with setClip(), but this turns the background from transparent to white. How to remove those spots? Or maybe a completely other idea of achieving an overlay on the image? I'm aware of the pixelreader and iterating through the stencils pixels and draw the respective pixels as rectangles on a Canvas' graphicContext. However, this was extremely slow, compared to the code I posted below (although it doesn't work with rotations).
I'm attempting to create a 2D spaceship game from scratch. My problem is that I feel like the way Im rotating images is awkward and just wrong. I believe what I'm doing in the following code is loading an image into a JPanel and rotating the image and moving the JPanel.
The code is unrefined and only partial, but it show how I am manipulating images.
What seems so awkward is that I have to create a new JPanel for every image, I would think there is a better way but I don't know. I have tried to get one image on top of an other with the JPanels to no avail. That said I haven't put much time into trying to get that to work. I want to know if I should continue my attempt with JPanels or to pursue a different method.
I have a UI widget, like a table view for example, displaying real-time data. This table can be configured - so it has many properties. The way I would like to do so, is to have a small 'configure button', once clicked, would rotate the entire table along its y axis, and display another panel with checkboxes etc... So effectively, the hidden properties panel is revealed by rotation.
We are doing a visualisation tool for point cloud research project. We use 3d sphere to represent each single point and when we have large number of points to display (~40,000), the rotation becomes very lagging.
What we have tried:
set JVM flag -Djavafx.animation.fullspeed=true, this worked a bit, but not significant.set JVM flag -Djavafx.autoproxy.disable=true, this did not work.
set Cache to true and CacheHint to Cache.SPEED, this did not make much difference.create another thread to do the rotation, and sync back after calculation, this did not work neither.
I have some questions about a GUI program overlay. My main method in the "actual code" will display information in a huge batch, which is necessary. My questions relate to this feat. I am curious because I need to look this up but I am unsure of the "name" for what I am trying to accomplish.
Can link a JButton as an action item to display information to the JTextFeilds that houses the information needed to populate the data?
If so, what are the necessary steps to ensure that my JButton class and listener are pulling the correct information upon the Event and populate the data to the JTextFeilds?
Would I need a boolean statement that captures all of the methods of "data procurement" within my JTextFeilds underneath that one button?
I've been on this for a while and for some reason I just can't seem to get this to work. I know my code is solid, but it won't display my image. I've tried swithcing the image to different directories and also using different image sizes and types. I even used Orcale's guide to display your image, but still no go! All I get is a blank canvas? There are no errors. I'm also running NetbeansIDE 8 that supports JavaFX and I made sure the project is a JavaFX Application project.
The homework called for me to display it three times - the first one regular, second resized, and the last one rotated. I even deleted the extra images in hope at least one appears.
I would like to reopen the following discussion: Show SVG-Image in WebView (JavaFX 8)
In our IDE (Eclipse Luna) running with jdk1.8.0_25 we load a html page into the webengine. The html page contains <img> tags with '.png' and '.svg' as src. Everything looks fine.
But if we execute the programm with java -jar, the WebEngine doesn't display the svg-files. Instead it shows the 'File not find'-Icon. The .png files still work
The files are definitly included into the jar and will be displayed if we link to them via <a href="someSvg.svg"></a>
I created an ImageView with an image with transparent portions. I also did some scaling and moving, which I though might cause this effect, but that is not the case. When I click on the transparent portion of the image the onMouseClick event is not fired. Other mouse events (mouse enter, mouse move, mouse exit, ...) get fired. Only when I click on the non transparent part the click event is fired.
Image img = new Image(getClass().getResourceAsStream("barrel_icon.png")); ImageView view = new ImageView(img); view.setScaleX(0.5); view.setScaleY(0.5); view.setOnMouseClicked(new EventHandler<MouseEvent>() {
[Code] ....
The area between the barrel and the shadow belongs clearly to the image, however is transparent. I am wondering if there is a reason for this behaviour and what is the best way to work around this issue, as my image has large transparent portions and the non transparent parts are hard to click on. By the way this is all based on JavaFX 2.2.
I am building an application that shows tables with large amounts of data containing columns that should display a thumbnail. However, this thumbnail is supposed to be loaded in the background lazily, when a row becomes visible because it is computationally too expensive to to this when the model data is loaded and typically not necessary to retrieve the thumbnail for all data that is in the table.
I have done the exact same thing in the past in a Swing application by doing this:
Whenever the model has changed or the vertical scrollbar has moved:
- Render a placeholder image in the custom cell renderer for this JTable if no image is available in the model object representing the corresponding row - Compute the visible rows by using getVisibleRect and rowAtPoint methods in JTable - Start a background thread that retrieves the image for the given rows and sets the resulting BufferedImage in a custom Model Object that was used in the TableModel (if not already there because of an earlier run) - Fire a corresponding model change event in the EDT whenever an image has been retrieved in the background thread so the row is rendered again
Btw. the field in the model class holding the BufferedImage was a weak reference in this case so the memory can be reclaimed as needed by the application.
What is the best way to achieve this behaviour using a JFX TableView? I have so far failed to find anything in the API to retrieve the visible items/rows. Is there a completely different approach available/required that uses the Cell API? I fail to see it so far.
I see this is an object reference, but what is on the right side? Does not seem like a method, as it would not equal a method nor would the parentheses be on the left. Why are parentheses there? Disregarding the above code, I would like to know how to rotate without Graphics 2d
Also, with G2D you it will not allow for setting x coords
So I have this randomly generated set of tiles that is wrapped in a circle and I'm not really sure how to scroll it around the circle. Basically it's a side-view planet that is in 2D and needs to be wrapped and moving at a controllable rate to give the illusion of planet rotation. What to do to the x and y to make it scroll around. I want every tile except the water tiles to move from left to right and then wrap around the circle. Here's what a planet looks like: [URL] ....
Java Code:
for (int x = 0; x < planet1.length; x++) { for (int y = 0; y < planet1[0].length; y++) { if (planet1[x][y] == 1 || planet1[x][y] == 2) { g.drawImage(water, x * 32, y * 32);
I am writing a java program that takes a FROM image, a TO image, and a ratio (this is a slide bar in the GUI). Here's my code: Java Code:
public static BufferedImage rollUp (BufferedImage from, BufferedImage to, double ratio) { BufferedImage finalBufferedImage = new BufferedImage(from.getWidth(), from.getHeight(), from.getType()); int packedColor = 0; for (int r = 0; r < from.getHeight(); ++r) { for (int c = 0; c < from.getWidth() ; ++c) {
[code]...
So from 0 to 1 (ratio is a double between 0 and 1) the image will "roll up". The effect works completely in the GUI, but the console freaks out at about 0.33 ratio.. This program runs for testing in a class Main and uses a class Splittinimage.. this method is in class TwixPix. When the main class is run, a box pops up with a combo box and a slider. You pick an effect (in this case, roll up) and then slide the slider to set the ratio. The image below those two things performs the effect that was selected. Imagine a PowerPoint presentation slide effect.
I'm experimenting with AffineTransform, Basically I've created just a simple test GUI to see how the code works and all that. Anyway, there are two buttons which turn an image left and right and a third button with moves the image to the right (East). When you first run the program the image is facing down (South). Now to turn left or right I'm using an Affine Transform and the rotate method. That works fine. The issue is when I move the image to the right, it ignore whatever rotation I previously I made (from turn left and right buttons). Therefore when I click to move the image, it faces down again even if it was facing left or up or right before I moved it. It will always be facing down. How do I get it to keep the rotation and just move? Btw I'm using the setTranslate method to move the image.
Below is my code.
Images.java import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; public class Images { static BufferedImage Icon, Rover;
I'm using Scene Builder 2.0 and have added an ImageView to the parent AnchorPane. I've added my PNG files for the app icon and the various buttons. I select the ImageView in Scene Builder and then crawl the filesystem to the project package folder and select the PNG for the Image. The assigned image is displayed in the Imageview in Scene Builder in both design mode and Preview mode.
While everything else shows up properly when the app is executed, the image assigned to the ImageView does not display.
I am having a problem with the JavaFX MediaPlayer playing videos with resolutions greater than 1920x1080px. For testing purpose I downloaded the example from [URL] ... and added the following error-handling:
The video is encoded with h264 and aac (for audio) and is having a resolution of 1920x1168px. The error occurs with each video with a resolution greater than 1920x1080px. Vidoes with a resolution of 1920x1080px or smalle are working fine. The playback of all videos is working with VLC-Player. I tried Java 7_51 and Java 8_5.
Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later the user has to retrieve the entire image by viewing a small part of the image. I have already displayed the full image on the Label, now i don't know how to split the image and store it part wise in the database.
I stored an image into MySQL database using swings and hibernate but I am struggling to retrieve that image from MySQL database and display same image in the jTable cell and same as on jLabel whatever I retrieve from the database using swings and hibernate .
I'm trying to make a method that takes an image and turns it into a tile image. So if the original image looks like this:
[URL] ....
then the output image should look like this:
[URL] ....
Here's a method that's supposed to do that but for some reason the output image looks the same as the original:
public static int[][] tile(int[][] arr){ int[][] tile = new int[arr.length][arr[0].length]; for (int i = 0; i < arr.length; i++) { tile[i]=arr[i]; } return tile; }
I recently changed the method and the error message I'm getting is "bad operand types for binary operator '+'. Here's the method:
public static int[][] tile(int[][] arr){ int[][] tile = new int[arr.length][arr[0].length]; for (int i = 0; i < arr.length; i++) { for(int j=0; j<arr[i].length;j++){ tile[j]=(tile[j])+(arr[i]); } } return tile; }