所有平台上的java

编程入门 行业动态 更新时间:2024-10-26 04:25:12
本文介绍了所有平台上的java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果您想在java for windows,mac和linux中编写桌面应用程序代码,那么所有代码​​的代码是否相同?

if you wanna code a desktop application in java for windows, mac and linux, will the code be the same for all of them?

你只需更改GUI使Windows应用程序更像Windows等等?

and you just change the GUI so that the Windows application will be more Windows-like and so on?

如何在不深入细节的情况下工作?

how does it work without digging into details?

推荐答案

Java的一个卖点是一次编写,随处运行(几乎)。

One of Java's selling points is that is is "Write Once, Run Anywhere" (pretty much).

编译的字节码由Java虚拟机(JVM)执行。 JVM特定于其运行的平台,但任何具有JVM的平台都可以执行相同的字节码。代码不必重新编译。

The compiled bytecode is executed by the Java Virtual Machine (JVM). The JVM is specific to the platform that it runs on but the same bytecode can be executed by any platform that has a JVM. The code does not have to be recompiled.

Swing是Java的跨平台GUI工具包。您可以对其进行配置,使其具有在不同平台上看起来相同的GUI(它们在任何平台上看起来都不是原生的),或者您可以告诉它使用最适合它的平台的外观正在执行。因此,如果您在Windows上运行它将看起来像一个Windows应用程序,如果您在OS X上运行它将看起来像一个原生的Mac应用程序。

Swing is Java's cross-platform GUI toolkit. You can configure it so that it has a GUI that looks the same across different platforms (it won't look native on any of them), or you can tell it to use the most appropriate look-and-feel for the platform that it is executing on. So if you run on Windows it will look like a Windows app, if you run on OS X it will look like a native Mac app.

更多推荐

所有平台上的java

本文发布于:2023-07-03 21:56:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1012527.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:平台上   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!