小编ens*_*orj的帖子

使用ActionListeners并且无法将文本字段设置为不可见

在我点击其中一个编号按钮之前,我只是想让文本字段不可见.忽略我糟糕的间距和缺乏评论,因为这是一个早期的粗略草案.文本字段名为inputField1,我希望当我单击标记为1的按钮时将其设置为Visible.谢谢

import java.lang.String.*;
import java.lang.Exception.*;
import java.util.EventObject;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Airplanes extends JFrame implements ActionListener {
    private static final int FRAME_WIDTH = 330;
    private static final int FRAME_HEIGHT = 300;

    private static final int FRAME_X_ORIGIN = 150;
    private static final int FRAME_Y_ORIGIN = 300;

    private static final int BUTTON_WIDTH = 50;
    private static final int BUTTON_HEIGHT = 30;

    private JTextField inputLine1;

    private JButton oneButton;
    private JButton twoButton;
    private JButton threeButton;
    private JButton fourButton;
    private JButton …
Run Code Online (Sandbox Code Playgroud)

java user-interface swing jbutton actionlistener

2
推荐指数
1
解决办法
1813
查看次数

标签 统计

actionlistener ×1

java ×1

jbutton ×1

swing ×1

user-interface ×1