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圖形界面誰能做出這樣的界面只需要一個界面求源代碼

用javaFX更簡單。拖一拖就可以了,不過需要JavaFX Scene Builder 2.0
用NetBeans IDE創建swing項目也是拖一拖就可以了

Ⅲ 一個簡單的登錄界面源代碼

<script>
function login() {
var a = false;
var $text = $(".text");
$.ajax({
url: "__URL__/check",
type: "post",
data: {"username": $("#username").val(), "password": $("#password").val()},
success: function (res) {
if (res == 1) {
/* $text.text("登陸成功,請稍後..."); */
location.href = "{:U('Index/index')}";
a = true;
} else if (res == 3) {
$text.html("用戶名不存在");
$("#username").focus();
return false;
} else if (res == 2) {
$text.text("密碼錯誤");
$("#password").focus();
return false;
}
}
})

return a;
}
</script>
</head>
<body>
<div class="bg"></div>
<div class="container">
<div class="line bouncein">
<div class="xs6 xm4 xs3-move xm4-move">
<div style="height:150px;"></div>
<div class="media media-y margin-big-bottom">
</div>
<form action="" method="post" onsubmit="return login()">
<div class="panel loginbox">
<div class="text-center margin-big padding-big-top"><h1>顧森客戶管理系統</h1></div>
<div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
<div class="form-group">
<div class="field field-icon-right">
<input type="text" class="input input-big" id="username" name="username" placeholder="登錄賬號" data-validate="required:請填寫賬號" />
<span class="icon icon-user margin-small"></span>
</div>
</div>
<div class="form-group">
<div class="field field-icon-right">
<input type="password" class="input input-big" id="password" name="password" placeholder="登錄密碼" data-validate="required:請填寫密碼" />
<span class="icon icon-key margin-small"></span>
</div>
</div>
</div>
<div style="padding:30px;"><input type="submit" class="button button-block bg-main text-big input-big" value="登錄">
<span class="text" style="color:#f00;"></span>
</div>

</div>
</form>
</div>
</div>
</div>

c語言程序界面源代碼

使用一下LINUX系統,就可以感受到C編出來的界面的樣子了。
事實上,C可以寫出任何形式的界面,只不過過程比較麻煩而已,就像用機器語言也可以寫出任何一個程序,只不過工作量將是個天文數字而已。

Ⅳ 哪位大神能把我的C++源代碼加個圖形界面呀就是Windows那種~重謝

class ConnectCommand : public Command
{
public:
ConnectCommand() {}
bool run(Com *comport) Q_DECL_OVERRIDE;
QString message() Q_DECL_OVERRIDE { return QStringLiteral("建立通訊"); }
};

bool ConnectCommand::run(Com *comport)
{
....
QMetaObject::invokeMethod(model, "updateConnection", Qt::QueuedConnection, Q_ARG(bool, true));
....
}

一個命令模式的程序,命令的執行在一個單獨的線程裡面(QThread::run()),想執行完畢後更新幾個狀態,因此用invokeMethod調用相應函數,其中的model是QThread的子類。

Ⅵ Windows界面C語言源代碼

你試試吧,我不清楚能不能在BORLAND C里運行。
#include<windows.h>

LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM);

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char szClassName[]="MainWClass";
WNDCLASSEX wndclass;
// 用描述主窗口的參數填充WNDCLASSEX結構
wndclass.cbSize=sizeof(wndclass); // 結構的大小
wndclass.style=CS_HREDRAW|CS_VREDRAW|CS_OWNDC; // 指定如果大小改變就重畫
wndclass.lpfnWndProc=MainWndProc; // 窗口函數指針
wndclass.cbClsExtra=0; // 沒有額外的類內存
wndclass.cbWndExtra=0; // 沒有往外的窗口內存
wndclass.hInstance=hInstance; // 實例句柄
wndclass.hIcon=::LoadIcon(NULL,IDI_APPLICATION); // 使用預定義圖標
wndclass.hCursor=::LoadCursor(NULL,IDC_ARROW); // 使用預定義的游標
wndclass.hbrBackground=(HBRUSH)::GetStockObject(WHITE_BRUSH); // 使用白色背景畫刷
wndclass.lpszMenuName=NULL; // 不指定菜單
wndclass.lpszClassName=szClassName; // 窗口類的名稱
wndclass.hIconSm=NULL; // 沒有類的小圖標
// 注冊這個窗口類
::RegisterClassEx(&wndclass);
// 創建主窗口
HWND hwnd=::CreateWindowEx(
0, // dwExStyle,擴展樣式
szClassName, // lpClassName,類名
"Window", // lpWindowName,標題
WS_OVERLAPPEDWINDOW, // dwStyle,窗口風格
CW_USEDEFAULT, // X,初始X坐標
CW_USEDEFAULT, // Y,初始Y坐標
CW_USEDEFAULT, // nWidth,寬度
CW_USEDEFAULT, // nHeight,高度
NULL, // hWndParent,父窗口句柄
NULL, // hMenu,菜單句柄
hInstance, // hInstance,程序實例句柄
NULL); // lpParam,用戶數據
if(hwnd==NULL)
{
::MessageBox(NULL,"創建窗口出錯!","出錯",MB_OK);
return -1;
}
// 顯示窗口,刷新窗口客戶區
::ShowWindow(hwnd,nCmdShow);
::UpdateWindow(hwnd);
// 從消息隊列中取出消息,交給窗口函數處理,直到GetMessage返回FALSE,結束消息循環
MSG msg;
while(::GetMessage(&msg,NULL,0,0))
{
// 轉換鍵盤消息
::TranslateMessage(&msg);
// 將消息發送到相應的窗口函數
::DispatchMessage(&msg);
}
// 當GetMessage返回FALSE時程序結束
return msg.wParam;
}

LRESULT CALLBACK MainWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
char szText[]="最簡單的窗口程序!";
switch(message)
{
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
hdc=::BeginPaint(hwnd,&ps);
::EndPaint(hwnd,&ps);
return 0;
}
case WM_DESTROY:
::PostQuitMessage(0);
return 0;
}
return ::DefWindowProc(hwnd,message,wParam,lParam);
}

Ⅶ 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();
}

}

Ⅷ asp登錄界面源代碼

default
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>個人注冊</title>
<script language=vbscript>
sub b1_onclick()
if len(trim(form1.t1.value))=0 then
msgbox"請輸入你的帳號!",0+48,"提示"
form1.t1.focus
elseif len(trim(form1.t2.value))=0 then
msgbox"請輸入你的密碼!",0+48,"提示"
form1.t2.focus
else
if isnumeric(form1.t1.value)=true then
msgbox"請輸入漢字!",0+48,"重輸"
form1.t1.focus
elseif len(trim(form1.t2.value))<3 or len(trim(form1.t2.value))>8 then
msgbox"密碼在3至8位之間!",0+48,"重輸"
form1.t2.focus
else
window.open"1.asp","new","toolbar=no,width=280,height=150,menubar=no,scrollbar=no,resizable=0"
form1.submit
end if
end if
end sub
</script>
</head>
<body>
<p>yw9sky天地</p>

<form method="POST" action="1.asp" name="form1" target="new">
<p align="center"><font size="6" color="#FF0000" face="隸書">個人注冊</font></p>
<p align="center"><font size="4">姓名:</font><input type="text" name="t1" size="20"></p>
<p align="center"><font size="4">密碼:</font><input type="password" name="t2" size="20"></p>
<p align="center"><input type="button" value="注冊" name="B1"><input type="reset" value="重寫" name="B2"></p>
</form>

</body>

</html>

