网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

java计算机页面代码,java编程网页

JAVA中打开新页面代码

/**

专注于为中小企业提供网站设计制作、成都网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业上海免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

* 打开打印窗口

* url:链接页面或action动作

* Banglu

*/

function printWindow(url){

var sURL = url;

var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "

+ "location=no, status=no, titlebar=no, width=800, height=600, top=100, left=100";

window.open(sURL,'notoolbar',sFeatures);

}function exportWindow(url){

var sURL = url;

var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "

+ "location=no, status=no, titlebar=no, width=800, height=600, top=50, left=50";

var objwin=window.open(sURL,'export'+randomNum(),sFeatures);

objwin.close();

}

/**

* 打开模态窗口

* url:链接页面或action动作

* width:打开模态窗口的宽度

* height:打开模态窗口的高度

* 注意:打开模态窗口的页面中要在head后面加上

* meta http-equiv="Pragma" content="no-cache":禁止模态窗口缓存

* base target="_self"/:模态窗口中的表单在本窗口中提交

* a onClick='window.location = "view-source:" + window.location.href'b源文件/b/a 可以查看模态窗口的源文件

* Banglu

*/

function modalWindow(url, width, height){

var sURL = url;

var sFeatures = "dialogWidth:" + width + "px; dialogHeight:" + height + "px; "

+ "help:no; scroll:yes; center:yes; status:no;resizable:yes";

window.showModalDialog(sURL, window, sFeatures);

}/**

* 打开普通窗口

* url:链接页面或action动作

* width:宽度

* height:高度

* Banglu

*/

function openWindow(url, width, height){

var sURL=url;

var sFeatures = "scrollbars=yes, status=yes, resizable=yes,"

+ "toolbar=yes, menubar=yes, location=yes, titlebar=yes"

if(width!=null){

sFeatures+=", width="+width;

}

if(height!=null){

sFeatures+=", height="+height;

}

window.open(sURL, 'open'+randomNum(), sFeatures);

}/**

* 打开窗口

* url:链接页面或action动作

* width:宽度

* height:高度

Banglu

*/

function openNoBarWindow(url, width, height){

var sURL=url;

var sFeatures = "scrollbars=no, status=no, resizable=no,"

+ "toolbar=no, menubar=no, location=no, titlebar=no"

if(width!=null){

sFeatures+=", width="+width;

sFeatures+=", left="+(screen.width-width)/2;

}

if(height!=null){

sFeatures+=", height="+height;

sFeatures+=", top="+(screen.height-height-100)/2;

}

window.open(sURL, 'openNoBar'+randomNum(), sFeatures);

}

/**

* 打开全屏窗口

* url:链接页面或action动作

* Banglu

*/

function openFullWindow(url){

var sURL=url;

var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "

+ "location=no, status=no, titlebar=no, width="+(screen.width-10)+", "

+ "height="+(screen.height-60)+", top=0, left=0";

window.open(sURL, 'full'+randomNum(), sFeatures);

}/**

* 打开主窗口

* url:链接页面或action动作

* Banglu

*/

function openMainWindow(url){

var sURL=url;

var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "

+ "location=no, status=no,titlebar=no, width="+(screen.width-10)+", "

+ "height="+(screen.height-60)+", top=0, left=0";

window.open(sURL, 'main', sFeatures);

}

/**

* 设置链接

* url:连接的jsp页面或action动作

* Banglu

*/

function link(url, frameID){

if(frameID==null){

window.location.href = url;

}

else{

window.frames[frameID].location = url

}

}/**

* 回车代替tab

* Banglu

*/

function handleKey(){

var gk = window.event.keyCode;

if (gk==13) {

if(window.event.srcElement.tagName!='TEXTAREA'){

window.event.keyCode=9;

return;

}

}

}/**

* 全屏显示

* Banglu

*/

function fullScreen(){

window.dialogHeight=window.screen.availHeight;

window.dialogWidth=window.screen.availWidth;

}

