How can I scale fonts on a high resolution screen?

On a high-resolution screen (my example, Windows 8.1) is my Java application. The menu in particular is very small, and it's almost impossible to select a menu item. In the normal screens (72 DPI) everything is OK. Font with a fixed size (in my case it would have <80px), is a poor choice. 72 DPI screens show it very large. How can I make the fonts scalable so that the program confo

如何在高分辨率屏幕上缩放字体?

在高分辨率屏幕上(我的例子中,Windows 8.1)是我的Java应用程序。 菜单非常小,几乎不可能选择菜单项。 在正常屏幕(72 DPI)中,一切正常。 字体与固定大小(在我的情况下,它将有<80px),是一个糟糕的选择。 72个DPI屏幕显示它非常大。 我怎样才能使字体扩展,使程序符合其大小,或者用户有可能设置? 您可以通过在高DPI屏幕上访问PLAF:Java Swing来更改默认字体大小 但是这仍然会使应用程序看起来很糟糕,

Webcam frame not working on macbook in Java

I just waded through my first install of opencv on my mac air, and I've been trying to get input out of the camera built into the screen. So far as I can tell, I have the libraries running in Eclipse correctly, as I no longer get massive errors every time I try to call any of the methods. However, what is happening now is a problem with the webcam, which seems to be correctly created with 0

Webcam框架在Java中不能用于macbook

我刚刚在我的Mac Air上安装了第一次opencv,我一直试图从内置在屏幕上的相机中获取输入信息。 据我所知,我有正确运行在Eclipse中的库,因为我每次尝试调用任何方法时都不会发生大量错误。 然而,现在发生的情况是网络摄像头出现问题,这看起来是正确创建的,传递给构造函数的值为0(1-50返回任何内容,-1相信是默认值)。 但是当我尝试用它来取回框架时,垫子总是空的。 据我所知,似乎我能够访问摄像头,但是在代码之间会

Why does OpenJDK place private methods into vtable?

It seems that openJDK 8 places private methods which are not final nor static into vtable. Why is it so when dynamic binding is not used for private methods (since they're invoked with invokespecial) or is it used? This is done to handle some rare situations when an overridable method with the same name and signature exists in a superclass. Though there is definitely a place for improveme

为什么OpenJDK将私有方法放入vtable中?

看起来,openJDK 8将私有方法放入vtable中并不是final或static 。 为什么当动态绑定不用于私有方法(因为它们是用invokespecial调用的)还是被使用? 当超类中存在具有相同名称和签名的可重写方法时,这样做是为了处理一些罕见的情况。 尽管肯定有一些地方需要改进,但可能会针对JDK 9。 请参阅https://bugs.openjdk.java.net/browse/JDK-8024368 私有方法总是得到一个vtable条目来处理与类的向后兼容性 - 也就是说,你

Why Is InterruptedException a Checked Exception?

When working with threads in Java, dealing with InterruptedException seems to be a particular thorn in my side. I appreciate the fact that it's thrown when my threads are terminated, and thus offers me a chance to cleanup. What seems odd to me is that it's not an unchecked exception. This creates the following problems: a) If I want to use an existing framework in my threaded app, I&#

为什么中断异常检查异常?