1.asp
<%@ language=vbscript %>
<%
dim x,y,num
num=0
x=request.form("t1")
y=request.form("t2")
response.cookies("user")("name")=x
response.cookies("user")("num")=num
response.cookies("user")("password")=y
response.cookies("user").expires=date()+365
%>

<html>

<head>
<title>信息確認</title>
</head>
<body>
<p>yw9sky天地</p>
<table border="0" width="100%" id="table1" align=center cellspacing=1 bgcolor=#333399>
<tr bgcolor=#ffffff align=center>
<td colspan="2" width="100%">信息確認</td>
</tr>
<tr bgcolor=#ffffff align=center>
<td width="31%">姓名:</td>
<td width="69%"><% = x %></td>
</tr>
<tr bgcolor=#ffffff align=center>
<td width="31%">密碼:</td>
<td width="69%"><% = y %></td>
</tr>
<tr bgcolor=#ffffff align=center>
<td colspan="2" width="100%" align="center"><a target="_blank" href="2.asp">登錄</a>
<font onclick="window.close()" style="cursor:hand">關閉</font></td>
</tr>
</table>

</body>
</html>

<%@ language=vbscript %>

<html>

<head>
<title>個人登錄</title>
<script language=vbscript>
sub b1_onclick()
if len(trim(form1.t1.value))=0 then
msgbox"請輸入你的姓名!",0+48,"提示"
form1.t1.focus
elseif len(trim(form1.t2.value))=0 then
msgbox"請輸入你的密碼!",0+48,"提示"
form1.t2.focus
else
if isnumeric(form1.t1.value)=true then
msgbox"請輸入漢字!",0+48,"重輸"
form1.t1.focus
elseif len(trim(form1.t2.value))<3 or len(trim(form1.t2.value))>8 then
msgbox"密碼在3至8位之間!",0+48,"重輸"
form1.t2.focus
else
form1.submit
end if
end if
end sub
</script>
</head>
<body>
<form method="POST" action="3.asp" name="form1" target="_blank">
<p align="center"><font size="6" color="#FF0000" face="隸書">個人登錄</font></p>
<p align="center"><font size="4">姓名;</font><input type="text" name="t1" size="20"></p>
<p align="center"><font size="4">密碼:</font><input type="password" name="t2" size="20"></p>
<p align="center"><input type="button" value="開始登錄" name="B1"><input type="reset" value="重新輸入" name="B2"></p>
</form>
</body>

</html>

