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)
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 would like to have an application where I've entirely customized the window's appearance. So far I've learned that I can remove the typical window stuff with:
class Application extends javafx.application.Application {
/**
* Starts the application.
*
* #param stage
*/
override def start(stage: Stage) {
stage.initStyle(StageStyle.TRANSPARENT)
// Load the main window view.
val loader = new FXMLLoader()
loader.setLocation(getClass.getResource("/com/myproj/application/MainWindow.fxml"))
val root = loader.load().asInstanceOf[Parent]
val scene: Scene = new Scene(root, Color.TRANSPARENT)
stage.setScene(scene)
stage.show()
}
}
Everything else works fine, except that window dragging, double-click-to-maximize, dragging to screen top edge on Windows should active maximizing, etc. The native Window capabilities are missing entirely.
Can I somehow rather easily customize the entire appear of the window without losing all these nice capabilities.
I'm talking about something like Adobe Photoshop which looks entirely different but still retains these features (or implements them on top of their UI manually).
It would be a start if I could at least implement dragging + window buttons for starters. I am targeting Linux, Mac and Windows here.
See the customized window appearance and handling in the Ensemble Sample application, which includes source code. Download the source, build it and run it as a standalone application rather than embedded in a browser. It isn't going to be exactly what you are asking for because stuff like dragging to screen top edge to activate maximizing isn't going to work I think, but it should be very close and you could always code something yourself which maximized the window when it was dragged near the top edge. The Ensemble window has features like custom resize decorations, minimize, maximize, close icons, an area at the top of the window you can use to drag the window around or double click to maximize or minimize the window - i.e. most of the standard features you would expect from a desktop windowing system.
To get something even closer to what you are asking, perhaps you could hack something together by creating two windows. One, a standard decorated stage window which includes screen borders, the other an undecorated or transparent child stage always displayed on top of the main window and overlaying the borders of the main window with a custom rendering. I think you may run into difficulties trying to implement this approach, so I wouldn't really recommend it.
You may like to try an UNDECORATED stage style rather than TRANSPARENT and see if you get better native Windows integration with that.
There are some open feature request currently scheduled for JavaFX to be shipped with JDK8, Windows: support Aero Glass effects for top-level windows, Mac: Support NSTexturedBackgroundWindowMask style for windows and The solid white background created in a Stage should be created - if needed - in the Scenegraph, which, when implemented, will likely help you to acheive your goal - vote for them, if such features are important to you.
Also checkout VFXWindows which is an open source windowing framework for JavaFX.
Update
Also related is the Undecorator project which allows you to easily create a JavaFX stage with standard minimize/maximize/close/resize chrome controls that are rendered via the JavaFX engine rather than the OS windowing system. This allows you to achieve the kind of custom control over window rendering that an application like Ensemble displays.
You can use this library. It is a fully customizable JavaFx Stage (CustomStage). You can see in-detail description of how to use it in this CustomStage Wiki
It has,
Window resizing
Default action buttons and their behaviour (close, maximize/restore, minimize)
Window dragging
Window is automatically scaled as for screen resolution
Very responsive
Stylable (via css and methods)
Can achieve transparency
Has in-built navigation panes and drawers
etc.
Is it possible to simply paint() (or use some other function) to the screen in Java? As in draw over everything else on some coordinates of the screen itself, not inside some window.
If not, is it possible to make an invisible window that takes up the entire screen and use its glass pane to do it? Would complications arise from doing this? (Such as not being able to click on other applications)
Are there any other ways?
Thanks.
Edit: I'm not trying to do full screen with this, by the way.
When you paint() in Java, you're painting only within the confines of the size and location of what is being paint()ed.
If you're looking to do full screen stuff, there are tutorials for that:
http://download.oracle.com/javase/tutorial/extra/fullscreen/index.html
In theory, you can create an transparent undecorated maximized JFrame. This will allow you to "paint" over the desktop. Problems are obvious: if an application stays behind this window, it will not receive any mouse events.
Months ago, I made an evil cheat to draw directly on Windows Explorer's Desktop: mixing some .NET coding with JNI and Sun's internal classes - that's surreal, but works.
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.