I have been working on a game and the code is some what solid. I have about 7 classes and it runs with no bugs but the graphics don't run smoothly. At the beginning of the game there is a start menu like almost every other game. The menu looks great but when I press the button the screen blinks white before the level comes on. I am using pure java with a simple Jframe and GamePanel. I also use very basic double buffering. The level image loads in a different class the the GamePanel one which contains the start screen image. I have looked into moving the level image into the GamePanel and nothing changed. Feel free to ask me any questions to go more in depth.
Thanks,
Dev
Related
I am trying to create Swing GUI in netbeans. But when I run it, it does not work as I designed it. Somehow horizontally & vertically it's a little bit bigger than I designed. shown in image the bottom one is running & the top one is the design.
I have tried manually changing the size of jFrame & jPanel but not helping.
code
I am a total noob and I don't know where the problem is.
I wanted to create an autoclicker that should have different functions. This autoclicker should have a JFrame in which you can make some configurations. I also wanted to offer a way to place the window "up". It should be possible to place the windows in a corner and it should also stay at the top when you are in a full screen. For example, if I am in a game, I want to be able to play the game as normal. While I'm playing the JFrame should stay above the game so I can see autoclickerframe. When I click on the window on which I can make settings, this should happen without the fullscreen window is reduced.
So my question is how this would be possible. I have seen "overlays" like this often already. Isn't overwolfs layout also working like my frame should? Is this even possible with java, if yes may one tell me how?
I want to make my application header repeated image like similar to ccleaner application header , below. I want to also put logo right top corner but when I maximizing the window , it stays in the middle. I am currently using netbeans.
Similar to ;
CSS Background Repeat ,
Okay, well do you have an attempt within your netbeans project? Something visual like a screen shot of your running application that we can work with.
If you have set your panel to the size of the JFrame then you have two options.
1. Lock the JFrame from resizing at all: Prevent Window resizing on Java (Netbeans)
2. Make the application scale/resize with the JFrame: JFrame Resizing in Desktop Application - NetBeans
Let me know if those help.
A lot of Netbeans (in terms of sizing/responsiveness) is about setting the Frame/Panel/ect... attributes so that they are all the same (locked or re-size'able)
I'm trying to create a java desktop application that holds desktop icons. The app will be a menu/panel that is invisible until you hover your cursor near the top of the screen, at which point the menu full of desktop icons will drop down. To add new icons to the menu one must simply drag icons from the desktop into the menu and they should snap to grid. As I am an intermediate level programmer but I havn't ever done a GUI app before in any language, I was wondering if someone could help me out, both with how to approach the problem and on the packages and methods I should be using. Also, I'm thinking of doing this with NetBeans unless you have any other suggestions.
Thanks,
Andrew
As an alternative to Chad's option, you could also do this by creating a frame and using Java's transparent window capability to make the frame transparent (or translucent, if you want a hint that it's there), and using mouse entered/exited events to return the frame to its normal "solid" opacity.
Personally I'd try this solution just because I'd rather use event-based notification than polling the mouse position, but I expect it's more work than the other alternative.
As to drag and drop, I haven't used it extensively enough in Java to give any solutions, but it's not immediately obvious (from a cursory internet search) of how to handle native desktop drag and drops. I'd suggest starting with some dnd tutorials within an application so that you really understand Java's drag and drop API and capabilities.
You can use java.awt.MouseInfo to get the location of the mouse at any point in time, even if you don't have any windows open.
So, you could start a java program, then in your main loop poll the mouse location. If it's in the 'top', then you can open a window.
You can use the easiest thing to do would be to use JButtons or JLabels with images to represent the desktop icons. Just load the image you want to use and stick that on as a label.
I'd start by going through swing tutorial and writing a few simple GUI programs to get the hang of it.
But the MouseInfo thing is what you need to tell when the mouse is at the top of the screen.
I'm trying to write a silly little app using Java and AWT.
It simply runs and animates some shapes, so as a first step, I created a simple app that clears a canvas with fillRect every 50ms.
The problem is, my app flickers every now and then with the underlying window colour. Google is failing me when it comes to finding simple hello-world type examples of flicker-free animating AWT apps.
What would the skeletal code for something like this look like?
Have a look for double buffering code.
http://www.codeproject.com/KB/graphics/javadoublebuffer.aspx