用Java做的登录界面怎么跳转到不同用户的界面
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用Java做的登录界面怎么跳转到不同用户的界面相关的知识,希望对你有一定的参考价值。
用JRadioButton选择管理员,学生,教师,连接数据库点击登陆进入界面
我要详细代码
如果只是局部的几个JPanel更新直接在监听事件里面写。
如果2个界面风格完全不一样,建议直接切换到另一个界面追问
单做登陆界面可以实现,加了JRadioButton过后怎么写权限登陆,界面风格都不同
参考技术B 点击后本页面隐藏或销毁,new 下一个窗口 参考技术C 用if判断筛选出来的条件来区分啊 跳到不同界面追问我想知道选择JRadioButton后点击登陆的代码
追答我怎么知道你要怎么实现 new 不同的window show就好了
怎么用eclipse做一个界面点击按钮就可以跳转到另一个界面的代码
1、打开eclipse软件。
2、建立一个java工程。菜单栏中依次点击“file”-“new”-“java project”;然后,在工程列表中选中工程单击鼠标右键,选中“new”-“class”,在配置自己的类。
3、添加属性,载入属性代码。
private JPanel jp=new JPanel();
private JButton[] jbArray=new JButton[]new JButton("前移动"),
new JButton("后移动"),new JButton("第一个"),
new JButton("最后个"),new JButton("第三个")。
4、.建立卡片类,代码如下:
class MyCard extends JPanel
int index;
public MyCard(int index)
this.index=index+1;
public void paint(Graphics g)
g.clearRect(0, 0, 250, 250);
g.drawString("这是Card"+index, 100, 100)。
5、运行程序点击编译并运行按钮。
6、安最后一个的按钮后,即可出现效果。
参考技术A //一个界面跳到一个另一个界面,关闭一个界面,打开一个新的界面 *********************************************//************************************************************************************************************************
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Fre
static JFrame frame = new JFrame();
public static void main(String[] args)
//窗体大小
frame.setSize(200,200);
//按钮
JButton button =new JButton("点击我");
//在窗体上添加按钮
frame.add(button);
//显示窗体
frame.setVisible(true);
//添加点击事件监听器(你可以使用任何其他监听,看你想在什么情况下创建新的窗口了)
button.addActionListener(new ActionListener()
//单击按钮执行的方法
public void actionPerformed(ActionEvent e)
closeThis();
//创建新的窗口
JFrame frame = new JFrame("新窗口");
//设置在屏幕的位置
frame.setLocation(100,50);
// 窗体大小
frame.setSize(200,200);
// 显示窗体
frame.setVisible(true);
);
public static void closeThis()
frame.dispose();
参考技术B public void actionPerformed(ActionEvent e)
if(e.getSource() == button)
//或者e.getActionCommand().equals("确定')
Login window = new Login();
window.frame.setVisible(true);
这样就可以了。但是要在Login类中定义一个全局变量frame,即:private JFrame frame,并且记得初始化,frame =new JFrame();本回答被提问者采纳 参考技术C
final Button bt2=(Button) findViewById(R.id.要跳转的按键名称);
bt2.setOnClickListener(new OnClickListener()
public void onClick(View arg0)
Intent ss=new Intent();
ss.setClass(现在所在的界面名称.this,跳转过去界面的名称.class);
现在所在的界面名称.this.startActivity(ss);
);
参考技术D public void click0(View v){Intent intent=new Intent(界面.this,另一界面.class)startactivity(Intent)};
以上是关于用Java做的登录界面怎么跳转到不同用户的界面的主要内容,如果未能解决你的问题,请参考以下文章