Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
The reason I need this is cause I'm creating a free screen recorder named fraser and I really need to be able to make it have a FrameRate. Can someone please tell me how do I make it take 25 screenshots every second?
You could use java.awt.Robot; it has a method called createScreenCapture(Rectangle screenRect). For the delay between the screenshots, use for example Thread.sleep(long millis).
The code for this program is up to you to write, though.
Java introduced a screen grabber that may be of some use to you. You can change how many shots it take in time intervals. Check it out Here
See in this direction:
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);
Then you can define MyClass class:
class MyClass implements Runnable {
Robot robot = new Robot();
#Override
public void run() {
BufferedImage image = robot.createScreenCapture(...);
}
}
And then you can do this:
scheduler.scheduleAtFixedRate(new MyClass(), 1, 1, TimeUnit.SECONDS);
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm trying to place some images on a JPanel and make them "relocatable" so I can click on one of the images and move to somewhere else on the JPanel while holding the button. It works fine with one image but I just can't come up with a solution for more images than one. I have checked many examples and tried many different ways. If you have any idea please share with me. Thanks!
It works fine with one image but I just can't come up with a solution for more images than one.
You can use the Component Mover. You register the component with the class and then you can move any component.
Or if you don't need the full features of the ComponentMover class you can just use the basic listener for dragging a component.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written a simple code using Java Selenium.
After quitting the firefox i want a pop up message to be displayed in the desktop saying "script executed."
This is my Selenim code-
public class test1 {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.get("http://google.com");
driver.quit();
}
}
is there a way to do it??
if so, please guide me.
If you want it to display on the desktop you can look for an IDE with a GUI builder like Eclipse (with plugin), NetBeans or other.
Or if you want to code it take a look at this sample:
private void window()
{
JFrame jf = new JFrame();
jf.setSize(x,y);
jf.setTitle("Title");
jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
jf.setVisible(true);
}
The code above should be a good starting point, it creates a blank window. You can then look further into Java Swing and awt for more info.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I need to develop a Java programe using NetBeans. And In a JFrame I need to add a a image of planetary system and when the user sets a date and a time, Planets should rotate to their relevant positions. I don't have any idea about this yet. What is the possible way to do this? Please tell me soon
There are literally dozens of ways this might be achieved.
You could use:
Swing Timer
The Timing Framework
Trident
java-universal-tween-engine
The last three are animation engines. Personally, I use the Timing Framework, but that's more to do with what I'm familiar with and my needs at the time.
You'll probably need to do a lot of custom painting to get this to work, take a look at:
Custom Painting
2D Graphics
For more details
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
My problem is this so right now i have 2 different applet classes one for the title screen of applet and then another for my actual menu. They each do something differently in the paint method, so i wanna know if i can run my main class and then launch my second class from my main class
or if it would be better just call my second class from the main class for drawing things and other stuff
In my limited experience with applets, usually you have one class that extends Applet -- or better JApplet since Swing is much more robust and flexible. If you need to do painting, do so in a class that extends JPanel or JComponent and draw in its paintComponent method override. You can then display the JPanel in the applet when necessary.
For more specific help, please give us more information on the specifics of your code and your problem.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I would like to have a red filled circle at some place in my window. After the click on the circle, the circle should jump from the original place to a new one (disappear from the old place and appear on the new one). What would be the best way to do it?
I also would like to know how to draw a filled circle in Java. Are there any simple tools to do it? Or may be the easiest way is to use an image created by some other software?
ADDED:
For the beginning I would like to have just a redraw (a circle disappear and at "the same moment" it appears on the new position). I think it will be simple that some visual effects and I would like to start from the simples possible choice.
This can be done using Swing, Graphics2D and a custom JPanel. The tutorial contains a similar example:
http://java.sun.com/docs/books/tutorial/uiswing/painting/step3.html