当前位置:首页 » 编程语言 » java图形开发

java图形开发

发布时间: 2023-11-26 00:46:37

java编写一个图形界面

rcp(SWT/JFace)开发的要不要,同样是java的

⑵ java图形界面编程

执行java Applt小程序不是这样运行的。你必须建一个html文件,然后在输入
<applet code="ButtonDemo.class"
width=320 height=180>
</applet>
其中code是你编译ButtonDemo类是生成的class文件。然后在cmd中找到html文件所在的路径下输入appletviewer xxx.html
就可以运行了

⑶ 怎样用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.;

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() {

@Override

public void run() {

try {

Mian_login frame = new Mian_login();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

}

}

});

}


/**

* Create the frame.

*/

public Mian_login() {

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(500, 200, 443, 300);

setResizable(false);

setTitle("登 录");

/*获取系统按钮样式*/

String lookAndFeel = UIManager.getSystemLookAndFeelClassName();

try {

UIManager.setLookAndFeel(lookAndFeel);

} catch (ClassNotFoundException e1) {

e1.printStackTrace();

} catch (InstantiationException e1) {

e1.printStackTrace();

} catch (IllegalAccessException e1) {

e1.printStackTrace();

} catch ( e1) {

e1.printStackTrace();

}

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

JPanel panel = new JPanel();

panel.setOpaque(false);

panel.setBounds(0, 0, 434, 272);

contentPane.add(panel);

panel.setLayout(null);

JButton btn_Login = new JButton("u767Bu5F55");

btn_Login.addMouseListener(new MouseAdapter() {

@Override

public void mouseClicked(MouseEvent e) {

}

});

btn_Login.setBounds(88, 195, 70, 23);

panel.add(btn_Login);

JButton btn_cancel = new JButton("u53D6u6D88");

btn_cancel.addMouseListener(new MouseAdapter() {

@Override

public void mouseClicked(MouseEvent e) {

dispose();

}

});

btn_cancel.setBounds(268, 195, 70, 23);

panel.add(btn_cancel);

JLabel lblNewLabel_name = new JLabel("u7528u6237u540D");

lblNewLabel_name.setHorizontalAlignment(SwingConstants.CENTER);

lblNewLabel_name.setOpaque(true);

lblNewLabel_name.setBounds(88, 48, 70, 23);

panel.add(lblNewLabel_name);

JLabel lblNewLabel_passwd = new JLabel("u5BC6u7801");

lblNewLabel_passwd.setHorizontalAlignment(SwingConstants.CENTER);

lblNewLabel_passwd.setOpaque(true);

lblNewLabel_passwd.setBounds(88, 102, 70, 23);

panel.add(lblNewLabel_passwd);

JCheckBox chckbx_remember = new JCheckBox("u8BB0u4F4Fu5BC6u7801");

chckbx_remember.setBounds(102, 150, 84, 23);

panel.add(chckbx_remember);

text_LoginName = new JTextField();

text_LoginName.setBounds(182, 48, 156, 23);

panel.add(text_LoginName);

text_LoginName.setColumns(10);

Login_password = new JPasswordField();

Login_password.setBounds(182, 102, 156, 23);

panel.add(Login_password);

JCheckBox chckbx_AutoLogin = new JCheckBox("u81EAu52A8u767Bu5F55");

chckbx_AutoLogin.setBounds(233, 150, 84, 23);

panel.add(chckbx_AutoLogin);

JLabel Label_background = new JLabel("");

Label_background.setIcon(new ImageIcon("E:\JAVA_workplace\0002-u754Cu9762u8BBEu8BA1\images\background3.jpg"));

Label_background.setBounds(0, 0, 437, 272);

contentPane.add(Label_background);

}

}


热点内容
中国移动智能宽带如何配置 发布:2025-01-25 11:59:01 浏览:774
安卓手机定时关机如何设置 发布:2025-01-25 11:50:06 浏览:318
数组缓存区 发布:2025-01-25 11:17:00 浏览:875
安卓手机键盘上浮怎么调回来 发布:2025-01-25 11:17:00 浏览:260
editplusjava编译 发布:2025-01-25 11:11:56 浏览:232
手机迅雷加密安卓 发布:2025-01-25 10:39:00 浏览:211
hdmi源码功放 发布:2025-01-25 10:38:57 浏览:598
linux账户被锁 发布:2025-01-25 10:31:27 浏览:235
安卓微信语音来电铃声怎么用自己的原声 发布:2025-01-25 10:04:03 浏览:826
mac文件夹设置 发布:2025-01-25 09:56:06 浏览:389