JavaSE SWing仿Mac风格并实现百度搜索功能
来源:互联网 发布:卡拉ok软件 编辑:程序博客网 时间:2024/05/16 15:21
运行结果:
在文本框内输入内容:如"中国",并点击按钮,运行结果:
首先下载并导入quaqua.jar包
编写代码如下:
public class Quaua extends JFrame {/** * 实现百度搜索 * 仿Mac皮肤 */private static final long serialVersionUID = -1229432258732639368L;/** * @author lovemu */private JLabel label;private JTextField searchText;private JButton test;//搜索按钮public Quaua() {setDefaultLookAndFeelDecorated(true);try {UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");} catch (Exception e) {e.printStackTrace();}setSize(350,80);// 取消frame本身的框架setUndecorated(true);setTitle("lovemu");setFocusableWindowState(true);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JRootPane rp = getRootPane();rp.setWindowDecorationStyle(JRootPane.FRAME);setLayout(null);Container c=getContentPane();label=new JLabel("百度搜索:");searchText=new JTextField();test=new JButton("百度一下");c.add(label);c.add(searchText);c.add(test);label.setBounds(10,10,80,30);searchText.setBounds(90,10,120,30);test.setBounds(230,10,100,30);test.addActionListener(new Search());}public static void main(String[] args) {Quaua qu = new Quaua();qu.setVisible(true);}class Search implements ActionListener{@Overridepublic void actionPerformed(ActionEvent e) {Desktop desktop=Desktop.getDesktop();String value=searchText.getText();String url="http://www.baidu.com/s?wd="+value;if(Desktop.isDesktopSupported()&&desktop.isSupported(Desktop.Action.BROWSE)){ URI uri=URI.create(url); try{ desktop.browse(uri); }catch(IOException ee){ ee.printStackTrace(); }}}}}
- JavaSE SWing仿Mac风格并实现百度搜索功能
- java Swing模仿百度搜索功能的实现
- 使用Bootrap和Vue实现仿百度搜索功能
- 仿百度词条搜索功能代码
- 仿百度搜索下拉提示功能
- JAVA___jQuery+AJAX_仿百度搜索功能
- Swing学习----------实现仿QQ注册功能
- 用jq实现仿百度搜索框
- 仿百度搜索自动输入提示功能JQuery Autocomplete
- JS仿百度搜索自动提示框匹配查询功能
- 仿百度搜索框
- 仿百度搜索代码
- Vue 仿百度搜索
- 仿百度搜索
- JavaScript实现百度搜索suggestion功能
- jqueryui实现百度推荐搜索功能
- js/jQuery实现类似百度搜索功能
- 百度搜索框提示功能简单实现
- SQL Server 常用的语句
- 张孝祥java.concurrent线程并发学习笔记 - concurrent简介
- 如何控制一个action跳转到本页面的特定区域
- Lync 客户端组无法展开问题!
- GNU ARM汇编--(十七)u-boot的makefile和mkconfig解读
- JavaSE SWing仿Mac风格并实现百度搜索功能
- 封装分页
- 灰与白
- [多图]Windows Phone 8评测 系统改进幅度并不大
- 嵌入式GUI ftk-0.1发布 嵌入式GUI FTK 界面设计器 | 李先静的博客
- Java Swing图形化编程的初级介绍
- 练习_1
- 二叉树交换左右子树
- 利用baidu js api 做自驾路线