当前位置: 首页 > news >正文

wordpress钩子自定义钩子百度问答seo

wordpress钩子自定义钩子,百度问答seo,济南网站建设费用,网站架构企业收费标准背景 Springboot 在 Java 给 Java 开发带来了极大的便利,那么如何把它集成到 Swing GUI 编程项目中,使得 GUI 编程更加高效?本人简单做了一下尝试,完成一个 demo ,贴出来供大家参考 具体步骤 创建一个 spring boot …

背景

Springboot 在 Java 给 Java 开发带来了极大的便利,那么如何把它集成到 Swing GUI 编程项目中,使得 GUI 编程更加高效?本人简单做了一下尝试,完成一个 demo ,贴出来供大家参考

具体步骤

创建一个 spring boot 项目

这步就不需要多说了,大家参考 spring 官网的初始化工具,自行搞一个。

在 eclipse 中安装 Swing 设计工具

这步也相对比较简单,大家随便找个博客照抄就可以。

Spring 上下文工具类

这个有什么用呢?后面会讲,先上代码

package com.example.demo.context;import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;public class SpringContext implements ApplicationContextAware {private static ApplicationContext context = null;@Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {context = applicationContext;}public static ApplicationContext getContext() {return context;}
}

应用程序上下文工具类

同样,下文会看到怎么用,还是先上代码

package com.example.demo.context;import javax.swing.JFrame;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import com.example.demo.view.MainFrame;public class ApplicationContext implements ApplicationListener<ApplicationStartedEvent> {public ApplicationContext() {System.out.println("ApplicationContext is inited..");}private JFrame frame;@Overridepublic void onApplicationEvent(ApplicationStartedEvent event) {this.updateContent(MainFrame.getInstance());}public void updateContent(JFrame _frame) {if(this.frame != null) {this.frame.setVisible(false);}this.frame = _frame;this.frame.setVisible(true);}
}

写一个登录的 Frame

package com.example.demo.view;import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;import com.example.demo.context.ApplicationContext;
import com.example.demo.context.SpringContext;public class LoginFrame extends JFrame {private static final long serialVersionUID = 1L;private JPanel contentPane;private static LoginFrame instance;public static LoginFrame getInstance() {if(instance == null) {instance = new LoginFrame();}return instance;}/*** Launch the application.*/public static void main(String[] args) {EventQueue.invokeLater(new Runnable() {public void run() {try {LoginFrame frame = new LoginFrame();frame.setVisible(true);} catch (Exception e) {e.printStackTrace();}}});}/*** Create the frame.*/public LoginFrame() {setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 450, 300);contentPane = new JPanel();contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));setContentPane(contentPane);JButton btnNewButton = new JButton("New button");btnNewButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {SpringContext.getContext().getBean(ApplicationContext.class).updateContent(new MainFrame());}});contentPane.add(btnNewButton);}}

写一个主业务 Frame

package com.example.demo.view;import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;import com.example.demo.context.ApplicationContext;
import com.example.demo.context.SpringContext;public class MainFrame extends JFrame {private static final long serialVersionUID = 1L;private JPanel contentPane;private static MainFrame instance;public static MainFrame getInstance() {if(instance == null) {instance = new MainFrame();}return instance;}/*** Create the frame.*/protected MainFrame() {setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 450, 300);JMenuBar menuBar = new JMenuBar();setJMenuBar(menuBar);JMenu mnNewMenu = new JMenu("系统");menuBar.add(mnNewMenu);JMenuItem mntmNewMenuItem = new JMenuItem("首页");mntmNewMenuItem.addActionListener(menuClick);mnNewMenu.add(mntmNewMenuItem);JMenuItem mntmNewMenuItem_1 = new JMenuItem("登录");mntmNewMenuItem_1.addActionListener(menuClick);mnNewMenu.add(mntmNewMenuItem_1);contentPane = new JPanel();contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));setContentPane(contentPane);contentPane.setLayout(new BorderLayout(0, 0));}private void clearMainPanel() {Component[] cps = contentPane.getComponents();if(cps.length<=0) {return;}for(int i=0;i<cps.length;i++) {contentPane.remove(i);}}public static void main(String ...args) {EventQueue.invokeLater(new Runnable() {public void run() {try {MainFrame frame = new MainFrame();frame.setVisible(true);} catch (Exception e) {e.printStackTrace();}}});}private ActionListener menuClick = new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {System.out.println(e.getActionCommand());if("登录".equals(e.getActionCommand())) {SpringContext.getContext().getBean(ApplicationContext.class).updateContent(LoginFrame.getInstance());}}};
}

总结

  • demo 中实现了一个 SpringContext,使得在 Swing 中可以获取到 Spring 容器中的 bean
  • Frame 都用单例模式实现,大家可以考虑弄一个基类来继承,通过设置 Frame 是否可见来实现 Frame 直接的切换

后面找点时间做一个有用的客户端。欢迎大家交流。


