gpt4 book ai didi

java - 在 Mac 上的 NetBeans 中使用 AWT 构建基本记事本

转载 作者:行者123 更新时间:2023-12-02 12:53:29 29 4
gpt4 key购买 nike

此代码在 Windows 上运行良好,但在我的 Macbook Air 上运行不佳。为什么?菜单栏不可见;输出中只有文本区域可见。

image

import java.awt.*;

public class Notepad extends Frame {
public Notepad()
{
setTitle("Untitled-Notepad");
TextArea t1 = new TextArea(50,80);

MenuBar mb = new MenuBar();
Menu file = new Menu("File");
MenuItem n1 = new MenuItem("New");

file.add(n1);
mb.add(file);
setMenuBar(mb);

add(t1);

setSize(350,450);
setVisible(true);
setLayout(null);
}

public static void main(String[] args) {
Notepad n = new Notepad();
}
}

最佳答案

它出现在“系统菜单栏”中。

System ToolBar

请参阅标题栏上方“记事本”旁边。

关于java - 在 Mac 上的 NetBeans 中使用 AWT 构建基本记事本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44525713/

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