Topic: 怎么在JToolBar上加那些小图标?

  Print this page

1.怎么在JToolBar上加那些小图标? Copy to clipboard
Posted by: MichaelWolf
Posted on: 2005-11-18 17:12

怎么在JToolBar上加那些小图标?看了很多文章说就是JButton,但怎么我加上去的跟别的软件的ToolBar上的不一样呢?

还有我用JFileChooser打开一个文件选择窗口,窗口里显示的字体超级难看,怎么搞也搞不定,这是什么原因?怎么解决?

2.Re:怎么在JToolBar上加那些小图标? [Re: MichaelWolf] Copy to clipboard
Posted by: nicholastse0303
Posted on: 2005-11-20 16:24

JToolBar toolBar = new JToolBar("");
add(toolBar, BorderLayout.PAGE_START);

ImageIcon newf = new ImageIcon("D:/new.jpg");
button1=new JButton(newf);
toolBar.add(button1);
button1.addActionListener(this);

ImageIcon open = new ImageIcon("D:/open.jpg");
button2=new JButton(open);
toolBar.add(button2);
button2.addActionListener(this);

ImageIcon save = new ImageIcon("D:/save.jpg");
button3=new JButton(save);
toolBar.add(button3);
button3.addActionListener(this);

ImageIcon del = new ImageIcon("D:/del.jpg");
button4=new JButton(del);
toolBar.add(button4);
button4.addActionListener(this);

ImageIcon word = new ImageIcon("D:/word.jpg");
button5=new JButton(word);
toolBar.add(button5);
button5.addActionListener(this);

ImageIcon color = new ImageIcon("D:/color.jpg");
button6=new JButton(color);
toolBar.add(button6);
button6.addActionListener(this);

ImageIcon print = new ImageIcon("D:/print.jpg");
button7=new JButton(print);
toolBar.add(button7);
button7.addActionListener(this);

ImageIcon help = new ImageIcon("D:/help.jpg");
button8=new JButton(help);
toolBar.add(button8);
button8.addActionListener(this);

ImageIcon adp = new ImageIcon("D:/adp.jpg");
button9=new JButton(adp);
toolBar.add(button9);
button9.addActionListener(this);


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923