编写一个图形界面的Java Application,为用户提供三种关闭窗口的方法 /分别用了菜单栏,按钮和窗口关闭事件来关闭窗口,import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;public class CloseFrameDemo extends JFrame{JMenuBar bar=new JMenuBar();JMenu menu=new JMenu(\"File\");JMenuItem item=new JMenuItem(\"Exit\");JButton btn_exit=new JButton(\"Exit\");public CloseFrameDemo(){super(\"Demo\");item.addActionListener(new ActionListener(){Overridepublic void actionPerformed(ActionEvent arg0){System.exit(0);}});menu.add(item);bar.add(menu);this.setJMenuBar(bar);this.setSize(300,300);btn_exit.setBounds(200,180,80,24);btn_exit.addActionListener(new ActionListener(){Overridepublic void actionPerformed(ActionEvent arg0){System.exit(0);}});this.setLayout(null);this.add(btn_exit);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setLocationRelativeTo(null);this.setVisible(true);}public static void 。
JAVA编程:编写一个图形界面的Application程序 编写一个图形界面的Application程序.包括一个文本框和一个按钮,在文本框中输入若干字符串,然后将其保存在文件中.1。.
java编程实现图形界面 import java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JFrame;import javax.swing.JOptionPane;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.JButton;public class mi{private static String username;private static String password;private static JTextField[]t={new JTextField(\"账号:\",8),new JTextField(10),new JTextField(\"密码:\",8),new JPasswordField(10)};public static void main(String args[]){JFrame app=new JFrame(\"账号密码演示程序\");app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);app.setSize(280,120);Container c=app.getContentPane();c.setLayout(new FlowLayout());t[0].setEditable(false);t[2].setEditable(false);for(int i=0;i;i+)c.add(t[i]);t[1].setText(\"\");JButton[]b={new JButton(\"确定\"),new JButton(\"重置\")};c.add(b[0]);c.add(b[1]);app.setLocationRelativeTo(null);app.setVisible(true);b[1].addActionListener(new ActionListener(){public void 。
java如何写这个图形界面 /自己在微调一下坐标吧.import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.Rectangle;import java.io.Serializable;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;public class SwingTest extends JFrame implements Serializable{private JPanel jp1,jp2,jp3;private JLabel ab1;private But[]list=But.values();private static final long serialVersionUID=1L;SwingTest(){this.setTitle(\"系统首页\");this.setBounds(300,300,280,200);this.setResizable(false);init();this.setDefaultCloseOperation(EXIT_ON_CLOSE);this.setVisible(true);}private void init(){jp1=new JPanel();jp1.add(new JLabel(\"欢迎你来到图书馆租借系统\"));jp2=new JPanel(null);ab1=new JLabel(\"请选择服务项目\");ab1.setBounds(new Rectangle(0,0,220,25));jp2.add(ab1);jp3=new JPanel(new GridLayout(6,1));jp3.setBounds(80,20,120,120);for(int i=0;i;i+){jp3.add(new JButton(list[i].toString()));}jp2.add(jp3);this.add(jp1,BorderLayout.NORTH);this.add(jp2,BorderLayout。.