jigloo的使用

很久以前,其实也不是很久,也就两个月以前,应朋友所托,写了一个管理系统,采用的是java+mysql完成。
由于很久没用java写过界面了,一开始的版本其实特别难看,只能实现功能,这是完全不能给用户使用的。于是就在网上找相关的工具,最后发现一款插件挺好用的,jigloo
下面先说一下jigloo的安装方法
一种方法是直接解压,把features和plugins文件夹复制到eclipse下对应的文件夹下,重启eclipse
二是http://mmdev.iteye.com/blog/1807042,参考这个链接
配置完成后启动eclipse
应该会出现以下的界面
[img]http://dl2.iteye.com/upload/attachment/0091/9651/f06e923f-a16f-3d48-97ed-9bd52999aa57.jpg[/img]
然后就可以新建一个JFrame类
建完后界面如下
[img]http://dl2.iteye.com/upload/attachment/0091/9653/13af096e-393b-325b-9cd4-9d373a521c5e.jpg[/img]

将布局layout设置为AbsoluteLayout后,就可以在上面设置不同的组件了
注意下图的小黑色三角,点击后可以看到自动生成的代码,只需要在相应的位置加上对应的函数就可以了

[img]http://dl2.iteye.com/upload/attachment/0091/9657/adb10e1b-69ef-374e-b09b-d4c555230438.jpg[/img]

下面是一些图片
[img]http://dl2.iteye.com/upload/attachment/0091/9659/fc15c3ae-4b73-3ce2-8517-2f083cb95a6f.jpg[/img]

[img]http://dl2.iteye.com/upload/attachment/0091/9661/0f2c109f-8885-310b-b9fe-e7bab6a64a0a.jpg[/img]

[img]http://dl2.iteye.com/upload/attachment/0091/9663/ff672348-653e-3ad8-9e0e-854b654ea929.jpg[/img]

关于jigloo在附件中可以下载。程序打包时,推荐另外一个插件fat jarhttp://zzcjobstudy.iteye.com/admin/blogs/1965385。在这样的界面中插入背景的方法可以参见我的另一篇文章http://zzcjobstudy.iteye.com/admin/blogs/1961914
以及以下代码
public class MainFrame extends javax.swing.JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel label_background;
private Icon icon;
private JLabel label_title;
private JLabel label_history_check;
private JLabel label_basic_info;
private JLabel label_inte_any;
private JLabel label_out_record;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MainFrame inst = new MainFrame();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}

public MainFrame() {
super();
initGUI();
}

private void initGUI() {
try {
icon=new ImageIcon(getClass().getResource("/bg.jpg"));
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
{
label_title = new JLabel();
getContentPane().add(label_title);
label_title.setText("\u9152\u6c34\u7ba1\u7406\u7cfb\u7edf");
label_title.setBounds(176, 12, 190, 38);
label_title.setFont(new java.awt.Font("楷体",1,26));
}
{
label_inte_any = new JLabel();
label_inte_any.addMouseListener(new MouseAdapter() {

@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
super.mouseClicked(e);
new ExtenalAny().setVisible(true);
}

});
getContentPane().add(label_inte_any);
label_inte_any.setText("\u667a\u80fd\u5206\u6790");
label_inte_any.setBounds(215, 130, 72, 48);
label_inte_any.setFont(new java.awt.Font("楷体",3,16));
}

{
label_out_record = new JLabel();
label_out_record.addMouseListener(new MouseAdapter() {

@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
super.mouseClicked(e);
new OutRecord().setVisible(true);
}
});
getContentPane().add(label_out_record);
label_out_record.setText("\u51fa\u8d27\u7cfb\u7edf");
label_out_record.setBounds(79, 208, 73, 55);
label_out_record.setFont(new java.awt.Font("楷体",3,16));
}

{
label_basic_info = new JLabel();
label_basic_info.addMouseListener(new MouseAdapter() {

@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
super.mouseClicked(e);
new BasicInfo().setVisible(true);

}
});
getContentPane().add(label_basic_info);
label_basic_info.setBounds(52, 89, 82, 53);
}
{
label_history_check = new JLabel();
label_history_check.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
new HistoryCheck().setVisible(true);
}
});

getContentPane().add(label_history_check);
label_history_check.setBounds(215, 244, 82, 55);
}
{
label_background = new JLabel(icon);
label_background.setOpaque(true);
getContentPane().add(label_background);
label_background.setBounds(0, -12, 539, 417);
}//设置背景图片的,这个一定要放在最后,要不会把其他控件掩盖

pack();
this.setSize(555, 399);
} catch (Exception e) {
//add your error handling code here
e.printStackTrace();
}
}

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值