在Java中使用线程时,处理InterruptedException似乎是我身边的一个棘手问题。 我很欣赏它在我的线程被终止时抛出的事实,因此为我提供了清理的机会。 我觉得奇怪的是,这不是一个没有检查的例外。 这会产生以下问题:a)如果我想在线程应用程序中使用现有框架,我不得不将其转换为框架接口接受的异常。 因此,框架通常会曲解它,而不是像它应该清理或传播它。 b)除非堆栈中每次调用严格声明InterruptedException(并且通

How exactly works the @ResponseStatus Spring annotation for RESTful application?

I am studying for the Spring Core certification and I have some doubt about how Spring handle REST request. I know that with REST the resources are exposed as name and that the action of these resources are the HTTP methods: GET , PUT , POST , DELETE And I know that the request are handled by the use of @RequestMapping annotations over the method that handle the resource. From what I have u

RESTful应用程序的@ResponseStatus Spring注释究竟如何工作?

我正在学习Spring Core认证,并且对Spring如何处理REST请求有一些疑问。 我知道在REST中资源是以名称的形式公开的,这些资源的行为是HTTP方法: GET , PUT , POST , DELETE 我知道请求是通过在处理资源的方法上使用@RequestMapping注释来处理的。 从我所了解的标准Web应用程序和RESTful应用程序使用一些代码与客户进行通信(RESTful应用程序具有扩展的一组代码),我认为它们代表请求的状态(例如200是请求是成功的GET

time screensharing to Java app (localhost)

I am looking for a way to add an overlay to a running Windows game, like OBS (a game streaming application, used for Twitch). I though about using the Robot class to take 25/30 screenshots every seconds and display them, but I'm not sure that's the right solution.. So my question is the following: How can I screenshare a running app to a Java application (localhost, same computer), in

实时屏幕共享到Java应用程序(本地主机)

我正在寻找一种方法来为正在运行的Windows游戏添加覆盖图,例如OBS(用于Twitch的游戏流应用程序)。 我虽然关于使用Robot类每秒钟截取25/30的截图并显示它们,但我不确定这是正确的解决方案。 所以我的问题如下:我如何屏蔽正在运行的应用程序到Java应用程序(本地主机,同一台计算机),以便在它前面添加覆盖图? 编辑 :我尝试使用VLC流媒体,但这使得电脑真的laggy(i7 / 8Gb)...我也尝试使用FFMpeg,使用screen-capt

Collections.sort is not sorting anything

I'm trying to sort a String array in a short, simple way. I'm trying to use Collections.sort, but I don't understand why it doesn't sort anything. Code: public static String[] FishNamesSorted; ..... List<String> nameslist = new ArrayList<String>(); nameslist.toArray(FishNamesSorted); Collections.sort(nameslist, String.CASE_INSENSITIVE_ORDER); <--- NOT WORKING Co

Collections.sort不排序任何东西

我试图用简单的方法对String数组进行排序。 我试图使用Collections.sort,但我不明白为什么它不排序。 码: public static String[] FishNamesSorted; ..... List<String> nameslist = new ArrayList<String>(); nameslist.toArray(FishNamesSorted); Collections.sort(nameslist, String.CASE_INSENSITIVE_ORDER); <--- NOT WORKING Collections.sort(nameslist, new Comparator<String>() { <--- N

Set specific URL for static files using Spark Framework

I'm using Spark to serve a web page.. For the static files I initialize Spark like stated here: So I have this structure: /src/main/resources/public/ |-- foo/ |-- css/ | |-- bootstrap.css |-- js/ | ... |-- img/

使用Spark Framework为静态文件设置特定的URL

我使用Spark来为网页提供服务。对于静态文件,我按照以下所述初始化Spark: 所以我有这样的结构: /src/main/resources/public/ |-- foo/ |-- css/ | |-- bootstrap.css |-- js/ | ... |-- img/ ... 我做了foo文件

setSize() method

I am facing an issue using setSize() method in the below program. Error : The method setSize(int,int) is not defined for the type frame. When I see Java API, "Class Frame" has this Method inherited from class java.awt.Window. As i have instantiated the Frame class, this object should have setSize() method as Frame is derived class of Window. Why am I getting this error then? How

setSize()方法

我在下面的程序中遇到了使用setSize()方法的问题。 错误:没有为类型框架定义setSize(int,int)方法。 当我看到Java API时,“类框架”具有从类java.awt.Window继承的此Method。 由于我已经实例化Frame类,因此此对象应具有setSize()方法,因为Frame是Window的派生类。 为什么我得到这个错误呢? 派生类如何不包含它的超类方法? public class AwtPrac{ public static void main(String[] args) { Frame fm =

How to use methods and such

My task is to write a class called Point, which has two data members of type double. Default constructor should initialize point to origin. Also create an overloaded constructor fot the Point class which takes two doubles as parameters. This class should have methods getX, getY, setX, setY, and setXY in order to get and set data members. Also include toString method for this class that output

如何使用方法等

我的任务是编写一个名为Point的类,它有两个double类型的数据成员。 默认构造函数应该初始化指向原点。 同时创建一个重载的构造函数fot Point类,它将两个双打作为参数。 这个类应该有getX,getY,setX,setY和setXY方法来获取和设置数据成员。 还包括为此点输出坐标的toString方法。 这是我的代码看起来像: import java.util.Scanner; public class Point { private double x; private double y; public void getX(){