JAVA编程:编写一个图形界面的Application程序 编写一个图形界面的Application程序.包括一个文本框和一个按钮,在文本框中输入若干字符串,然后将其保存在文件中.1。.
Java编写一个图形界面 我觉得还是我的好些。import java.awt.BorderLayout;import java.awt.Color;import java.awt.FlowLayout;import java.awt.GridLayout;import java.awt.Toolkit;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.io.FileOutputStream;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.SwingConstants;public class TestSwing extends JFrame{private JLabel label1,label2,label3,label4,label5,label6,label7;private JPanel panel,panel1,panel2;private JTextField tField1,tField2,tField3,tField4,tField5,tField6,tField7,tField8,tField9;private JButton button;private String filepath=\"c:\\\\info.dat;public TestSwing(){init();this.setSize(300,280);this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width-thisgetSize().width)/2,(Toolkit.getDefaultToolkit().getScreenSize().height-thisgetSize().height)/2);this.setResizable(false);this。.
JAVA图形界面程序编写 我真的是抽风了,手痒了,给你写了这段代码,如果楼主、嘻嘻,追点分给我吧import java.awt.*;import java.awt.event.*;import java.io.*;import javax.swing.*;public classbaidu_9 extends JFrame implements ActionListener{static final String OUTPUT=\"C:/Test.txt;JPanel pnl;JLabel lbl;JTextField txt1,txt2;JButton btnCopy,btnClear,btnOutput,btnColor;publicbaidu_9(){super(\"题目\");pnl=new JPanel();this.setContentPane(pnl);pnl.setLayout(null);pnl.setBackground(Color.WHITE);lbl=new JLabel(\"\");txt1=new JTextField(10);txt2=new JTextField(10);btnCopy=new JButton(\"复制\");btnCopy.addActionListener(this);btnClear=new JButton(\"清除\");btnClear.addActionListener(this);btnOutput=new JButton(\"写入\");btnOutput.addActionListener(this);btnColor=new JButton(\"变色\");btnColor.addActionListener(this);lbl.setBounds(100,10,80,20);txt1.setBounds(10,40,100,20);txt2.setBounds(120,40,100,20);btnCopy.setBounds(10,70,60,20);btnClear.setBounds(75,70,60,20);btnOutput.setBounds(140,70,60,20);btnColor。.
java怎么用图形界面编写 Java Swing
求一个简单的java代码:(图形界面) 直接写main函数里了public static void main(String[]args){JFrame ck=new JFrame(\"title\");JPanel mb=new JPanel();mb.setLayout(null);String str=\"test;自己定义要显示什么JTextArea ta=new JTextArea(str);ta.setBounds(0,0,100,30);自己定义文本区在窗口中的位置和大小mb.add(ta);ck.add(mb);ck.setVisible(true);ck.setBounds(200,200,500,500);自己定义窗口位置和大小}
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。.
编写一个图形界面的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编写一个图形界面程序 import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.*;import javax.swing.border.Border;class MainFrame extends JFrame {private static final long serialVersionUID=1L;private Map,Integer>;sizes=new HashMap,Integer>;();private Map,Integer>;styles=new HashMap,Integer>;();private Map,Integer>;toppings=new HashMap,Integer>;();public MainFrame(){sizes.put(\"Extra Large\",10);sizes.put(\"Large\",8);sizes.put(\"Medium\",5);sizes.put(\"Small\",3);styles.put(\"Deep Dish\",20);styles.put(\"Regular\",10);styles.put(\"Thin Crust\",5);styles.put(\"Chicago\",3);toppings.put(\"Cheese\",8);toppings.put(\"Tomato\",7);toppings.put(\"Peppers\",6);toppings.put(\"Peperoni\",5);this.setTitle(\"布局及事件处理\");this.setSize(450,350);this.setLayout(new BorderLayout());this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel lblTitle=new JLabel();lblTitle.setText(\"Pizzeria Juno\");lblTitle.setFont(new Font(\"宋体\",Font.BOLD,36));lblTitle.setHorizontalAlignment(SwingConstants.CENTER);this.add(\"North\",。
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编写图形界面的Application程序 java编写图形界面需要用到swing等组件,可以在eclipse中安装windowbuilder来开发窗体,自动生成窗体代码,然后自己再根据需要修改,如:package mainFrame;import java.awt.EventQueue;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.SwingConstants;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import javax.swing.border.EmptyBorder;public class Mian_login extends JFrame {private JPanel contentPane;private JTextField text_LoginName;private JPasswordField Login_password;Launch the application.public static void main(String[]args){EventQueue.invokeLater(new Runnable(){Overridepublic void run(){try {Mian_login frame=new Mian_login();frame.setVisible(true);} catch(Exception e){e。.