gpt4 book ai didi

java - 将选项 Pane 放入字符串变量中

转载 作者:行者123 更新时间:2023-12-02 06:11:00 25 4
gpt4 key购买 nike

好吧,我不确定这是否是提出我的问题的正确网页。我是Java新手,不懂任何编程语言。我正在自学,以便编写一个特定的程序。因此,如果这不是基本问题的地方,那么如果有人有另一个页面供我尝试,我想知道。

我想学习如何做到这一点。

所以我的问题是这样的:

我已经编写了一个字符串变量,现在我想放入一个选项 Pane ,该 Pane 会弹出一个对话框,人们可以在其中输入答案,并且该答案将出现在字符串变量的段落中。我将选项 Pane 放在字符串变量的前面,并将打印输出放在字符串变量段落中。但我想我需要一些东西将它们联系在一起?

我说得有道理吗?

这是我的刺痛代码

package intro.pkg2;

public class Intro2 {
public static void main(String[] args) {
String Intro = " Introduction \n Nishkian Monks, PLLC the established this \n manual in an effort to ensure the fair and consistent application \n of Company policies and procedures among all employees. The manual \n is intended to promote understanding within the organizationand to \n outline the privileges of employment. It supersedes any previous employee \n handbook, manual or administrative memorandum that you may have received. \n This Personnel Policy Manual does not constitute an employment agreement, but \n has been established to identify the obligations that the Company assumes toward \n its staff and vice versa. The policies contained herein are intended to stress \n the values of fair play, courtesy, and teamwork. This manual is to be used as a \n working guide for all personnel in the day-to-day work routine. It is anticipated \n the manual will be amended periodically to include new policies and procedures and/or \n to make policy changes. From time to time, you may have questions about your job \n and/or company policy. You are encouraged to discuss with the Principals, questions \n or problems related to any matters which may be affecting your performance. You are \n also encouraged to offer suggestions for the improvement of services, simplification of \n operations, saving of material of time, prevention of accidents, reductions of cost, or \n anything else you think will make the Company a better place to work.";

System.out.println(Intro);
}
}

这是我的问题框代码

package company;
import javax.swing.JOptionPane;

public class Company {

public static void main(String[] args) {
String company_name;
company_name = JOptionPane.showInputDialog("Company Name");
JOptionPane.showMessageDialog(null, company_name);
}
}

你们都太棒了,我想通过你们发给我的链接我会弄清楚的。我知道我才刚刚开始,您真的愿意帮助初学者!我相信我会带着更多问题回来,谢谢大家!

最佳答案

显示一个对话框,要求用户输入字符串:

String inputValue = JOptionPane.showInputDialog("Please input a value");

详细了解如何使用 JOptionPane here

关于java - 将选项 Pane 放入字符串变量中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21884639/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com