「font隶书java」css字体隶书
本篇文章给大家谈谈font隶书java,以及css字体隶书对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
用JAVA编写一个用户登陆界面,用户验证通过数据库实现
这是我以前写的系统登录框的login
package java1;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.Rectangle;
import java.awt.Font;
public class login extends JFrame
{
public login() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args)
{
login frm=new login();
frm.setBounds(300,200,300,260);
frm.setVisible(true);
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
jLabel1.setForeground(Color.red);
jLabel1.setText("用户名");
jLabel1.setBounds(new Rectangle(25, 72, 68, 29));
jButton2.setBounds(new Rectangle(142, 159, 81, 30));
jButton2.setText("取消");
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton2_actionPerformed(e);
}
});
jButton1.setBounds(new Rectangle(38, 159, 81, 29));
jButton1.setText("确定");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jTextField1.setBounds(new Rectangle(109, 79, 136, 23));
jPasswordField1.setBounds(new Rectangle(109, 115, 136, 23));
this.getContentPane().add(jLabel1);
jLabel3.setFont(new java.awt.Font("隶书", Font.PLAIN, 24));
jLabel3.setText("学 生 考 试 系 统");
jLabel3.setBounds(new Rectangle(22, 15, 268, 47));
this.getContentPane().add(jTextField1);
this.getContentPane().add(jLabel2);
this.getContentPane().add(jButton2);
this.getContentPane().add(jButton1);
this.getContentPane().add(jLabel3);
this.getContentPane().add(jPasswordField1);
jLabel2.setForeground(Color.red);
jLabel2.setText("密码");
jLabel2.setBounds(new Rectangle(26, 112, 68, 29));
}
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JLabel jLabel3 = new JLabel();
JPasswordField jPasswordField1 = new JPasswordField();
main2 wo=new main2();
int sum;
//判断权限的方法
public void success()
{
try{
ResultSet rs1;
String s1="select * from 管理权限 where name='"+jTextField1.getText()+"' and password='"+jPasswordField1.getText()+"'";
rs1=sqlcx.Rs_jiluji(s1);
rs1.first();
sum=Integer.parseInt((String)(rs1.getString(3)));
System.out.println(sum);
very();
}
catch(Exception c){System.out.println("success error");}
}
//根据权限设置窗口
public void very()
{
if (sum==1)
{JOptionPane.showOptionDialog(this, "您现在是以教师权限登陆", "登陆信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
else
{
JOptionPane.showOptionDialog(this, "你现在是以学生权限登陆", "登陆信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
wo.jButton2.setVisible(false);
wo.jButton3.setVisible(false);
wo.jButton4.setVisible(false);
wo.jButton5.setVisible(false);
wo.jButton6.setVisible(false);
wo.jButton7.setVisible(false);
wo.jButton8.setVisible(false);
wo.jMenu2.setVisible(false);
wo.jMenu3.setVisible(false);
wo.jMenu4.setVisible(false);
}
}
public void jButton1_actionPerformed(ActionEvent e)
{
//判断用户名是否为空
if (jTextField1.getText().length() == 0) {
JOptionPane.showOptionDialog(this, "用户名不能为空", "错误信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
//判断密码是否为空
else if (jPasswordField1.getText().length()==0)
{
JOptionPane.showOptionDialog(this,"密码不能为空", "错误信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
else
{
try
{
ResultSet rs;//声明记录集
String sql="select * from 管理权限 where name='"+jTextField1.getText()+"'";
rs = sqlcx.Rs_jiluji(sql);
if (rs.next())
{
if(jPasswordField1.getText().equals(rs.getString(2)))
{
success();
wo.setBounds(60,40,700,600);
wo.setVisible(true);
this.dispose();
}
else
{
JOptionPane.showOptionDialog(this,"密码错误", "错误信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
}
else
{
JOptionPane.showOptionDialog(this,"没有所要找的用户名", "错误信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
}
catch(Exception c){
JOptionPane.showOptionDialog(this,"连接数据库失败", "错误信息"
, JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
}
}
public void jButton2_actionPerformed(ActionEvent e) {
System.exit(0);
}
}
java 设置字体格式
Java Swing中可以给每个控件设置字体格式和其他属性的设置,示例如下:
submit= new JButton("登陆");
submit.setFont(new Font("宋体", Font.PLAIN, 16));
三个参数分别表示: 字体,样式(粗体,斜体等),字号
submit.setForeground(Color.RED);
这个表示给组件上的文字设置颜色Color.RED表示红色
当然你也可以自己给RGB的值 比如 submit.setForeground(new Color(215,215,200));
java 设置字体颜色
Font类...
在文本组件中 设置...
在JTextComponent中 有设置字体颜色等方法..
java字体设置?
字体 Font
setFont("隶书",Font.ITATIC,23)
意思就是("字体名字",字形(如,fond.bold),大小)
等等
Java 中类Font的构造函数的第一个参数有什么用?
去下载一个API就能查到了
"SansSerif"就是如下的第一个String型参数,就是定义个名称
Font
public Font(String name,
int style,
int size)根据指定名称、样式和点大小,创建一个新 Font。
字体名称可以是字体外观名称或字体系列名称。它与样式一起使用,以查找合适的字体外观。如果指定了字体系列名称,则使用样式参数从系列中选择最合适的外观。如果指定了字体外观名称,则合并外观的样式和样式参数,以便从同一个系列查找最匹配的字体。例如,如果指定外观名称 "Arial Bold" 及样式 Font.ITALIC,则字体系统在 "Arial" 系列中寻找既是粗体又是斜体的外观,可以将字体实例与物理字体外观 "Arial Bold Italic" 相关联。将样式参数与指定外观的样式合并,而不是执行添加或减去操作。这意味着,指定粗体外观和粗体样式并不会双倍加粗字体,而指定粗体外观和普通样式也不会变细字体。
如果无法找到所要求样式的外观,则字体系统可以应用样式设计算法来获得所需的样式。例如,如果要求 ITALIC,但是没有可用的斜体外观,则可以通过算法使普通外观倾斜。
字体名称查找是区分大小写的,可以使用 US 语言环境的大小写转换规则。
参数:
name - 字体名称。可以是字体外观名称或字体系列名称,并可表示此 GraphicsEnvironment 中找到的逻辑字体或物理字体。逻辑字体的系列名称有:Dialog、DialogInput、Monospaced、Serif 或 SansSerif。如果 name 为 null,则将新 Font 的 逻辑字体名称(由 getName() 返回)设置为 "Default"。
style - Font 的样式常量。样式参数是整数位掩码,可以为 PLAIN,或 BOLD 和 ITALIC 的按位或(例如,ITALIC 或 BOLD|ITALIC)。如果样式参数不符合任何一个期望的整数位掩码,则将样式设置为 PLAIN。
size - Font 的点大小
font隶书java的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于css字体隶书、font隶书java的信息别忘了在本站进行查找喔。
发布于:2022-11-29,除非注明,否则均为
原创文章,转载请注明出处。