❶ java界面编程的实战和JAVA WEB 的实战教学视频
可以搜索课课家,好像里面有JAVA WEB 的实战教学视频http://www.kokojia.com/course-2321.html此项目为java基础面向对象部分的核心练习。
❷ java图形界面编程
执行java Applt小程序不是这样运行的。你必须建一个html文件,然后在输入
<applet code="ButtonDemo.class"
width=320 height=180>
</applet>
其中code是你编译ButtonDemo类是生成的class文件。然后在cmd中找到html文件所在的路径下输入appletviewer xxx.html
就可以运行了
❸ java界面编程实现展开树
使用JTree 给你个例子import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;public class TreeDemo1{
public TreeDemo1(){
JFrame f=new JFrame("TreeDemo1");
Container contentPane=f.getContentPane();
String[] s1={"公司文件","个人信件","私人文件"};
String[] s2={"本机磁盘(C:)","本机磁盘(D:)","本机磁盘(E:)"};
String[] s3={"奇摩站","职棒消息","网络书店"};
Hashtable hashtable1=new Hashtable();
Hashtable hashtable2=new Hashtable();
hashtable1.put("我的公文包",s1);
hashtable1.put("我的电脑",s2);
hashtable1.put("收藏夹",hashtable2);
hashtable2.put("网站列表",s3);
Font font = new Font("Dialog", Font.PLAIN, 12);
Enumeration keys = UIManager.getLookAndFeelDefaults().keys();
/**定义widnows界面**/
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (UIManager.get(key) instanceof Font) {
UIManager.put(key, font);
}
}
try{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}catch(Exception el){
System.exit(0);
}
/**定义widnows界面**/
JTree tree=new JTree(hashtable1);
JScrollPane scrollPane=new JScrollPane();
scrollPane.setViewportView(tree);
contentPane.add(scrollPane);
f.pack();
f.setVisible(true);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public static void main(String[] args){
new TreeDemo1();
}
}
❹ java 界面编程
public class test extends JFrame implements ActionListener{
private JTextField jtf;
private JButton jbPlain;
private JButton jbBold;
private JButton jbItaly;
public test(){
super("test application");
init();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public void init(){
jtf = new JTextField("ceshi");
jbPlain = new JButton("putong");
jbBold = new JButton("cuti");
jbItaly = new JButton("xieti");
Container c = this.getContentPane();
c.setLayout(new GridLayout(2,3));
JPanel jp1 = new JPanel();
jp1.add(jtf);
JPanel jp2 = new JPanel();
jp2.add(jbPlain);
jp2.add(jbBold);
jp2.add(jbItaly);
c.add(jp1);
c.add(jp2);
jbPlain.addActionListener(this);
jbBold.addActionListener(this);
jbItaly.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
if(e.getSource() instanceof JButton){
if(e.getSource().equals(jbPlain)){
jtf.setFont(new Font("wo",Font.PLAIN, 12));
}
if(e.getSource().equals(jbBold)){
jtf.setFont(new Font("wo",Font.BOLD, 12));
}
if(e.getSource().equals(jbItaly)){
jtf.setFont(new Font("wo", Font.ITALIC, 12));
}
}
}
public static void main(String []args){
new test();
}
}
❺ 如何用JAVA编程编写一个界面程序(急求!!!)
用swing组件来做,你可以用jbulid或则jcreate做为开发环境
❻ 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={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 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);
} else {
JOptionPane.showMessageDialog(null, "用户名或密码错误!", "错误",
JOptionPane.ERROR_MESSAGE);
}
}
}); }
}
❼ 如何进行Java GUI图形用户界面编程
Frame f = new Frame("new title");//可以指定new title标题
f.setBachgroundColor(Color.BLUE);//设置背景是蓝色
f.setVisible(true);//可视的,false默认看不见
f.addLayout(null);//布局比较的复杂,默认赋值为null,
f.setBounds(3,4,100,200);//位置是左上角的坐标是3,4;窗口的宽是100,高是200.单位是cm
f.addWindowLisenter(new Lisenter(){
@override
public void window_closing(){//反正里面的重写的发法很多,能够关闭窗口的方法是带closing那个方法
f.dispose;//关闭窗口
}
});大致这些就能看到窗口了,里面可能有单词拼错,最重要的是可以在里面添加菜单,文本域,选择框之类,先new,比如Menu m = new Menu("文件");//菜单的对象,然后f.add(m);即可添加菜单
❽ java 可视化界面编程
import java.awt.Button;
import java.awt.Color;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class awttest
{
TextField id,pw;
TextField printid,printpw;
public awttest(){
Frame f=new Frame("用户登录");
f.setLayout(new GridLayout(4,2));
id=new TextField("输入用户名",10);
pw=new TextField(10);
pw.setEchoChar('*');
f.add(new Label("用户名:",Label.CENTER));
f.add(id);
f.add(new Label("密码:",Label.CENTER));
f.add(pw);
Button b1=new Button("登陆");
Button b2=new Button("取消");
f.add(b1);
f.add(b2);
String str1=id.getText();
String str2=pw.getText();
printid=new TextField(str1,10);
printpw=new TextField(str2,10);
f.add(printid);
f.add(printpw);
f.pack();
printid.setBackground(new Color(220,0,0));
printpw.setBackground(new Color(220,0,0));
f.setSize(250,120);
f.setVisible(true);
b1.addActionListener(new ActionListener() { // 点击“显示窗口”菜单后将窗口显示出来
public void actionPerformed(ActionEvent e) {
printid.setText(id.getText());
printpw.setText(pw.getText());
}
});
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent args)
{
System.exit(0);
}
}
);
}
public static void main(String[] args){
new awttest();
}
}
OK!!可以运行