我正在使用java,我正在尝试制作一个JTextArea不可编辑的但仍然在该领域的插入符号.换句话说,文本区域不显示用户键入的字符,但仍具有闪烁的插入符号(即焦点).
老实说,我很难过这个问题.我已经尝试过乱了setEditable,但是没有办法保留插入符号.我也尝试删除用户输入的字符,但我不能阻止它在屏幕上闪烁.
我正在尝试通过编写一个简单的每周计划程序来自学java,并且我的代码中的if语句让我感到悲伤,这是我的代码:
import java.util.Scanner;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class Week
{
public static void main(String[] args) throws IOException
{
Scanner inorout = new Scanner(System.in);
System.out.println("Do you want to read or write (r/w)");
String decision = inorout.nextLine();
System.out.println(decision);
if(decision == "r")
{
System.out.println("It has gone into the if");
Scanner namer = new Scanner(System.in);
System.out.println("What is the name of the week you want to read?");
String r = namer.nextLine();
Scanner s = new Scanner(new File(r + ".txt"));
System.out.println("What is Your …Run Code Online (Sandbox Code Playgroud) 嘿,我是python编程的新手,我有问题,我不能解决谷歌搜索的答案.
我需要ping一个网站地址(例如www.google.com)并让python给我一个IP地址.
干杯