设计字体显示效果 Font mf = new Font(String 字体,int 风格,int 字号);
字体:TimesRoman, Courier, Arial等
风格:三个常量 lFont.PLAIN, Font.BOLD, Font.ITALIC
字号:字的大小(磅数)
设置组件当前使用的字体:setFont(Font fn)
设置字体颜色:setForegrount(corlor)
获取组件当前使用的字体:getFont()
关闭窗口的时候释放窗口,而不是直接全部关闭:setDefualtCloseOperatetion(JFrame.DISPOSE_ON_CLOSE);
点击关闭后全部关闭窗口:JFrame.EXIT_ON_CLOSE;
setAligenment();设置上下居中;
setHorizonAligment();设置左右居中
mouseClicked(MouseEvent e) if(e.getClicked == 2)方法可以判断双击。
list list.getSeclectedValue();  获得选取值。

public class BackGroundSetting
{

    private JFrame frame = new JFrame("背景图片测试");
    
    private JPanel imagePanel ;
    
    private ImageIcon background;
    
    public static void main(String[] args)
    {
        new BackGroundSetting();
    }
    
    public BackGroundSetting()
    {
        BufferedImage image=null;
    image=ImageIO.read(new File("E:\\360Downloads\\loopwallpaper\\1.jpg"));
        background = new ImageIcon(image);//背景图片
        JLabel label = new JLabel(background);//把背景图片显示在一个标签里面
                             //     把标签的大小位置设置为图片刚好填充整个面板
        label.setBounds(0,0,background.getIconWidth(),background.getIconHeight());
                            //     把内容窗格转化为JPanel,否则不能用方法setOpaque()来使内容窗格透明       
  
        imagePanel.setOpaque(false);
      imagePanel = (JPanel)frame.getContentPane();
                               / /     内容窗格默认的布局管理器为BorderLayout
        imagePanel.setLayout(new FlowLayout());
        imagePanel.add(new JButton("测试按钮"));
        
        frame.getLayeredPane().setLayout(null);
                           //     把背景图片添加到分层窗格的最底层作为背景       
        frame.getLayeredPane().add(label,new Integer(Integer.MIN_VALUE));    
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(background.getIconWidth(),background.getIconHeight());
        
        frame.setVisible(true);
    }
}
this.jfMain.setBackground(Color.BLUE);
this.jfMain.getContentPane().setBackground(Color.white);
this.jfMain.getContentPane().setVisible(false);
给JFrame设置背景色。false则为蓝色,true则为白色。



.dispose():释放由此 Window、其子组件及其拥有的所有子组件所使用的所有本机屏幕资源。
即这些 Component 的资源将被破坏,它们使用的所有内存都将返回到操作系统,
并将它们标记为不可显示。
通过随后调用 pack 或 show 重新构造本机资源,可以再次显示 Window 及其子组件。
重新创建的 Window 及其子组件的状态与释放 Window 时这些对象的状态一致(
不考虑这些操作之间的其他更改)。

1、public:public表明该数据成员、成员函数是对所有用户开放的,所有用户都可以直接进行调用

     2、private:private表示私有,私有的意思就是除了class自己之外,任何人都不可以直接使用,私有财产神圣不可侵犯嘛,即便是子女,朋友,都不可以使用。

     3、protected:protected对于子女、朋友来说,就是public的,可以自由使用,没有任何限制,而对于其他的外部class,protected就变成private。

         作用域       当前类    同一package   子孙类     其他package
 
          public        √          √          √           √

          protected     √          √          √           ×

          private       √          ×          ×           ×


JInternalFrame的使用(窗口与面板)
5-1-1:JInternalFrame的使用
类层次结构图:

java.lang.Object
    --java.awt.Component
    --java.awt.Container
       --javax.swing.JComponent
             --javax.swing.JInternalFrame


