Я продолжаю с этой проблемой не абстрактно и не отменяет абстрактную также как применять JOptionPaneне абстрактно и не отменяет абстрактные
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
import java.awt.event.*;
public class Mycase extends JFrame implements ActionListener {
JLabel text=new JLabel("Enter Name: ");
JLabel text2=new JLabel();
JTextField name=new JTextField(12);
JButton press=new JButton("OK");
JButton cancel=new JButton("CANCEL");
public Mycase(){
super("Name");
setVisible(true);
setSize(150,100);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
add(text);
add(press);
add(cancel);
add(text2);
press.addActionListener(new press());
cancel.addActionListener(new cancel());
}
class press implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
text2.setText("");
name.setText("");
}
}
class cancel implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
}
public static void main(String[]args)
{
Mycase frame=new Mycase();
}
}
вы можете создать диалог на заказ с расширяет JDialog – subash