發給你了。
Ⅱ 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();
}
}