Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
Watch→
Answer: To obtain the current screen size requires interfacing with the native
window system. The Java AWT library allows this through the Toolkit
class. The Toolkit class creates the bindings between the AWT classes
and their native peers. You can obtain the default Toolkit by using the
Toolkit.getDefaultToolkit() static method, or you can directly obtain
the Toolkit used by a java.awt.Component derived class by calling its
getToolkit() method.
The Toolkit class has a method called getScreenSize() which returns a
reference to a Dimension instance that contains the screen width and
height. You can use this information to resize your frame to fill the
entire screen or adjust its size to some percentage of the screen
dimensions.
The following short example prints the screen width and height to
standard output:
import java.awt.*;
public final class ScreenSize {
public static final void main(String[] args) {
Dimension size;
size = Toolkit.getDefaultToolkit().getScreenSize();
System.out.println("Width: " + size.width + " Height: " + size.height);
System.exit(0);
}
}
Please enable Javascript in your browser, before you post the comment! Now Javascript is disabled.
Your name/nickname
Your email
WebSite
Subject
(Maximum characters: 1200). You have 1200 characters left.