I'm trying to create a screen capture program.
I have a transparent window, which will capture this area on a button I hit the button ScreenRecord.java here Change it so that it is a constructor Call the method ... Now that the name of the classes has been started with the upper part, so you can tell the difference between a method and constructor, because one of them Causes are welcome, case letters i.e. Just saying Capture , and I try to instantiate a class
captureScreen I am using a
command prompt , which is used when it is executed individually in different files.
capture when trying to instantiate this
captureScreen class but it does not work and
Capture Screen Java does not do anything differently when this file is transformed immediately
captureScreen a = new captureScreen ();
System.out.println ("Start"); will not print anything, even though it works correctly when running with
Java caption screen
The public class's screen record is JFrame applying ActionListener {public screenrecord () {....} Public Zero Action implemented (ActionEvent E) {if ("records" .equals (e.getActionCommand ())) {captureScreen a = new captureScreen (); Println ("Donesssssss"); }}} Extends the class capture screen object {Public Ink Capture Screen () {... Robot Robot = New Robot (); Buffet image image = robot.createcrescapture (screenrecognally); ImageIO.write (image, "PNG", new file (filename)); Println ("full"); Return 1;} Hold (AWTException pre) {System.out.println ("Error" + East); Return 1; } Hold (IOException pre) {System.out.println ("error" + east); Return 1; }}}
public int capture screen () { It's not a constructor, it's a method, so call
You can ...
public capture screen () {...}
or you can ...
capture screen = a new capture screen () ; A.captureScreen ();
CaptureScreen , where constructors follow the same code for the
public capture screen () {...} and lower case letters Start with.
No comments:
Post a Comment