发给你了。
Ⅱ java做图形界面程序,GUI写出来怎么那么丑啊,java做界面...
java做图形界面程序,GUI写出来怎么那么丑啊,java做界面...
请在珍惜的时候,好好去爱
Ⅲ JAVA 中 GUI登录界面设计源代码
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Login {
private JFrame frame = new JFrame("登录");
private Container c = frame.getContentPane();
private JTextField username = new JTextField();
private JPasswordField password = new JPasswordField();
private JButton ok = new JButton("确定");
private JButton cancel = new JButton("取消");
public Login(){
.setSize(300,200);
c.setLayout(new BorderLayout());
initFrame();
frame.setVisible(true);
}
private void initFrame() {
//顶部
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new FlowLayout());
titlePanel.add(new JLabel("系统管理员登录"));
c.add(titlePanel,"North");
//中部表单
JPanel fieldPanel = new JPanel();
fieldPanel.setLayout(null);
JLabel l1 = new JLabel("用户名:");
l1.setBounds(50, 20, 50, 20);
JLabel l2 = new JLabel("密 码:");
l2.setBounds(50, 60, 50, 20);
fieldPanel.add(l1);
fieldPanel.add(l2);
username.setBounds(110,20,120,20);
password.setBounds(110,60,120,20);
fieldPanel.add(username);
fieldPanel.add(password);
c.add(fieldPanel,"Center");
//底部按钮
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(ok);
buttonPanel.add(cancel);
c.add(buttonPanel,"South");
}
public static void main(String[] args){
new Login();
}
}
Ⅳ java图形界面(GUI)
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public class Window extends Frame{
Button button1 = new Button("开始");
Button button2 = new Button("结束");
TextField textfield = new TextField();
static Random random = new Random();
String string = null;
boolean bstart = false;
Thread thread;
public void launchFrame() {
.setLocation(500, 200);
this.setLayout(new BorderLayout());
this.add(button1, new BorderLayout().WEST);
this.add(button2, new BorderLayout().EAST);
this.add(textfield, new BorderLayout().NORTH);
button1.addActionListener(new Button1Listener());
button2.addActionListener(new Button2Listener());
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
pack();
setVisible(true);
}
private class Button1Listener implements ActionListener {
public void actionPerformed(ActionEvent e) {
bstart = true;
thread = new Thread(new NumProce());
thread.start();
}
}
private class Button2Listener implements ActionListener {
public void actionPerformed(ActionEvent e) {
bstart = false;
}
}
private class NumProce implements Runnable {
private void numproce() {
string = Integer.toString(random.nextInt()); /*nextint的括号中处可以修改产生随机数的范围*/
textfield.setText(string);
}
public void run() {
while(bstart) {
try {
numproce();
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
new Window().launchFrame();
}
}
Ⅳ java界面设计的GUI是什么东西
如果要写桌面基于Swing窗体的程序,建议用netbeans.
NB的Swing插件比eclipse好用很多。也可以在NB里面画好了窗体复制到eclipse里去用。
Ⅵ 用哪一种java编程工具GUI做出的界面漂亮
工具不重复要。
工具只能做基本的制那些GUI,用什么工具做都是一样的。
要做出漂亮的GUI关键是LOOK&FEEL要精致,布局要合理。
如果水平够高,没有什么想象中的界面是做不出来的。
win7那样的感觉也是可以用java做的,不过可能达到win7那样半透明的效果有点费尽,不过都是可以做的,而且绝对是任何工具都做不出来的。
Ⅶ JAVA程序设计,使用GUI界面
效果图
importjava.awt.*;
importjava.awt.event.*;
importjavax.swing.*;
{
JLabeljlkey;
publicKeyFrame(){
=newJLabel("请输入字母或者数字,其他字符不显示");
add(jlkey);
addKeyListener(this);
setLayout(newFlowLayout());
setSize(260,160);
setTitle("输入...");
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
publicstaticvoidmain(String[]args){
newKeyFrame();
}
publicvoidkeyTyped(KeyEvente){//敲击键盘
c=e.getKeyChar();//得到键入的字符
repaint();//重绘
}
publicvoidkeyPressed(KeyEvente){//按下键盘
// c=e.getKeyChar();
// repaint();
}
publicvoidkeyReleased(KeyEvente){//释放键盘
}
charc;
@Override
publicvoidpaint(Graphicsg){
super.paint(g);
//如果只能显示输入的是字母或者数字,那么需要if判断下
if((c<='Z'&&c>='A')||(c<='z'&&c>='a')||(c<='9'&&c>='0')){//注意比较的是字符'9'和字符'0'
Fontfont=g.getFont();
g.setColor(Color.BLUE);
g.setFont(newFont(font.getName(),font.getStyle(),20));
g.drawString(c+"",100,100); //绘制
}
}
}
Ⅷ JAVA图形界面(GUI)为什么现在很少有人用
最佳答案
原因(个人意见)
系统没有集成java类库,开发出来的界面还需要加入几十M库,导致安装包非常的大,用户不能接受而已。(可能实现功能的代码不足1M,而库就需要30M)如果操作系统自带了部分库,可能会好一点
开发出精美的界面需要自己重构的组件太多,费力不讨好的事情。自带的组件都比较丑陋,相当于你在开发库
部分性能不如C或C++,Java是轻量级的,现在都是网络时代,如果你开发的软件只能玩单机就没有意思了,如:做一个屏幕控制软件,一般的思路就是截屏发送屏幕,发送相应的响应操作。发送就需要通信你用java 自带的通信 TCP UDP 什么的 麻烦并且性能永远都跟不上
学习是可以的,写点小应用玩,还是很不错的。如:记事本、计算器、五子棋等
Ⅸ Java Swing写一个GUI界面,分成左右两栏
importjava.awt.Color;
importjavax.swing.JFrame;
importjavax.swing.JPanel;
importjavax.swing.jsplitPane;
{
JPaneljp1,jp2;
publicDemoFrame(){
=newJPanel();
jp1.setBackground(Color.RED);
jp2=newJPanel();
jp2.setBackground(Color.YELLOW);
JSplitPanejsp=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,jp1,jp2);
add(jsp);
setTitle("拆分窗口");
setBounds(300,200,500,500);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
jsp.setDividerLocation(0.5);//在1/2处进行拆分
}
publicstaticvoidmain(String[]args){
newDemoFrame();
}
}

Ⅹ JAVA中GUI登录界面设计源代码是什么
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Login {
private JFrame frame = new JFrame("登录");
private Container c = frame.getContentPane();
private JTextField username = new JTextField();
private JPasswordField password = new JPasswordField();
private JButton ok = new JButton("确定");
private JButton cancel = new JButton("取消");
public Login(){
frame.setSize(300,200);
c.setLayout(new BorderLayout());
initFrame();
frame.setVisible(true);
}
private void initFrame() {
//顶部
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new FlowLayout());
titlePanel.add(new JLabel("系统管理员登录"));
c.add(titlePanel,"North");
//中部表单
JPanel fieldPanel = new JPanel();
fieldPanel.setLayout(null);
JLabel l1 = new JLabel("用户名:");
l1.setBounds(50, 20, 50, 20);
JLabel l2 = new JLabel("密 码:");
l2.setBounds(50, 60, 50, 20);
fieldPanel.add(l1);
fieldPanel.add(l2);
username.setBounds(110,20,120,20);
password.setBounds(110,60,120,20);
fieldPanel.add(username);
fieldPanel.add(password);
c.add(fieldPanel,"Center");
//底部按钮
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(ok);
buttonPanel.add(cancel);
c.add(buttonPanel,"South");
}
public static void main(String[] args){
new Login();
}
}