3.asp
<% @ language=vbscript %>
<%
dim x,y,nm,pw
x=request.form("t1")
y=request.form("t2")
nm=requset.cookies("user")("name")
pw=requset.cookies("user")("password")
if nm<>x or pw<>y then
response.redirect"default.htm"
end if
%>
<%
dim num
num=request.cookies('user")("num")
if num=0 then
num=1
else
num=num+1
end if
response.cookies("user")("num")=num
%>

<html>

<head>

<title>歡迎來訪yw9sky</title>
</head>
<body>
歡迎<% =nm %>第<% =num %>次登錄
</body>

</html>

Ⅸ jsp登陸界面源代碼

1、login.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>登錄頁面</title>

</head>

<body>

<form name="loginForm" method="post" action="judgeUser.jsp">

<table>

<tr>

<td>用戶名:<input type="text" name="userName" id="userName"></td>

</tr>

<tr>

<td>密碼:<input type="password" name="password" id="password"></td>

</tr>

<tr>

<td><input type="submit" value="登錄" style="background-color:pink"> <input

type="reset" value="重置" style="background-color:red"></td>

</tr>

</table>

</form>

</body>

</html>

2、judge.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>身份驗證</title>

</head>

<body>

<%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

String password = request.getParameter("password");

if(name.equals("abc")&& password.equals("123")) {

3、afterLogin.jsp文件

%>

<jsp:forward page="afterLogin.jsp">

<jsp:param name="userName" value="<%=name%>"/>

</jsp:forward>

<%

}

else {

%>

<jsp:forward page="login.jsp"/>

<%

}

%>

</body>

</html>

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>登錄成功</title>

</head>

<body>

<%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

out.println("歡迎你:" + name);

%>

</body>

</html>

(9)源代碼界面擴展閱讀:

java web登錄界面源代碼:

1、Data_uil.java文件

import java.sql.*;

public class Data_uil

{

public Connection getConnection()

{

try{

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

}catch(ClassNotFoundException e)

{

e.printStackTrace();

}

String user="***";

String password="***";

String url="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=***";

Connection con=null;

try{

con=DriverManager.getConnection(url,user,password);

}catch(SQLException e)

{

e.printStackTrace();

}

return con;

}

public String selectPassword(String username)

{

Connection connection=getConnection();

String sql="select *from login where username=?";

PreparedStatement preparedStatement=null;

ResultSet result=null;

String password=null;

try{

preparedStatement=connection.prepareStatement(sql);

preparedStatement.setString(1,username);

result=preparedStatement.executeQuery();//可執行的 查詢

if(result.next())

password=result.getString("password");

}catch(SQLException e){

e.printStackTrace();

}finally

{

close(preparedStatement);

close(result);

close(connection);

}

System.out.println("找到的資料庫密碼為:"+password);

return password;

}

public void close (Connection con)

{

try{

if(con!=null)

{

con.close();

}

}catch(SQLException e)

{

e.printStackTrace();

}

}

public void close (PreparedStatement preparedStatement)

{

try{

if(preparedStatement!=null)

{

preparedStatement.close();

}

}catch(SQLException e)

{

e.printStackTrace();

}

}

public void close(ResultSet resultSet)

{

try{

if(resultSet!=null)

{

resultSet.close();

}

}catch(SQLException e)

{

e.printStackTrace();

}

}

}

2、login_check.jsp:文件

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>驗證用戶密碼</title>

</head>

<body>

<jsp:useBean id="util" class="util.Data_uil" scope="page" />

<%

String username=(String)request.getParameter("username");

String password=(String)request.getParameter("password");

if(username==null||"".equals(username))

{

out.print("<script language='javaScript'> alert('用戶名不能為空');</script>");

response.setHeader("refresh", "0;url=user_login.jsp");

}

else

{

System.out.println("輸入的用戶名:"+username);

String passwordInDataBase=util.selectPassword(username);

System.out.println("密碼:"+passwordInDataBase);

if(passwordInDataBase==null||"".equals(passwordInDataBase))

{

out.print("<script language='javaScript'> alert('用戶名不存在');</script>");

response.setHeader("refresh", "0;url=user_login.jsp");

}

else if(passwordInDataBase.equals(password))

{

out.print("<script language='javaScript'> alert('登錄成功');</script>");

response.setHeader("refresh", "0;url=loginSucces.jsp");

}

else

{

out.print("<script language='javaScript'> alert('密碼錯誤');</script>");

response.setHeader("refresh", "0;url=user_login.jsp");

}

}

%>

</body>

</html>

3、loginSucces.jsp文件

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>

</head>

<body>

<hr size="10" width="26%" align="left" color="green">

<font size="6" color="red" >登錄成功 </font>

<hr size="10" width="26%" align="left" color="green">

</body>

</html>

4、user_login.jsp文件

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>登錄界面</title>

</head>

<body background="C:Userswin8workspaceLoginimage\_10.jpg" >

<center>

<br><br><br><br><br><br>

<h1 style="color:yellow">Login</h1>

<br>

<form name="loginForm" action="login_check.jsp" method="post">

<table Border="0" >

<tr >

<td>賬號</td>

<td><input type="text" name="username"></td>

</tr>

<tr>

<td>密碼</td>

<td><input type="password" name="password">

</td>

</tr>

</table>

<br>

<input type="submit" value="登錄" style="color:#BC8F8F">

</form>

</center>

</body>

</html>