首页 新闻 会员 周边

java图形界面排版问题

0
悬赏园豆:50 [待解决问题]

一张图片,图片右边写文字,这些文字又分为5行,每行一条信息。

以下是我的代码,总得不到我上述的结果。

 1 public class View {
 2     public void showview(){
 3         JFrame frame=new JFrame("图片+文字");
 4         
 5         BorderLayout borderLayout=new BorderLayout();
 6         frame.setLayout(borderLayout);
 7         
 8         JPanel panelwest=new JPanel();
 9         ImageIcon ic = new ImageIcon("G://student/a.jpg");         
10         JLabel label=new JLabel();          
11         label.setIcon(ic);    
12         panelwest.setLayout(new FlowLayout(FlowLayout.LEFT));
13         panelwest.add(label);
14         
15         JPanel paneleast=new JPanel();
16         
17         frame.setLayout(new GridLayout(5,1));
18         
19         JLabel systemName=new JLabel("名称   xxxxx系统");
20         JLabel classInf=new JLabel("班级   xxxx班");
21         JLabel idNumber=new JLabel("学号   xxxxxxx");
22         JLabel time=new JLabel("时间   xxxxxxx");
23         JLabel makerName=new JLabel("制作者 xx");
24         
25         
26         JPanel panelsystemname=new JPanel();
27         JPanel panelclassinf=new JPanel();
28         JPanel panelidnumber=new JPanel();
29         JPanel paneltime=new JPanel();
30         JPanel panelmakername=new JPanel();
31         panelsystemname.setLayout(new                 FlowLayout(FlowLayout.LEFT));
32         panelclassinf.setLayout(new FlowLayout(FlowLayout.LEFT));
33         panelidnumber.setLayout(new FlowLayout(FlowLayout.LEFT));
34         paneltime.setLayout(new FlowLayout(FlowLayout.LEFT));
35         panelmakername.setLayout(new FlowLayout(FlowLayout.LEFT));
36         panelsystemname.add(systemName);
37         panelclassinf.add(classInf);
38         panelidnumber.add(idNumber);
39         paneltime.add(time);
40         panelmakername.add(makerName);
41         
42         paneleast.add(panelsystemname);
43         paneleast.add(panelclassinf);
44         paneleast.add(panelidnumber);
45         paneleast.add(paneltime);
46         paneleast.add(panelmakername);
47         
48         frame.add(panelwest,BorderLayout.WEST);  
49         frame.add(paneleast,BorderLayout.EAST);
50         
51         
52         frame.setSize(500, 350);
53         frame.setLocation(400, 300);
54         frame.setResizable(false);
55         frame.setVisible(true); // 显示窗口
56     }
57 }
xutil的主页 xutil | 初学一级 | 园豆:152
提问于:2015-01-06 11:34
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册