精华内容
下载资源
问答
  • Java初学者,制作的第一个又背景图片的页面,虽然有点丑。。1.在JAVA文件中创建一个Folder(文件夹),把准备好的图片复制粘贴进去,在出现如下图片时点击ok,最好把图片名字修改的简单一点。2.窗口布局为分层网格。3....

    Java初学者,制作的第一个又背景图片的页面,虽然有点丑。。

    1.在JAVA文件中创建一个Folder(文件夹),把准备好的图片复制粘贴进去,在出现如下图片时点击ok,最好把图片名字修改的简单一点。

    d0b96ecc03d77368819867ec2a2a4d3a.png

    2.窗口布局为分层网格。

    3.创建一个标签(JLabel),把图片放入标签中。

    4.设置按钮等组件透明。

    5.把标签放入分层网格的最底层。

    package Quck_1;

    import java.awt.FlowLayout;

    import javax.swing.ImageIcon;

    import javax.swing.JButton;

    import javax.swing.JFrame;

    import javax.swing.JLabel;

    import javax.swing.JLayeredPane;

    import javax.swing.JPanel;

    import javax.swing.JTextField;

    public class UIinterface extends JFrame{

    JLayeredPane pane = new JLayeredPane(); // 分层网格

    JLabel label;

    JPanel panel1 = new JPanel();

    JTextField field1 = new JTextField();

    //JTextField field2 = new JTextField();

    JButton Land = new JButton("登陆");

    //JButton register = new JButton("注册");

    ImageIcon image;

    public UIinterface() {

    image = new ImageIcon("jpp/蜘蛛侠.jpg");

    //设置组件透明

    Land.setOpaque(false);

    label = new JLabel(image);//把背景图片添加到标签里

    panel1.setBounds(0, 0, image.getIconWidth(), image.getIconHeight()); //把标签设置为和图片等高等宽

    panel1 = (JPanel)this.getContentPane(); //把我的面板设置为内容面板

    panel1.add(label);

    Land.setBounds(100, 100, 100, 50);

    pane.add(panel1,JLayeredPane.DEFAULT_LAYER);

    pane.add(Land, JLayeredPane.MODAL_LAYER);

    this.setTitle("QQ");

    this.setBounds(100,100,image.getIconWidth(), image.getIconHeight());

    this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.setLayeredPane(pane);

    this.setVisible(true);

    }

    }

    图片演示如下

    8eae505666f484bdba0443bd5cc83c42.png

    展开全文
  • package ...import java.awt.Graphics;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import javax.swing.ImageIcon;import javax.swing....

    225648_mO8E_96257.jpg

    package com.ycty.totlosystem.gui.test;

    import java.awt.Graphics;

    import java.awt.GridBagConstraints;

    import java.awt.GridBagLayout;

    import java.awt.Insets;

    import javax.swing.ImageIcon;

    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 LoginJFrameTest {

    private JFrame jframe;

    private JLabel jlabel,jlabel1;

    private GridBagLayout gridbag;

    private GridBagConstraints constraints;

    private JTextField jtfield1;

    private JPasswordField jpfield1;

    private JButton jbutton1,jbutton2,jbutton3;

    private JPanel jpanel;

    public LoginJFrameTest(){

    jframe = new JFrame();

    jlabel = new JLabel();

    jlabel1 = new JLabel();

    jtfield1 = new JTextField();

    jpfield1 = new JPasswordField();

    gridbag = new GridBagLayout();

    jbutton1 = new JButton();

    jbutton2 = new JButton();

    jbutton3 = new JButton();

    init();

    }

    /**

    * init()初始化并显示界面

    */

    private void init(){

    jframe.setTitle("全屏幕测试");

    jpanel = new JPanel(){

    @Override

    protected void paintComponent(Graphics g) {

    super.paintComponent(g);

    ImageIcon img = new ImageIcon(ImgJframeTest.class.getResource("\\img\\2.jpg"));

    img.paintIcon(this, g, 0, 0);

    }

    };

    jlabel.setText("用户名:");

    jlabel1.setText("密    码:");

    jbutton1.setText("登    录");

    jbutton2.setText("退    出");

    jbutton3.setText("更改密码");

    //设置JFrame为全屏

    jframe.setUndecorated(true);

    jframe.getGraphicsConfiguration().getDevice().setFullScreenWindow(jframe);

    //设置JPanel为透明,且使用GridBagLayout布局管理器

    jpanel.setOpaque(true);

    jpanel.setLayout(gridbag);

    //用户名文本框显示

    constraints = getGridBagConstraints(0,0,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),0,0);

    gridbag.setConstraints(jlabel, constraints);

    jpanel.add(jlabel);

    //用户名输入框显示

    constraints = getGridBagConstraints(1,0,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),100,0);

    gridbag.setConstraints(jtfield1, constraints);

    jpanel.add(jtfield1);

    //密码文本框显示

    constraints = getGridBagConstraints(0,1,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),0,0);

    gridbag.setConstraints(jlabel1, constraints);

    jpanel.add(jlabel1);

    //密码输入框显示

    constraints = getGridBagConstraints(1,1,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),100,0);

    gridbag.setConstraints(jpfield1, constraints);

    jpanel.add(jpfield1);

    //更改密码按钮显示

    constraints = getGridBagConstraints(0,2,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),0,0);

    gridbag.setConstraints(jbutton3, constraints);

    jpanel.add(jbutton3);

    //登录按钮显示

    constraints = getGridBagConstraints(1,2,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),0,0);

    gridbag.setConstraints(jbutton1, constraints);

    jpanel.add(jbutton1);

    //退出按钮显示

    constraints = getGridBagConstraints(2,2,1,1,0,0,GridBagConstraints.CENTER,

    GridBagConstraints.NONE,new Insets(10,0,10,0),0,0);

    gridbag.setConstraints(jbutton2, constraints);

    jpanel.add(jbutton2);

    jframe.add(jpanel);

    }

    private static GridBagConstraints getGridBagConstraints(int gridx,int gridy,int gridwidth,

    int gridheight,double weightx,double weighty,int anchor,int fill,Insets insets,

    int ipadx,int ipady){

    return new GridBagConstraints(gridx, gridy, gridwidth, gridheight, weightx, weighty,

    anchor, fill, insets, ipadx, ipady);

    }

    public void showMe(){

    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    jframe.setVisible(true);

    }

    public static void main(String[] args) {

    new LoginJFrameTest().showMe();

    }

    }

    展开全文
  • importjava.awt.Graphics2D;importjava.awt.Image;importjava.awt.image.BufferedImage;importjava.io.ByteArrayOutputStream;importjava.io.File;importjava.io.FileInputStream;importjava.io.IOException;importj...

    importjava.awt.Graphics2D;importjava.awt.Image;importjava.awt.image.BufferedImage;importjava.io.ByteArrayOutputStream;importjava.io.File;importjava.io.FileInputStream;importjava.io.IOException;importjava.io.InputStream;importjavax.imageio.ImageIO;importjavax.swing.ImageIcon;public classWhiteToTransparent {public static voidmain(String[] args) {

    System.out.println(transferAlpha2File("d:/test.jpg", "d:/test_1.jpg"));

    }public static booleantransferAlpha2File(String imgSrc, String imgTarget) {

    File file= newFile(imgSrc);

    InputStream is= null;boolean result = false;try{

    is= newFileInputStream(file);//如果是MultipartFile类型,那么自身也有转换成流的方法:is = file.getInputStream();

    BufferedImage bi =ImageIO.read(is);

    Image image=(Image) bi;

    ImageIcon imageIcon= newImageIcon(image);

    BufferedImage bufferedImage= newBufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(),

    BufferedImage.TYPE_4BYTE_ABGR);

    Graphics2D g2D=(Graphics2D) bufferedImage.getGraphics();

    g2D.drawImage(imageIcon.getImage(),0, 0, imageIcon.getImageObserver());int alpha = 0;for (int j1 = bufferedImage.getMinY(); j1 < bufferedImage.getHeight(); j1++) {for (int j2 = bufferedImage.getMinX(); j2 < bufferedImage.getWidth(); j2++) {int rgb =bufferedImage.getRGB(j2, j1);int R = (rgb & 0xff0000) >> 16;int G = (rgb & 0xff00) >> 8;int B = (rgb & 0xff);if (((255 - R) < 30) && ((255 - G) < 30) && ((255 - B) < 30)) {

    rgb= ((alpha + 1) << 24) | (rgb & 0x00ffffff);

    }

    bufferedImage.setRGB(j2, j1, rgb);

    }

    }

    g2D.drawImage(bufferedImage,0, 0, imageIcon.getImageObserver());

    result= ImageIO.write(bufferedImage, "jpg", new File(imgTarget));//直接输出文件

    } catch(Exception e) {

    e.printStackTrace();

    result= false;

    }finally{if (is != null) {try{

    is.close();

    }catch(IOException e) {//TODO Auto-generated catch block

    }

    }

    }returnresult;

    }public static byte[] transferAlpha2Byte(String imgSrc) {

    ByteArrayOutputStream byteArrayOutputStream= null;

    File file= newFile(imgSrc);

    InputStream is= null;byte[] result = null;try{

    is= newFileInputStream(file);//如果是MultipartFile类型,那么自身也有转换成流的方法:is = file.getInputStream();

    BufferedImage bi =ImageIO.read(is);

    Image image=(Image) bi;

    ImageIcon imageIcon= newImageIcon(image);

    BufferedImage bufferedImage= newBufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(),

    BufferedImage.TYPE_4BYTE_ABGR);

    Graphics2D g2D=(Graphics2D) bufferedImage.getGraphics();

    g2D.drawImage(imageIcon.getImage(),0, 0, imageIcon.getImageObserver());int alpha = 0;for (int j1 = bufferedImage.getMinY(); j1 < bufferedImage.getHeight(); j1++) {for (int j2 = bufferedImage.getMinX(); j2 < bufferedImage.getWidth(); j2++) {int rgb =bufferedImage.getRGB(j2, j1);int R = (rgb & 0xff0000) >> 16;int G = (rgb & 0xff00) >> 8;int B = (rgb & 0xff);if (((255 - R) < 30) && ((255 - G) < 30) && ((255 - B) < 30)) {

    rgb= ((alpha + 1) << 24) | (rgb & 0x00ffffff);

    }

    bufferedImage.setRGB(j2, j1, rgb);

    }

    }

    g2D.drawImage(bufferedImage,0, 0, imageIcon.getImageObserver());

    byteArrayOutputStream= newByteArrayOutputStream();

    ImageIO.write(bufferedImage,"jpg", byteArrayOutputStream);//转换成byte数组

    result =byteArrayOutputStream.toByteArray();

    }catch(Exception e) {

    e.printStackTrace();

    }finally{if (is != null) {try{

    is.close();

    }catch(IOException e) {//TODO Auto-generated catch block

    }

    }if (byteArrayOutputStream != null) {try{

    byteArrayOutputStream.close();

    }catch(IOException e) {//TODO Auto-generated catch block

    }

    }

    }returnresult;

    }

    }

    展开全文
  • 先看一下简单的界面: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Image; import java.awt....

    先看一下简单的界面:



    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.ImageObserver;
    import java.awt.image.ImageProducer;
    
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.WindowConstants;
    
    public class test extends JFrame{
    	public test(){
    		super("Login");
    		Container con = getContentPane();
    		ImageIcon img = new ImageIcon("ii.jpg");
    		JLabel jll = new JLabel(img);
    		jll.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
    		this.getLayeredPane().add(jll,new Integer(Integer.MIN_VALUE));
    		((JPanel)con).setOpaque(false);///
    		
    		JPanel jp_up = new JPanel();
    		jp_up.setOpaque(false);
    		jp_up.setLayout(new FlowLayout(FlowLayout.CENTER));
    		JLabel jl_user = new JLabel("用户名:");
    		jl_user.setForeground(Color.yellow);
    		final JTextField jt_user = new JTextField("",20);
    		jt_user.setForeground(Color.BLUE);
    		jp_up.add(jl_user);
    		jp_up.add(jt_user);
    		con.add(jp_up,BorderLayout.NORTH);
    		
    		JPanel jp_down = new JPanel();
    		jp_down.setOpaque(false);
    		jp_down.setLayout(new FlowLayout(FlowLayout.CENTER));
    		JLabel jl_pass = new JLabel("密    码:");
    		jl_pass.setForeground(Color.yellow);
    		final JPasswordField jt_pass = new JPasswordField("",20);
    		jt_pass.setForeground(Color.BLUE);
    		jp_down.add(jl_pass);
    		jp_down.add(jt_pass);
    		con.add(jp_down,BorderLayout.CENTER);
    		
    		JPanel jp_button = new JPanel();
    		jp_button.setOpaque(false);///
    		JButton jb_login = new JButton("login");
    		JButton jb_reset = new JButton("reset");
    		jp_button.setLayout(new FlowLayout(FlowLayout.CENTER));
    		jp_button.add(jb_login);
    		jp_button.add(jb_reset);
    		con.add(jp_button,BorderLayout.SOUTH);
    		
    		jb_login.addActionListener(new ActionListener() {
    			
    			@Override
    			public void actionPerformed(ActionEvent arg0) {
    				// TODO Auto-generated method stub
    				if(jt_user.getText().equals("newnix") && jt_pass.getText().equals("xinwen")){
    					JOptionPane.showMessageDialog(new JFrame(), "nihao");
    				}else{
    					JOptionPane.showMessageDialog(new JFrame(), "no");
    				}
    			}
    		});
    		
            jb_reset.addActionListener(new ActionListener() {
    			
    			@Override
    			public void actionPerformed(ActionEvent arg0) {
    				// TODO Auto-generated method stub
    				jt_user.setText("");
    				jt_pass.setText("");
    			}
    		});
    
    		setVisible(true);
    		setSize(img.getIconWidth(),img.getIconHeight());
    		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    	}
    	
    	public static void main(String[] agrs){
    		new test();
    	}
    }

    我把用户名和输入框作为一个panel,密码和输入框也是一个面板,按钮也是一个面板,最后加入到container容器里,用边界布局

    所谓的用图片设置为背景的原理就是:

    首先需要了解一下面板有好几层,最底层的面板是JRootPanel,包含GlassPanel,  LayeredPanel   , LayeredPanel  又包含ContentPanel,  JMenuBar

    所以我们平时做的都只是在contentPanel操作的,我们把图片add到 LayeredPanel 上,再把ContentPanel设置为透明,如果又在ContentPanel上添加了其他panel,那么还需要把其他panel也要设置为透明。。。就是代码中标注有/的地方




    import java.awt.BorderLayout;
    
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.GridLayout;
    import java.awt.Point;
    import java.awt.Window;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowEvent;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.io.Writer;
    import java.net.DatagramPacket;
    import java.net.DatagramSocket;
    import java.net.InetAddress;
    import java.net.MalformedURLException;
    import java.net.MulticastSocket;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.net.SocketException;
    import java.net.SocketTimeoutException;
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.UnknownHostException;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.Random;
    
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JProgressBar;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingConstants;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    
    import java.sql.*;
    
    public class test extends JFrame{
    	private JTextField jt_user = new JTextField("",20);
    	private JPasswordField jt_pass = new JPasswordField("",20);
    	private boolean flag = false;
    	JButton jb_s = new JButton("Login");
    	JButton jb_e = new JButton("Register");
    	private Connection conn;
    	
    	public test(){
    		init();
    		
    		try {
    			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    			String url = "jdbc:sqlserver://127.0.0.1:11588;DatabaseName=test728";
    			String user = "sa";
    			String password = "123456";
    			conn =  DriverManager.getConnection(url,user,password);
    		} catch (Exception e) {
    			// TODO: handle exception
    		}
    		
    		jb_s.addActionListener(new ActionListener() {
    			  
    			@Override
    			public void actionPerformed(ActionEvent arg0) {
    				// TODO Auto-generated method stub
    				String user = jt_user.getText();
    				String pass = jt_pass.getText();
    				try {
    					Statement sta = conn.createStatement();
    					ResultSet set = sta.executeQuery("select *from dbo.StuInfo");
    					while(set.next()){
    						if(set.getString("username").equals(user)){
    							if(set.getString("password").equals(pass)){
    								flag = true;
    								break;
    							}
    						}
    					}
    					
    				if(flag == true){
    					JOptionPane.showMessageDialog(null, "欢迎");
    					flag = false;
    				}else{
    					JOptionPane.showMessageDialog(null, "用户名或密码错误");
    				}
    				} catch (SQLException e) {
    					// TODO Auto-generated catch block
    					e.printStackTrace();
    				}
    			}
    		});
    		
            jb_e.addActionListener(new ActionListener() {
    			
    			@Override
    			public void actionPerformed(ActionEvent arg0) {
    				// TODO Auto-generated method stub
    				new dialogReg("注册页面");
    			}
    		});
    	}
    	
    	public void init(){
    		setTitle("Login");
    		setLocationRelativeTo(null);
    		Container con = getContentPane();
    		
    		JPanel jp = new JPanel();
    		JPanel jp_up = new JPanel();
    		JPanel jp_down = new JPanel();
    		jp_up.setLayout(new FlowLayout());
    		jp_down.setLayout(new FlowLayout());
    		jp.setLayout(new FlowLayout());
    		
    		jb_s.setBackground(Color.GREEN);
    		jb_e.setBackground(Color.RED);
    		jp_up.add(new JLabel("用户名 :"));
    		jp_up.add(jt_user);
    		jp_down.add(new JLabel("密    码  :"));
    		jp_down.add(jt_pass);
    		jp.add(jb_s);
    		jp.add(jb_e);
    		jt_pass.setSize(20, 1);
    		con.add(jp_up,"North");
    		con.add(jp_down,"Center");
    		con.add(jp,"South");
    		
    		setVisible(true);
    		setSize(300,300);
    		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    	}
    	
    	public class dialogReg extends JFrame{
    		Container con = getContentPane();
    		JPanel jp1 = new JPanel();
    		JPanel jp2 = new JPanel();
    		JPanel jp_up = new JPanel();
    		JPanel jp_down = new JPanel();
    		JPanel jp_downdown = new JPanel();
    		JButton jb_sure = new JButton("确定");
    		JButton jb_reset = new JButton("重置");
    		JTextField dia_user = new JTextField("",20);
    		JPasswordField dia_pass = new JPasswordField("",20);
    		JPasswordField dia_passpass = new JPasswordField("",20);
    		String user;
    		String pass;
    		String passpass;
    		
    		public dialogReg(String s){
    			setLocationRelativeTo(null);
    			setBounds(500, 500, 400, 300);
    			
    			jp_up.setLayout(new FlowLayout());
    			jp_down.setLayout(new FlowLayout());
    			jp_downdown.setLayout(new FlowLayout());
    			jp2.setLayout(new FlowLayout());
    			jp1.setLayout(new GridLayout(3, 1));
    			
    			jb_sure.setBackground(Color.GREEN);
    			jb_reset.setBackground(Color.RED);
    			jp_up.add(new JLabel("用户名 :"));
    			jp_up.add(dia_user);
    			jp_down.add(new JLabel("密    码  : "));
    			jp_down.add(dia_pass);
    			jp_downdown.add(new JLabel("确认密 码  : "));
    			jp_downdown.add(dia_passpass);
    			
    			jp2.add(jb_sure);
    			jp2.add(jb_reset);
    			
    			jp1.add(jp_up);
    			jp1.add(jp_down);
    			jp1.add(jp_downdown);
    			
    			con.add(jp1,"North");
    			con.add(jp2,"South");
    			
    			fun();
    			
    			setTitle(s);
    			setVisible(true);
    			//setSize(300,300);
    		}
    		
    		public void fun(){
    			jb_sure.addActionListener(new ActionListener() {
    				@Override
    				public void actionPerformed(ActionEvent arg0) {
    					user = dia_user.getText().trim();
    					pass = dia_pass.getText();
    					passpass = dia_passpass.getText();
    					// TODO Auto-generated method stub
    					if(user.equals("") || pass.equals("") || passpass.equals("")){
    						JOptionPane.showMessageDialog(null, "用户名或者密码不能为空");
    						return ;
    					}
    					
    					if(!pass.equals(passpass)){
    						JOptionPane.showMessageDialog(null, "密码不一致,请重新输入");
    						dia_pass.setText("");
    						dia_passpass.setText("");
    						return ;
    					}
    					
    					try {
    						String sql = "insert into dbo.StuInfo (username,password) values(?,?)";
    						PreparedStatement sta = conn.prepareStatement(sql);
    						sta.setString(1, user);
    						sta.setString(2, pass);
    						sta.executeUpdate();
    					} catch (SQLException e) {
    						// TODO Auto-generated catch block
    						e.printStackTrace();
    					}
    					
    					JOptionPane.showMessageDialog(null, "注册成功");
    					dispose();
    				}
    			});
    			
    			jb_reset.addActionListener(new ActionListener() {
    				
    				@Override
    				public void actionPerformed(ActionEvent arg0) {
    					// TODO Auto-generated method stub
    					dia_user.setText("");
    					dia_pass.setText("");
    					dia_passpass.setText("");
    				}
    			});
    		}
    	}
    
    	public static void main(String[] agrs){
    		new test();
    	}
    }






    展开全文
  • 要山寨出QQ登陆界面,首先要对java的图形界面有一定的了解。在jdk1.4之前,图形界面所用到的所有类和接口都在javax.awt之下,在其之后就都在javax.swing里了。 关于图形界面的开发其实就类似于搭积木的过程,我们把...
  • 关于Java中如何窗口中添加背景图片

    千次阅读 2019-12-11 20:44:03
    关于Java中如何窗口中添加背景图片 ** ImageIcon img = new ImageIcon("E:\\1.jpg"); JLabel jl_bg = new JLabel(img); //背景 jl_bg.setBounds(0, 0, 500, 350); //设置位置和大小,先setLayout(null)一下。...
  • Java设计登录界面

    万次阅读 多人点赞 2017-01-15 23:31:27
    使用Java设计客户端登录界面 一、开发环境 二、Java Swing库 具体设计实现过程
  • Java图书管理系统登陆界面

    千次阅读 多人点赞 2019-07-17 10:47:57
    界面效果: 实现代码: package menu; import java.awt.Dimension; import java.awt.Font; import java.awt.Image; import java.awt.Toolkit; import javax.swing.Icon; import javax.swing.ImageIcon; ...
  • Java简单飞机大战(1)

    2021-03-12 10:45:00
    在这个游戏里有登陆界面,子弹,我方飞机,敌机,还有背景图片。我想着先应该将子弹,我方飞机,敌军飞机分别写三个类,因为子弹和敌军飞机会不断出现,所以使用数组队列来存储他们的对象。开始游戏后...
  • import java.awt.Image; import java.awt.Rectangle; import java.awt.TextArea; import java.awt.Toolkit; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.*; imp
  • 需求分析 小红书登陆页面背景图滚动效果 需求特点:背景无限循环滚动 登陆页面布局分析 功能分析 通过 uiautomatorviewer 分析页面布局,其应是通过自定义 FrameLayout 实现 通过清除 App 数据同时断开数据连接再...
  • 需要预先准备没有背景图的Swing GUI登录界面 可以参考 在IntelliJ IDEA中放弃GUI Form使用JFormDesigner6.0.2设计Swing登录界面 Swing登录功能(一)在Eclipse中使用WindowBuilder拖拽出一个登录界面.ch001 ...
  • Java实现简单的GUI登录和注册界面

    万次阅读 多人点赞 2020-06-12 18:43:16
    登陆界面: 注册界面: 实现代码如下: 一、登陆界面: package cn.bms.view; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt....
  • 简单又美观的登录界面

    千次阅读 2021-03-08 07:52:04
    李春波 - 岁月(管弦乐版)04:13来自浪潮之巅的小萝卜头登录界面效果:是不是简洁又美观呢,其实前端代码实现比较的容易,后端代码的实现有一定的难度哦~涉及到验证码的实现,用户名和密码的校验等等。实现步骤:1....
  • JavaWeb登陆界面

    2021-08-04 09:05:55
    JavaWeb登陆界面实现 样式实例 Semantic UI 中文文档链接 Semantic UI中文文档链接 代码实现 <body> <div class="ui center aligned container"> <h2 class="ui teal header item" ...
  • Java实现简单的QQ登录界面

    万次阅读 多人点赞 2019-04-30 20:49:37
    学习了Java的GUI后,尝试着做了一个仿QQ登录界面,感觉还行,简单地实现了自动登录,记住密码,以及连接数据库判断账号密码的功能。 运行效果: package a; import java.awt.BorderLayout; import java.awt.Color;...
  • 视频 html+css实现漂亮的透明登录页面,HTML炫酷登录页面 视频录的比较急,视频的最后背景圆样式那里少加了一个border-radius: 50%;,导致没有变成圆形,而是正方形,在下面的代码中已更正。 HTML 登录:微信公众号...
  • 项目实战篇:用Java Swing写一个登录界面

    千次阅读 多人点赞 2020-04-01 15:24:41
    要实现这样一个界面就需要用到Java Swing相关代码: 首先我们在eclipse中创建一个Java项目,在这个项目下创建包还有相关的类 我们的项目一共分为四个java文件: Create_GUI.java(代码) import javax.swing.JFrame; ...
  • Java实现登录界面的验证码

    千次阅读 2017-06-09 17:41:45
    首先我们创建一个GetRandImage类用来获取随机验证码和图片 ...import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Image; import java.aw
  • Java登录界面

    2020-02-15 12:09:20
    import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.Point; impo...
  • //设置透明以使底层背景图片显示 150 cp.setLayout(null); 151 152 JLabel imgLable=new JLabel(); 153 JLabel j2=new JLabel("***欢迎登陆学生管理系统***"); 154 JLabel j1=new JLabel("~~请在左侧选择所做的操作...
  • Initialize()方法中进行的是整个登陆界面的控件摆放,包括输入账号、密码的输入框、登录按钮、注册按钮以及一个出于美观考虑的Logo,除此之外,Initialize()方法中还完成了各种控件和事件监听器的绑定。最后的GUI如...
  • 首先我们先看一下预览效果:要实现这样一个界面就需要用到Java Swing相关代码:首先我们在eclipse中创建一个Java项目,在这个项目下创建包还有相关的类我们的项目一共分为四个java文件:Create_GUI.java(代码)import...
  • 现在把用Java实现这个功能的代码和思想写一下。1.前端JSP页面效果及代码:1.1效果 1.2前端表单代码用户名:密码:${error_msg }2.后台java代码:2.1IndexServlet里的Login方法代码:public void Login...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,911
精华内容 764
关键字:

java登录界面背景图透明

java 订阅