java图形界面设计教程,java图形用户界面

1,java图形用户界面老大 , 这些属性都是JFrame的默认值吧,不明白其中的可变成图标什么意思?莫非是传说中的最小化?import javax.swing.*;class MyFrame extends JFrame{ JLable msg; MyFrame(){ super("你要的是这种东西?"); this.setBounds(100,100,100,100); msg=new JLabel("莫非这是你要的东西?"); this.add(msg,BorderLayout.CENTER); //this.add(msg); this.setVisible(true); } public static void main(String [] args){ new MyFrame(); } }图标是指改变左上角的那个咖啡杯?。炕故怯蚁陆桥鐾信贪 。浚康谝桓霰冉霞虻ィ桓鐾计托?。第二个吗,有个专门的类能解决 。
2,用java做个AWT图形用户界面代码import java.awt.*;import java.applet.Applet;public class KY6_1 extends Applet {Label l1;Button b1, b2, b3, b4, b5, b6;public void init() {setLayout(new GridLayout(3,3)); // 设置网格布局(3 行3 列共9 个网格)l1=new Label("标签1");b1 = new Button("按钮1");b2 = new Button("按钮2");b3 = new Button("按钮3");b4 = new Button("按钮4");add(l1);add(b1);add(b2);add(b3);add(new Label());add(b4);add(new Button("按钮5"));add( new Button("按钮6"));add(new Label("标签2"));}}
3,java程序设计一个最简单图形界面程序 要有注释的一个简单的表格,就显示两行数据package cn.mff.mvc.view.studentdialog;import java.awt.Color;import javax.swing.*;import javax.swing.JTable;import javax.swing.table.*;//import oracle.jdeveloper.layout.OverlayLayout2;//一个测试,看JTable怎么用public class TableTest extends JFrame private JTable table; private JScrollPane scrollPane; private JTableHeader tableh; public TableTest() super("表格显示"); //设置JTable的title和content Object[][] content =String[] title = table = new JTable(content,title); //设置背景色 table.setBackground(new Color(230, 230, 230)); //jtable没有选中的文字颜色table.setForeground(new Color(0, 0, 0));//设置边线线条 table.setGridColor(Color.CYAN); tableh = table.getTableHeader(); //设置表头背景色 tableh.setBackground(Color.GREEN); scrollPane = new JScrollPane(table); getContentPane().add(scrollPane); } public static void main(String[] args) TableTest test = new TableTest(); test.setSize(400,300); test.setDefaultCloseOperation(EXIT_ON_CLOSE); test.setVisible(true); } }【java图形界面设计教程,java图形用户界面】
4,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<4;i++) c.add(t[i]);t[1].setText(""); JButton[]b= c.add(b[0]);c.add(b[1]); app.setLocationRelativeTo(null); app.setVisible(true); b[1].addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)t[1].setText(""); t[3].setText(""); } });// 登录按钮加事件监听器 b[0].addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)username = t[1].getText(); password = t[3].getText(); //判断用户名密码是否正确 if (username.equals("数字") && password.equals("123"))JOptionPane.showMessageDialog(null, "登陆成功!", "消息", JOptionPane.INFORMATION_MESSAGE); } elseJOptionPane.showMessageDialog(null, "用户名或密码错误!", "错误", JOptionPane.ERROR_MESSAGE); } } });} }5,怎么用java编写一个图形界面应用程序其中包含一个按钮当鼠标import java.awt.event.*;import javax.swing.*;public class myclass/*** @param args*/ private JFrame fm=new JFrame(); private JButton bt=new JButton("button1"); myclass()fm.setLayout(null);fm.setDefaultCloseOperation(3);fm.setBounds(300, 200, 450, 300);bt.setBounds(10, 10, 100, 25);bt.addMouseListener(new bt1event());fm.getContentPane().add(bt);fm.show(); } class bt1event implements MouseListenerpublic void mouseClicked(MouseEvent arg0)// TODO 自动生成方法存根}public void mouseEntered(MouseEvent arg0)// TODO 自动生成方法存根bt.setVisible(false);}public void mouseExited(MouseEvent arg0)// TODO 自动生成方法存根bt.setVisible(true);}public void mousePressed(MouseEvent arg0)// TODO 自动生成方法存根}public void mouseReleased(MouseEvent arg0)// TODO 自动生成方法存根}} public static void main(String[] args)// TODO 自动生成方法存根new myclass(); }}import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import javax.swing.JButton;import javax.swing.JFrame;public class FrameTest extends MouseAdapterprivate JFrame frame;private Container c;private JButton jb;public FrameTest()frame = new JFrame();frame.setBounds(200, 300, 200, 300);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setLayout(new BorderLayout());c = frame.getContentPane();jb =new JButton("catch me!");jb.addMouseListener(this);c.add(jb,BorderLayout.NORTH);frame.setVisible(true);}public void mouseEntered(MouseEvent e)jb.setVisible(false);}public void mouseExited(MouseEvent e)jb.setVisible(true);}public static void main(String[] args)FrameTest ft = new FrameTest();}}

    推荐阅读