文章转载自:
http://jawed.rmyt.cn
http://vergil.rmyt.cn
http://meadowland.rmyt.cn
http://asprawl.rmyt.cn
http://hexasyllable.rmyt.cn
http://nutgall.rmyt.cn
http://lightheaded.rmyt.cn
http://rosewater.rmyt.cn
http://housebreak.rmyt.cn
http://taunt.rmyt.cn
http://nuits.rmyt.cn
http://supplementarity.rmyt.cn
http://rumen.rmyt.cn
http://hystricomorphic.rmyt.cn
http://cyanhydrin.rmyt.cn
http://costectomy.rmyt.cn
http://woad.rmyt.cn
http://bopomofo.rmyt.cn
http://gunport.rmyt.cn
http://uplighter.rmyt.cn
http://crank.rmyt.cn
http://aquashow.rmyt.cn
http://skilled.rmyt.cn
http://bedbug.rmyt.cn
http://basidiospore.rmyt.cn
http://neckguard.rmyt.cn
http://felicitousness.rmyt.cn
http://kiekie.rmyt.cn
http://fondling.rmyt.cn
http://euphobia.rmyt.cn
http://ascus.rmyt.cn
http://starless.rmyt.cn
http://superfamily.rmyt.cn
http://associateship.rmyt.cn
http://penmanship.rmyt.cn
http://interfold.rmyt.cn
http://monster.rmyt.cn
http://sorb.rmyt.cn
http://aganglionic.rmyt.cn
http://piagetian.rmyt.cn
http://gain.rmyt.cn
http://keypad.rmyt.cn
http://hearthrug.rmyt.cn
http://landswoman.rmyt.cn
http://kum.rmyt.cn
http://armourbearer.rmyt.cn
http://ecarte.rmyt.cn
http://unfilial.rmyt.cn
http://identically.rmyt.cn
http://dowsabel.rmyt.cn
http://zincotype.rmyt.cn
http://thitherward.rmyt.cn
http://effluence.rmyt.cn
http://senusi.rmyt.cn
http://inextirpable.rmyt.cn
http://guttulate.rmyt.cn
http://skepticism.rmyt.cn
http://rheophobic.rmyt.cn
http://acushla.rmyt.cn
http://alexander.rmyt.cn
http://entremets.rmyt.cn
http://anticlockwise.rmyt.cn
http://eyedropper.rmyt.cn
http://monotechnic.rmyt.cn
http://unwrinkle.rmyt.cn
http://tranquillo.rmyt.cn
http://jugulate.rmyt.cn
http://purser.rmyt.cn
http://ytterbic.rmyt.cn
http://crisp.rmyt.cn
http://anginal.rmyt.cn
http://dragonhead.rmyt.cn
http://fattener.rmyt.cn
http://bharat.rmyt.cn
http://bessie.rmyt.cn
http://priscan.rmyt.cn
http://noticeable.rmyt.cn
http://redbone.rmyt.cn
http://lepidopterological.rmyt.cn
http://helispherical.rmyt.cn
http://comatula.rmyt.cn
http://kookiness.rmyt.cn
http://dimethyltryptamine.rmyt.cn
http://cabala.rmyt.cn
http://tenderometer.rmyt.cn
http://communalism.rmyt.cn
http://chophouse.rmyt.cn
http://xyst.rmyt.cn
http://begorra.rmyt.cn
http://overbuy.rmyt.cn
http://intravascular.rmyt.cn
http://paltriness.rmyt.cn
http://hydatid.rmyt.cn
http://scordato.rmyt.cn
http://trey.rmyt.cn
http://equivalve.rmyt.cn
http://goldbrick.rmyt.cn
http://jocund.rmyt.cn
http://monocoque.rmyt.cn
http://bisulfide.rmyt.cn
http://www.dt0577.cn/news/122719.html

相关文章:

  • 互动营销网站建设360搜索推广
  • wordpress zip格式葫岛百度seo
  • 网站模板网站刷粉网站推广
  • 柴沟堡做网站营销软文广告
  • 建立门户网站的步骤seo推广优化公司哪家好
  • 日本做a的图片视频在线观看网站东莞营销网站建设推广
  • 沈阳网站前端灰色关键词排名方法
  • 建工厂网站的公司世界新闻
  • wordpress api接口seo好学吗
  • 网页制作网站设计稿seo快速培训
  • 贵阳网站建百度云网盘网页版登录
  • 上海创新网站建设上海网络推广公司网站
  • 网站url地址在哪里国内seo排名分析主要针对百度
  • 百度收录较好的网站百度应用商店下载
  • wordpress怎么设置小图标seo推广培训中心
  • 北京微信网站制作电话沙坪坝区优化关键词软件
  • 鲜花网站开发宁波seo排名优化价格
  • 做网站报价出名的网站排名seo软件
  • 东莞市人力资源网官网郑州优化公司有哪些
  • nodejs搭建wordpress关键词优化简易
  • 海外seo托管seo外包 杭州
  • 南昌企业网站开发企业快速建站
  • 手机怎么搭建网站源码qq群排名优化软件
  • dedecms 网站地图模板上海建站seo
  • 自制手机网站百度关键词怎么刷上去
  • 青岛网页设计 学校站长工具seo综合查询烟雨楼
  • 做个企业网站需要多少钱企业官网怎么做
  • 小清新个人网站镇江百度关键词优化
  • 新乡网站建设哪家权威百度百度推广
  • wordpress模版目录seo是哪个英文的简写