function Resize_dialog(t,l,w,h) {

window.dialogTop = t+"px";

window.dialogLeft = l+"px";

window.dialogHeight = h+"px";

window.dialogWidth = w+"px";

}

用java做好的登陆界面,当登陆成功后跳转到下个页面的代码是什么?

用java做好的登陆界面,当登陆成功后跳转到下个页面的代码如下:

如果登陆验证是在jsp中,那么跳转可以写成

1.response.sendRedirct("跳转到页面");

2.jsp:forward page="跳转页面"/

3.response.setHeader("Location","");

如果是登陆验证是在servlet中,那么中转可以写成

1.response.sendRedirect("/a.jsp");

2.RequestDispatcher dispatcher = request.getRequestDispatcher("/a.jsp");

dispatcher .forward(request, response);

也可以使用js代码实现:

script

function validate(){

window.location.href="/index.jsp";

}

/script

登陆界面的java代码怎么写?

概述

具体框架使用jframe,文本框组件:JTextField;密码框组件:JPasswordField;标签组件:JLabel;复选框组件:JCheckBox;单选框组件:JRadioButton;按钮组件JButton。

登录界面:

代码实例

import javax.swing.*;

import java.awt.*;   //导入必要的包

public class denglu extends JFrame{

JTextField jTextField ;//定义文本框组件

JPasswordField jPasswordField;//定义密码框组件

JLabel jLabel1,jLabel2;

JPanel jp1,jp2,jp3;

JButton jb1,jb2; //创建按钮

public denglu(){

jTextField = new JTextField(12);

jPasswordField = new JPasswordField(13);

jLabel1 = new JLabel("用户名");

jLabel2 = new JLabel("密码");

jb1 = new JButton("确认");

jb2 = new JButton("取消");

jp1 = new JPanel();

jp2 = new JPanel();

jp3 = new JPanel();

//设置布局

this.setLayout(new GridLayout(3,1));

jp1.add(jLabel1);

jp1.add(jTextField);//第一块面板添加用户名和文本框

jp2.add(jLabel2);

jp2.add(jPasswordField);//第二块面板添加密码和密码输入框

jp3.add(jb1);

jp3.add(jb2); //第三块面板添加确认和取消

//        jp3.setLayout(new FlowLayout());  //因为JPanel默认布局方式为FlowLayout,所以可以注销这段代码.

this.add(jp1);

this.add(jp2);

this.add(jp3);  //将三块面板添加到登陆框上面

//设置显示

this.setSize(300, 200);

//this.pack();

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

this.setVisible(true);

this.setTitle("登陆");

}

public static void main(String[] args){

new denglu();

}

}

拓展内容

java swing包

Swing 是一个为Java设计的GUI工具包。

Swing是JAVA基础类的一部分。

Swing包括了图形用户界面(GUI)器件如:文本框,按钮,分隔窗格和表。

Swing提供许多比AWT更好的屏幕显示元素。它们用纯Java写成,所以同Java本身一样可以跨平台运行,这一点不像AWT。它们是JFC的一部分。它们支持可更换的面板和主题(各种操作系统默认的特有主题),然而不是真的使用原生平台提供的设备,而是仅仅在表面上模仿它们。这意味着你可以在任意平台上使用JAVA支持的任意面板。轻量级组件的缺点则是执行速度较慢,优点就是可以在所有平台上采用统一的行为。

概念解析:

JFrame – java的GUI程序的基本思路是以JFrame为基础,它是屏幕上window的对象,能够最大化、最小化、关闭。

JPanel – Java图形用户界面(GUI)工具包swing中的面板容器类,包含在javax.swing 包中,可以进行嵌套,功能是对窗体中具有相同逻辑功能的组件进行组合,是一种轻量级容器,可以加入到JFrame窗体中。。

JLabel – JLabel 对象可以显示文本、图像或同时显示二者。可以通过设置垂直和水平对齐方式,指定标签显示区中标签内容在何处对齐。默认情况下,标签在其显示区内垂直居中对齐。默认情况下,只显示文本的标签是开始边对齐;而只显示图像的标签则水平居中对齐。

