❶ 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!!可以運行