源代码界面
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>