JTextField –一个轻量级组件,它允许编辑单行文本。

JPasswordField – 允许我们输入了一行字像输入框,但隐藏星号(*) 或点创建密码(密码)

JButton – JButton 类的实例。用于创建按钮类似实例中的 "Login"。

求JAVA简易计算机源代码

试试这个

import java.util.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.applet.*;

public class SZJSQ extends JApplet implements ActionListener

{

boolean i=true;

private JButton num0=new JButton("0");

private JButton num1=new JButton("1");

private JButton num2=new JButton("2");

private JButton num3=new JButton("3");

private JButton num4=new JButton("4");

private JButton num5=new JButton("5");

private JButton num6=new JButton("6");

private JButton num7=new JButton("7");

private JButton num8=new JButton("8");

private JButton num9=new JButton("9");

private JButton zuok=new JButton("(");

private JButton youk=new JButton(")");

private JButton dian=new JButton(".");

private JButton NULL=new JButton("N");

private JButton plu=new JButton("+");

private JButton min=new JButton("-");

private JButton mul=new JButton("x");

private JButton div=new JButton("/");

private JButton equ=new JButton("=");

private JButton cle=new JButton("C");//清除

private JTextField space=new JTextField(30);

public void init()

{

JPanel text=new JPanel();

text.setLayout(new FlowLayout());

text.add(space);

JPanel buttons=new JPanel();

buttons.setLayout(new GridLayout(5,4));

buttons.add(num9);

buttons.add(num8);

buttons.add(num7);

buttons.add(plu);

buttons.add(num6);

buttons.add(num5);

buttons.add(num4);

buttons.add(min);

buttons.add(num3);

buttons.add(num2);

buttons.add(num1);

buttons.add(mul);

buttons.add(num0);

buttons.add(cle);

buttons.add(equ);

buttons.add(div);

buttons.add(zuok);

buttons.add(youk);

buttons.add(dian);

buttons.add(NULL);

(num9).addActionListener(this);

(num8).addActionListener(this);

(num7).addActionListener(this);

(num6).addActionListener(this);

(num5).addActionListener(this);

(num4).addActionListener(this);

(num3).addActionListener(this);

(num2).addActionListener(this);

(num1).addActionListener(this);

(num0).addActionListener(this);

(plu).addActionListener(this);

(min).addActionListener(this);

(mul).addActionListener(this);

(div).addActionListener(this);

(equ).addActionListener(this);

(cle).addActionListener(this);

(zuok).addActionListener(this);

(youk).addActionListener(this);

(dian).addActionListener(this);

setLayout(new BorderLayout());

add("North",text);

add("South",buttons);

space.setText("0");

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==num9)

{

if(i==true)

{

space.setText("9");

i=false;

}

else space.setText(space.getText()+'9');

}

if(e.getSource()==num8)

{

if(i==true)

{

space.setText("8");

i=false;

}

else space.setText(space.getText()+'8');

}

if(e.getSource()==num7)

{

if(i==true)

{

space.setText("7");

i=false;

}

else space.setText(space.getText()+'7');

}

if(e.getSource()==num6)

{

if(i==true)

{

space.setText("6");

i=false;

}

else space.setText(space.getText()+'6');

}

if(e.getSource()==num5)

{

if(i==true)

{

space.setText("5");

i=false;

}

else space.setText(space.getText()+'5');

}

if(e.getSource()==num4)

{

if(i==true)

{

space.setText("4");

i=false;

}

else space.setText(space.getText()+'4');

}

if(e.getSource()==num3)

{

if(i==true)

{

space.setText("3");

i=false;

}

else space.setText(space.getText()+'3');

}

if(e.getSource()==num2)

{

if(i==true)

{

space.setText("2");

i=false;

}

else space.setText(space.getText()+'2');

}

if(e.getSource()==num1)

{

if(i==true)

{

space.setText("1");

i=false;

}

else space.setText(space.getText()+'1');

}

if(e.getSource()==num0)

{

if(i==true)

{

space.setText("0");

i=false;

}

else space.setText(space.getText()+'0');

}

if(e.getSource()==zuok)

{

if(i==true)

{

space.setText("(");

i=false;

}

else space.setText(space.getText()+'(');

} if(e.getSource()==youk)

{

if(i==false)

space.setText(space.getText()+')');

}

if(e.getSource()==dian)

{

if(i==false)

space.setText(space.getText()+'.');

}

if(e.getSource()==plu)

{

space.setText(space.getText()+'+');

i=false;

}

if(e.getSource()==min)

{

space.setText(space.getText()+'-');

i=false;

}

if(e.getSource()==mul)

{

space.setText(space.getText()+'*');

i=false;

}

if(e.getSource()==div)

{

space.setText(space.getText()+'/');

i=false;

}

if(e.getSource()==equ)

{

space.setText(String.valueOf(Calculator(space.getText())));

i=true;

}

if(e.getSource()==cle)

{

space.setText("0");

i=true;

}

}