JinternalFrame的使用跟JFrame几乎一样,可以最大化、最小化、关闭窗口、加入菜单等功能;唯一不同的是JinternalFrame是 lightweight component ,也就是说JInternalFrame不能单独出现,必须依附在最上层组件上。由于这个特色,JInternalFrame能 够利用java提供的Look and Feel功能作出完全不同于原有操作系统所提供的窗口外型,也比JFrame更具有弹性。

一般我们会将Internal Fram加入Desktop Pane方便管理,Desktop Pane是一种特殊的Layered pane,用来建立虚拟桌面(Vitual Desktop).它可以显示并管理众多Internal Frame之间的层次关系。以下是JDesktopPane的类层次结构图;

类层次结构图:

java.lang.Object
     --java.awt.Component
     --java.awt.Container
     --javax.swing.JComponent
     --javax.swing.JLayeredPane
     --javax.swing.JDesktop


我们先来看看如何构造JInternalFrame与JDesktopPane,再来看它跟Desktop Pane之间的关系。下面分别是JInternalFram与 JDesktopPane的构造函数:

JInternalFrame构造函数:

JInternalFrame():建立一个不能更改大小、不可关闭、不可最大最小化、也没有标题的Internal Frame。

JInternalFrame(String title):建立一个不能更改大小、不可关闭、不可最大最小化、但具有标题的Internal Frame。

JInternalFrame(String title,boolean resizable):建立一个不可关闭、不可最大最小化、但可变更大小且具有标题的 Internal Frame。

JInternalFrame(String title,boolean resizable,boolean closable):建立一个可关闭、可更改大小、且具有标题,但不可 最大化最小化的Internal Frame.

JInternalFrame(String title,boolean resizable,boolean closable,boolean maximizable):建立一个可关闭、可更改大小、 具有标题、可最大化,但不可最小化的Internal Frame.

JInternalFrame(String title,boolean resizable,boolean closable,boolean maximizable,boolean iconifiable): 建立一个可关闭、可更改大小、具有标题、可最大化与最小化的Internal Frame.

JDesktopPane构造函数:

JDesktopPane():建立JDesktopPane组件。

如何利用JDesktoPane来管理JInternalFrame:

xml文件是一种课扩展的标记语言。以标签开始以/标签结束。
xml文件中能够使用的标签是自由定义的,这个时候可能会导致某一个文件中标签混乱。
DocumentBuilderFactory xml文件创建者的工厂类,用于生产项目xml文件创建者类的对象。
DocunmentBuilder xml文件创建者类,用于生产xml文档解析类的对象。
Document xml文档解析类,用于解析和修改xml文件内容。
Element xml文档中一个标签元素
Node(interface) 节点接口 ,适用于任何可能的树状存储结构。


SQL对于数据库的操作:
增加 insert;删除 delete;修改 update;查询 select;
insert into 表名称(字段名1,字段名2,……)value (值1,值2……)
字段类型:数值,字符串,日期    字符串:'字符内容'

数据库操作的时候:
class.forName("com.mysql.jdbc.Driver");
DriverMannager.getconnectinon("URL","user","passward");
PrearedStatement 解析 ;
.close();
slect的使用方式;
1.select *from 表名称;得到所有的字段。
2.select 字段名1,字段名2…… from 表名称;
3.select 字段1,字段2,…… from 表名称 where 条件表达式。
4.select 字段2,字段2…… from 表名称 where 条件表达式 order by 字段1,字段2…… desc(降序排序)
5.select count(*) from 表名称 where 条件表达式。 计算查询出来的记录条数
update  更新标的数据
update 表名称 set 字段1 = 值1,字段2 = 值2, ……, where 条件表达式
delete 删除表的数据:
delete from 表名称 where 条件表达式。

联合查询的时候取的是多表的笛卡尔积。
1.01,02     2。03,04
笛卡尔积:取的字段是:01,03    01,04  02,03   02,04
实例:

select student_no,student_name,sex,student_info.department_code
department name from student_info,department_dict where 
student_info.department_code = department_dict.department_code
and student_name = '***'