Change Jframe Shape - java

In c# you could change the form shape to be as some picture shape that you draw..
I wonder if there is the same option to do this on jFrame in java? (I'm using netbeans)
and for example this is the picture I want to be used as the jFrame shape
so inside the "phone screen" I want to add some buttons.. is it possible?

See How to Create Translucent and Shaped Windows for details & especially How to Implement a Shaped Window.

Android Look and Feel
Everything on an Android screen is a rectangle. Widgets are rectangles. Launcher icons are 96 x 96 pixel squares. The text under a launcher icon makes them a rectangle.
The screen resolution of a Samsung Galaxy S3 is 1,280 x 720 pixels. The screen resolution of my 22" Samsung monitor is 1,680 X 1,050 pixels. You're going to have to turn the "phone" on its side and use your entire display to get the sharpness of the text on the S3.
This would be a great look and feel for a dashboard application. Your users are probably already accustomed to the smart phone appearance. Obviously, the gestures in your Swing application would have to use a mouse.
GUI Design
First, you create an ordinary JFrame.
Second, you create a drawable JPanel by extending JPanel and overriding the paintComponent method. You would paint the background image on this JPanel, then paint the launcher icons. The launcher icons are BufferedImages created from PNG files, so they can have transparent areas.
The drawable JPanel would listen for mouse clicks. This is so the launcher icons can be moved, and also so the launcher icons can be executed.
The Java application launched would replace the drawable JPanel with it's own JPanel. You would have to follow the Android developer guidelines in developing these JPanels, so your users feel like they're in an Android look and feel. Each application JPanel would have to be 1,280 x 720 pixels.
Your GUI model would hold all of the launcher icons, as well as the positions of these icons for each user. A relational database could hold all of this information so each user would have his or her own display.
Apps / Widgets
I hadn't worked out all the details in my mind, but there would have to be an Apps / Widgets drawable JPanel that shows all of the launcher icons and widgets. The user can drag the launcher icons from the Apps JPanel to the main drawable JPanel.

Related

Making a hole in a JFrame

I was trying to make a simple GIF capturing app, but I needed to make a hole/transparent space in a JFrame based on a JPanel.
I tried many things, from per-pixel transparency (only works with undecorated windows...), custom shapes (again, undecorated windows only), etc...
This is what I want (edited):
This is what I have:
In .NET Framework, it's as simple as setting the TransparencyKey color of the form, and setting the panel's background color to that color.
I'm wondering if this is possible....

How To create Transparent buttons on libgdx

I am trying to make a transparent button how to do that in libgdx
i tried https://github.com/cobolfoo/gdx-skineditor this skin editor but couldnt do it either
If you need buttons with concrete percentage of transparency and then you will not change that percentage anymore it's much easier to create the buttons images with desired transparency level in some graphics editor (e.g. Photoshop) and then use them in your project.

VlcJ Canvas on top

I'm using the vlcJ library to play videos in my program from another VLC process (OutOfProcess player). The vlcJ Canvas to play the video is embedded in a Component in a JTabbedPane. When the player is initialized, the video canvas comes to front on top of every other control.
I read about heavy-/lightweight component, so I know, that JRE 1.8 isn't still able to handle heavyweight components correctly, when drawed by another process embedded in lightweight components.
Embedded heavyweight components must belong to the process that
created the frame or applet. The heavyweight component must have a
valid peer within the main process of the application (or applet).
So my question is how to fix this issue, so that the Canvas will not come to front "unasked"?
The tab "Multimedia" hosts the video canvas. Despite another tab is open, the canvas stays on top of everything. When the host tab "Multimedia" is opened once, the video canvas behavave correctly and stays in its tabs.
With the help of #MadProgrammer and #caprica i was able to figure out a workaround: Since I'm using an OutOfProcess Player with vlcJ-pro i can't use the "direct" aproach, because player and canvas are not the same process.
Hide and show the video canvas is also no option, because the component, where the video images are drawn has to be visible all time (otherwise serious exception occur).
So finally i wrapped my video canvas into a JPanel with CardLayout and i switch between an empty pane and the video canvas. Every time a tab with mediaplayer is opened, the video canvas becomes visible, else the empty pane.
This workaround seems to work fine.

Swing size issue for different screen resolution

I'm using Java Swing and I want to it to set its JFrame size and the size of inner components size based on Screen resolution. I also want it to be compatible on any device like Tablet, laptop. Any easy solution for this?
I also want it to be compatible on any device like Tablet,laptop.Any
easy solution for this.
Put JScrollPane to JFrame, then put JPanel nested all JComponents to JScrollPane, then all JComponents are accesible for non-standard screens e.g net_books, crazy tablets with two or more Native OS (most of screen in Native OS there is scrolled by default)
I'm using Java Swing and I want to it to set its JFrame size and the
size of inner components size based on Screen resolution.
This is a job for LayoutManager
for really better look is not possible without manage with Font size, basically there are a few screen ratios (4:3, 16:9 ...) with a corresponding pixels (screen) resolutions, rest of then to leave for JScrollPane
there is not universal advice, everything depends of your GUI, how JComponents are laid, number of JComponents, its Rectangle on the screen
about the arts, make it look nice and good concept, (then nothing complicated)

Java Applet: Create a Frame to choose a screen area

I want to create a applet which alows the user to select an area on the users screen.
The overlay I want to create should be the same as screenr.com uses it.
http://www.screenr.com/record
// Edit
What I want to setup is a applet which allows me to create screenshots from a area.
At the moment I create a new frame with the applet. This frame is transparent and contains a panel which can be dragged and resized. This panel is also transparent but it has borders.
So more or less everything works right.
Taking screenshots works well, uploading them too.
My problem now is, that the user cant click anything on his screen because my frame overlays the whole screen.

Categories

Resources