public double Calculator(String f)//科学计算

{

int i=0,j=0,k;

char c;

StringBuffer s=new StringBuffer();

s.append(f);

s.append('=');

String formula=s.toString();

char[] anArray;

anArray=new char[50];

StackCharacter mystack=new StackCharacter();

while(formula.charAt(i)!='=')

{

c=formula.charAt(i);

switch(c)

{

case '(': mystack.push(new Character(c));

i++;

break;

case ')':

while(mystack.peek().charValue()!='(')

{

anArray[j++]=mystack.pop().charValue();

}

mystack.pop();

i++;

break;

case '+':

case '-':

while(!mystack.empty()mystack.peek().charValue()!='(')

{

anArray[j++]=mystack.pop().charValue();

}

mystack.push(new Character(c));

i++;

break;

case '*':

case '/':

while(!mystack.empty()(mystack.peek().charValue()=='*'||mystack.peek().charValue()=='/'))

{

anArray[j++]=mystack.pop().charValue();

}

mystack.push(new Character(c));

i++;

break;

case' ': i++;

break;

default: while((c='0'c='9')||c=='.')

{

anArray[j++]=c;

i++;

c=formula.charAt(i);

}

anArray[j++]='#';

break;

}

}

while(!(mystack.empty()))

anArray[j++]=mystack.pop().charValue();

i=0;

int count;

double a,b,d;

StackDouble mystack1 =new StackDouble();

while(ij)

{

c=anArray[i];

switch(c)

{

case '+':

a=mystack1.pop().doubleValue();

b=mystack1.pop().doubleValue();

d=b+a;

mystack1.push(new Double(d));

i++;

break;

case '-':

a=mystack1.pop().doubleValue();

b=mystack1.pop().doubleValue();

d=b-a;

mystack1.push(new Double(d));

i++;

break;

case '*':

a=mystack1.pop().doubleValue();

b=mystack1.pop().doubleValue();

d=b*a;

mystack1.push(new Double(d));

i++;

break;

case '/':

a=mystack1.pop().doubleValue();

b=mystack1.pop().doubleValue();

if(a!=0)

{

d=b/a;

mystack1.push(new Double(d));

i++;

}

else

{

System.out.println("Error!");

}

break;

default:

d=0;count=0;

while((c='0'c='9'))

{

d=10*d+c-'0';

i++;

c=anArray[i];

}

if(c=='.')

{

i++;

c=anArray[i];

while((c='0'c='9'))

{

count++;

d=d+(c-'0')/Math.pow(10,count);

i++;

c=anArray[i];

}

}

if(c=='#')

mystack1.push(new Double(d));

i++;

break;

}

}

return(mystack1.peek().doubleValue());

}

}


分享名称:java计算机页面代码,java编程网页
分享网址:http://bjjierui.cn/article/hoeiij.html

其他资讯