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.
Related
I am creating a program in which users choose options (which are buttons) and ultimately the program should display a graphics output based on their options. I have created the program with the buttons (which works fine) but I was having trouble with the graphics. I was wondering if it is possible to have both graphics (ex: a black rectangle) and the buttons on the same frame. Or, do I need to exit the frame with the buttons and create a new frame with the graphics? Thank you for any help.
I am working on an application that consists of a JFrame that runs on top of Microsoft PowerPoint. It is an invisible frame so that you can see what PowerPoint is showing. This frame has certain buttons that I want to be able to click, while a PowerPoint presentation is on "PowerPoint presentation mode" (full screen).
The problem is that, when I click a button in the frame, PowerPoint minimizes. I want PowerPoint to be kept in full screen while I click the buttons. This is the code I used to set the frame to be in front of PowerPoint.
jframe.setUndecorated(true);
jframe.setBackground(new Color(0, 255, 0, 0));
jframe.setVisible(true);
jframe.setResizable(false);
jframe.setAlwaysOnTop(true);
Some of the solutions I considered were:
Tried using jframe.setFocusable(false); so that the focus is maintained in PowerPoint app, instead of changing to my app. I also used that method in the JPanel and the buttons that are in the frame. But it doesn't seem to do the job.
This second solution works, however it is a bad one. When pressing one of the buttons, it minimizes PowerPoint, afterwards I use java Robot class to press cmd+tab (or alt+tab in windows) and since the last app that had the focus was PowerPoint, it comes back into full screen and my app is still on top. The problem is that the user will notice that, and there should be an easier way around this.
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.
I have Applet with a button running in a browser which when the button is clicked opens a JFrame. I would like to set the JFrame location to be the centre of the screen of whichever monitor the browser was running in. So if they only have one monitor the JFrame will open at the centre of this screen. If they have two monitors and the browser is in the left monitor clicking the button would open the JFrame at the centre of the left monitor. If the browser is in the right monitor display then clicking the button would cause the JFrame to open in the centre of the right monitor's display.
Currently I am using:-
Toolkit.getDefaultToolkit() to get a Toolkit object and then calling Toolkit.getScreenSize() to get the screen size and then working out the centre position from that. This is always based on the left monitor regardless of where the browser is.
Also, I know this could be further complicated if a user happened to have a different resolution between their monitors.
Get the GraphicsConfiguration of the JApplet and then pass that to the constructor of your JFrame. You would also use that GraphicsConfiguration to get a bounding rectangle for centering.
GraphicsDevice will give you info on all screen devices.
It's designed to handle the exact scenario that you need, just take a look at the sample code.
For centering one can normally use JFrame.setLocationRelativeTo(null). Maybe it centers on the default screen? What if the argument is the applet?
Can I disable the minimize button in JFrame?
I have already tried setUndecorated() and setResizable() but both did not work.
I'm trying to add images to a panel at a random location (which works) but when the JFrame is minimized by clicking at the minimize button (not when frame minimizes by clicking the background window) images assemble at the top in a row.
Can someone help?
Thanks!
If you also want to disable the maximize button then you can use a JDialog instead of a JFrame... as far as I know you cannot disable the minimize button in a JFrame. JDialog only has a close button. Hope this helps
i m trying to add imags to a panel at
a random location which i m able to
do) bt wen frame is minimized by
clicking at the minimize button (not
wen frame minimizes by clicking at the
background window) images assemble at
the top in a row.
Well, it sounds like you are adding labels to a panel and using the setLocation() method to position the labels.
The problem is that by default a JPanel uses a FlowLayout so whenever you do anything to the frame like minimize, maximize, iconify or resize the frame the layout manger is invoked and the labels are arranged according the the rules of the layout manager.
If your requirement is to have random positioning, then you need to use a "null layout".
Read the section from the Swing tutorial that explains how Absolute Positioning works for more information and a working example.
Use JDialog instead of JFrame it has only the Close button on the top.