16.libgdx根据配置文件生成布局(未完)-程序员宅基地

技术标签: java  ui  

思路:

  screen分为普通和复杂两种,普通的功能大部分是页面跳转以及简单的crud数据,复杂的单独弄出来

  跳转普通的screen,直接根据配置文件调整设置

<layouts>
    <loyout screenId="0" bg="bg_start" name="start" defaultWinId="" bgm="" remark="">
    </loyout>
    <loyout screenId="1" bg="bg_main" name="main" defaultWinId="0" bgm="" remark="">
        <window id="0" scale="1.0" bg="" x="0" y="0" w="0" h="0" float="center" >
            <buttons >
                <button  x="50" y="30" w="0" h="0"   imgUpName="mbtn_empire"  imgDownName="mbtn_empire"  functionId="0" font="" remark="帝国"></button>
                <button  x="300" y="30" w="0" h="0"  imgUpName="mbtn_conquest"  imgDownName="mbtn_conquest"  functionId="1" font="" remark="征服"></button>
                <button  x="550" y="30" w="0" h="0"  imgUpName="mbtn_commder"  imgDownName="mbtn_commder"  functionId="2" font="" remark="指挥官"></button>
                <button  x="800" y="30" w="0" h="0"  imgUpName="mbtn_option"  imgDownName="mbtn_option"  functionId="3" font="" remark="设置"></button>
                <button  x="300" y="120" w="0" h="0"  imgUpName="mbtn_map"  imgDownName="mbtn_map"  functionId="4" font="" remark="地图"></button>
            </buttons>
        </window>
    </loyout>
</layouts>
package com.zhfy.game.screen;

import java.util.ArrayList;
import java.util.List;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.zhfy.game.MainGame;
import com.zhfy.game.config.ResConfig;
import com.zhfy.game.framework.GameFramework;
import com.zhfy.game.framework.GameLayout;
import com.zhfy.game.framework.GameUtil;
import com.zhfy.game.model.framework.TextureRegionListDAO;
import com.zhfy.game.screen.actor.base.BaseActor;

/**
 * 主游戏场景(游戏主界面), 实现 Screen 接口 或者 继承 ScreenAdapter 类 <br/>
 * 这里就展示一张图片代表游戏主界面
 */
public class MainScreen extends ScreenAdapter {
    
    private MainGame game;
    private EmpireScreen empireScreen;
    

    private Texture manTexture;

    private List<Stage> stages;
    private Stage stage;

    private BaseActor manActor;
    private TextureRegionListDAO imgLists;
    
    private TextureRegionListDAO imgUpList;
    
    private TextureRegionListDAO imgDownList;
    
    private ImageButton button;
    //使用场景
    private int screenId=1;
    //uiRoot
    private Element uiR;
    //ui
    private List<Element> ui;
    private XmlReader reader ;
    private String bgTexture;
    private float tempX,tempY,tempW,tempH;
    Array<Element> buttonEs;
    //private GameFramework framework;
    
    public MainScreen(MainGame mainGame)  {
        //获取传参
        this.game=mainGame;
        // 创建背景纹理, 图片 bg_main.png
        
        

        reader = ResConfig.reader;
        uiR=GameLayout.getXmlERootByScreenId(screenId);
        ui=GameUtil.getXmlEByRootE(uiR);
        manTexture = GameUtil.getBgTextureByStr(uiR.get("bg"),mainGame.getAssetManager());
        //stages=new ArrayList<Stage>();
        
        //获取对应图片
        imgLists=GameUtil.getTextureReigonByScreenId( screenId,mainGame.getAssetManager());
        // 创建游戏人物演员
        manActor = new BaseActor(new TextureRegion(manTexture));
        
        
        for  (Element window:ui) {
            tempX=window.getInt("x");tempY=window.getInt("y");tempW=window.getInt("w");tempH=window.getInt("h");
            stage = new Stage(new StretchViewport(tempW==0?mainGame.getWorldWidth():tempW,tempH==0?mainGame.getWorldHeight():tempH));
            
            
            // 添加演员到舞台
            stage.addActor(manActor);
            imgUpList=new TextureRegionListDAO();
            imgDownList=new TextureRegionListDAO();
            //遍历window的buttons按钮
            buttonEs = window.getChildByName("buttons").getChildrenByNameRecursively("button");  // 递归遍历,否则的话返回null
            for (Element buttonE : buttonEs) {
               //Gdx.app.log("ui测试", button.get("remark"));
                imgUpList.add(imgLists.getTextureByName(buttonE.get("imgUpName")));
                imgDownList.add(imgLists.getTextureByName(buttonE.get("imgDownName")));
               
                button = new ImageButton(new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()));
                button.setSize(buttonE.getInt("w")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth():buttonE.getInt("w"), buttonE.getInt("h")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight():buttonE.getInt("h"));
                button.setPosition(buttonE.getInt("x"),buttonE.getInt("y"));
                function(buttonE.getInt("functionId"));
                stage.addActor(button);
                Gdx.input.setInputProcessor(stage);
                
            }
        }
        
        
        
        
        /*// 使用伸展视口创建舞台
        
        // 将输入处理设置到舞台(必须设置, 否则点击按钮没效果)
        Gdx.input.setInputProcessor(stage);
        
        
        {
            //设定按钮
            for(int i=0;i<imgUpList.size();i++) {
                button = new ImageButton(new TextureRegionDrawable(new TextureRegion(imgUpList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())));
                button.setSize(imgUpList.get(i).getTextureRegion().getRegionWidth(), imgUpList.get(i).getTextureRegion().getRegionHeight());
                button.setPosition(imgUpList.get(i).getRefx(),imgUpList.get(i).getRefy());
               
                //把按钮监听放到function(i)里了;
                function(i);
                stage.addActor(button);
            }
        }
        //测试框架
        //framework.getStagesByScreenId(screenId);
        
        //文字示例
        Label label=new Label("124563987258,12456382236874,123654236",new LabelStyle(new BitmapFont(), null));
        label.setWidth(100);//设置每行的宽度
        label.setWrap(true);//开启换行
        stage.addActor(label);*/
    }

    @Override
    public void render(float delta) {
        // 红色清屏
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // 更新舞台逻辑
        stage.act();
        // 绘制舞台
        stage.draw();
    }

    public void dispose() {
        super.dispose();
        // 场景被销毁时释放资源
        /*if (manTexture != null) {
            manTexture.dispose();
        }*/
        if (stage != null) {
            stage.dispose();
        }
    }
    
    //实现的功能
    public void function(int i){
        switch(i) {
            case 0://跳转到帝国页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //Gdx.app.log("点击了第1个按钮", "x:" + x+" y:" + y);
                        game.showGameScreen(screenId,3);
                    }
                });
                break;
            case 1://跳转到征服页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,4);
                    }
                });
                break;
            case 2://跳转到指挥官页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,5);
                    }
                });
                break;
            case 3://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,6);
                    }
                });
                break;
            case 4://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            default:
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        Gdx.app.log("点击了其他按钮", "x:" + x+" y:" + y);
                    }
                });
                break;
        }
        
        
        
    }
    

}
通用场景

 

构想中首先根据screenId获得其布局背景图,布局默认stage编号,背景音乐等信息,

然后一个window代表一个stage,buttons下加载其按钮配置 

随后还设想加入Lable(文本标签)和Image(图片标签),并且x,y,w,h等都会变为百分比计算距离,根据float来确定位置(靠左,靠右,居中),根据bgm切换音乐

实现多窗口(多stage),动态加载内容等功能

此篇将随着后续对ui的完善持续更新

6.22更新:

所有坐标按百分比读取,绘制点为图片中心点,如果超边界,会顶边而不超出去

package com.zhfy.game.screen;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.zhfy.game.MainGame;
import com.zhfy.game.config.ResConfig;
import com.zhfy.game.framework.GameFramework;
import com.zhfy.game.framework.GameLayout;
import com.zhfy.game.framework.GameUtil;
import com.zhfy.game.model.framework.TextureRegionListDAO;
import com.zhfy.game.screen.abandon.EmpireScreen;
import com.zhfy.game.screen.actor.base.BaseActor;

/**
 * 主游戏场景(游戏主界面), 实现 Screen 接口 或者 继承 ScreenAdapter 类 <br/>
 * 这里就展示一张图片代表游戏主界面
 */
public class GeneralScreen extends ScreenAdapter {
    
    private MainGame game;
    

    private Texture manTexture;
    
    private Image bgImage;

    private List<Stage> stages;
    private Stage stage;

    private TextureRegionListDAO imgLists;
    
    private TextureRegionListDAO imgUpList;
    
    private TextureRegionListDAO imgDownList;
    
    private ImageButton button;
    //使用场景
    private int screenId=-1;
    //uiRoot
    private Element uiR;
    //ui
    private List<Element> ui;
    private XmlReader reader ;
    private String bgTexture;
    private float tempX,tempY,tempW,tempH;
    Array<Element> buttonEs;
    private Map tempMap;
    private int i;//function的计数标志,从1开始
    //private GameFramework framework;
    
    public GeneralScreen(MainGame mainGame,int screenId)  {
        //获取传参
        this.game=mainGame;
        // 创建背景纹理, 图片 bg_main.png
        
        this.screenId=screenId;
        reader = ResConfig.reader;
        uiR=GameLayout.getXmlERootByScreenId(screenId);
        ui=GameUtil.getXmlEByRootE(uiR);
        manTexture = GameUtil.getBgTextureByStr(uiR.get("bg"),mainGame.getAssetManager());
        //stages=new ArrayList<Stage>();
        
        //获取对应图片
        imgLists=GameUtil.getTextureReigonByScreenId( screenId,mainGame.getAssetManager());
        // 创建游戏人物演员
        bgImage= new Image(manTexture);
        bgImage.setSize(mainGame.getWorldWidth(), mainGame.getWorldHeight());
        
        i=1;
        for  (Element window:ui) {
            tempX=window.getInt("x");tempY=window.getInt("y");tempW=window.getInt("w");tempH=window.getInt("h");
            stage = new Stage(new StretchViewport(tempW==0?mainGame.getWorldWidth():tempW,tempH==0?mainGame.getWorldHeight():tempH));
            
            
            // 添加演员到舞台
            stage.addActor(bgImage);
            imgUpList=new TextureRegionListDAO();
            imgDownList=new TextureRegionListDAO();
            //遍历window的buttons按钮
            buttonEs = window.getChildByName("buttons").getChildrenByNameRecursively("button");  // 递归遍历,否则的话返回null
            for (Element buttonE : buttonEs) {
               //Gdx.app.log("ui测试", button.get("remark"));
                imgUpList.add(imgLists.getTextureByName(buttonE.get("imgUpName")));
                imgDownList.add(imgLists.getTextureByName(buttonE.get("imgDownName")));
               
                button = new ImageButton(new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()),new TextureRegionDrawable(imgLists.getTextureByName(buttonE.get("imgDownName")).getTextureRegion()));
                button.setSize(buttonE.getInt("w")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth():buttonE.getInt("w")*imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionWidth()/100, buttonE.getInt("h")==0?imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight():buttonE.getInt("h")*imgLists.getTextureByName(buttonE.get("imgUpName")).getTextureRegion().getRegionHeight()/100);
                button.setPosition(
                        buttonE.getInt("x")*stage.getWidth()/100+button.getWidth()/2>stage.getWidth()?stage.getWidth()-button.getWidth():buttonE.getInt("x")*stage.getWidth()/100-button.getWidth()/2<0?0:buttonE.getInt("x")*stage.getWidth()/100-button.getWidth()/2,
                        buttonE.getInt("y")*stage.getHeight()/100+button.getHeight()/2>stage.getHeight()?stage.getHeight()-button.getHeight():buttonE.getInt("y")*stage.getHeight()/100-button.getHeight()/2<0?0:buttonE.getInt("y")*stage.getHeight()/100-button.getHeight()/2);
                tempMap=new HashMap();
                tempMap.put("FUNCTION_ID", buttonE.get("functionId"));
                tempMap.put("ID", i);
                /*switch(screenId) {
                    //一些特殊的数据 暂时废弃
                    case 7:
                    break;
                }*/
                i++;       
                function(tempMap);
                stage.addActor(button);
                Gdx.input.setInputProcessor(stage);
                
            }
        }
        
        
        
        
        /*// 使用伸展视口创建舞台
        
        // 将输入处理设置到舞台(必须设置, 否则点击按钮没效果)
        Gdx.input.setInputProcessor(stage);
        
        
        {
            //设定按钮
            for(int i=0;i<imgUpList.size();i++) {
                button = new ImageButton(new TextureRegionDrawable(new TextureRegion(imgUpList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())),new TextureRegionDrawable(new TextureRegion(imgDownList.get(i).getTextureRegion())));
                button.setSize(imgUpList.get(i).getTextureRegion().getRegionWidth(), imgUpList.get(i).getTextureRegion().getRegionHeight());
                button.setPosition(imgUpList.get(i).getRefx(),imgUpList.get(i).getRefy());
               
                //把按钮监听放到function(i)里了;
                function(i);
                stage.addActor(button);
            }
        }
        //测试框架
        //framework.getStagesByScreenId(screenId);
        
        //文字示例
        Label label=new Label("124563987258,12456382236874,123654236",new LabelStyle(new BitmapFont(), null));
        label.setWidth(100);//设置每行的宽度
        label.setWrap(true);//开启换行
        stage.addActor(label);*/
    }

    @Override
    public void render(float delta) {
        // 红色清屏
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // 更新舞台逻辑
        stage.act();
        // 绘制舞台
        stage.draw();
    }

    public void dispose() {
        super.dispose();
        // 场景被销毁时释放资源
        /*if (manTexture != null) {
            manTexture.dispose();
        }*/
        if (stage != null) {
            stage.dispose();
        }
    }
    
    //实现的功能
    /*
    0:帝国/战役
    1:征服
    2:指挥官
    3:设置
    4:地图
    5:返回主页
    6:地图跳入(i)
    7:跳入详细地图
    8:
    9:
    10:
    11:
    12:
     */
            
    public void function(Map map){
        int i=Integer.parseInt(map.get("FUNCTION_ID").toString());
        switch(i) {
            case 0://跳转到帝国页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //Gdx.app.log("点击了第1个按钮", "x:" + x+" y:" + y);
                        game.showGameScreen(screenId,3);
                    }
                });
                break;
            case 1://跳转到征服页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,4);
                    }
                });
                break;
            case 2://跳转到指挥官页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,5);
                    }
                });
                break;
            case 3://跳转到设置页面
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.showGameScreen(screenId,6);
                    }
                });
                break;
            case 4://跳转到设置地图
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            case 5://返回
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,1);
                    }
                });
                break;
            case 6://地图跳入
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        //game.showGameScreen(6);
                        game.showGameScreen(screenId,7);
                    }
                });
                break;
            case 7://地图编辑
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.setMapId(Integer.parseInt(map.get("ID").toString()));
                        game.showGameScreen(screenId,71);
                    }
                });
                break;
            case 8://跳入征服    
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        game.setStageId(Integer.parseInt(map.get("ID").toString()));
                        game.showGameScreen(screenId,81);
                    }
                });
                break;
                
                
            default:
                button.addListener(new ClickListener() {
                    public void clicked(InputEvent event, float x, float y) {
                        Gdx.app.log("点击了其他按钮", "x:" + x+" y:" + y);
                    }
                });
                break;
        }
        
        
        
    }
    

}
所有坐标按百分比读取

 

转载于:https://www.cnblogs.com/tysk/p/10995508.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_30764137/article/details/99412019

智能推荐

彻底扒光 通过智能路由器拆解看其本质-程序员宅基地

文章浏览阅读1.7k次。可以看到很多联发科的MT芯片摘自:https://net.zol.com.cn/531/5312999.html彻底扒光 通过智能路由器拆解看其本质2015-07-23 00:40:00[中关村在线 原创] 作者:陈赫|责编:白宁收藏文章 分享到 评论(24)关注智能路由器拆解的朋友们注意啦!我们已经将这五款产品彻底扒开,将主板的真容展现在了大家的眼前。网友们可以看见这些智能路由器主板的做工和用料,我们还为网友们展示了主要的电子元器件,供大家品评观赏。..._路由器拆解

Java--深入JDK和hotspot底层源码剖析Thread的run()、start()方法执行过程_jdk的源码hotspot跟jdk是分开的-程序员宅基地

文章浏览阅读2.1k次,点赞101次,收藏78次。【学习背景】今天主要是来了解Java线程Thread中的run()、start()两个方法的执行有哪些区别,会给出一个简单的测试代码样例,快速理解两者的区别,再从源码层面去追溯start()底层是如何最终调用Thread#run()方法的,个人觉得这样的学习不论对面试,还是实际编程来说都是比较有帮助的。进入正文~学习目录一、代码测试二、源码分析2.1 run()方法2.2 start()方法三、使用总结一、代码测试执行Thread的run()、start()方法的测试代码如下:public_jdk的源码hotspot跟jdk是分开的

透视俄乌网络战之一:数据擦除软件_俄乌网络战观察(一)-程序员宅基地

文章浏览阅读4.4k次,点赞90次,收藏85次。俄乌冲突中,各方势力通过数据擦除恶意软件破坏关键信息基础设施计算机的数据,达到深度致瘫的效果,同时窃取重要敏感信息。_俄乌网络战观察(一)

Maven私服仓库配置-Nexus详解_nexus maven-程序员宅基地

文章浏览阅读1.7w次,点赞23次,收藏139次。Maven 私服是一种特殊的Maven远程仓库,它是架设在局域网内的仓库服务,用来代理位于外部的远程仓库(中央仓库、其他远程公共仓库)。当然也并不是说私服只能建立在局域网,也有很多公司会直接把私服部署到公网,具体还是得看公司业务的性质是否是保密的等等,因为局域网的话只能在公司用,部署到公网的话员工在家里也可以办公使用。_nexus maven

基于AI的计算机视觉识别在Java项目中的使用 (四) —— 准备训练数据_java ocr ai识别训练-程序员宅基地

文章浏览阅读934次。我先用所有的样本数据对模型做几轮初步训练,让深度神经模型基本拟合(数万条记录的训练集,识别率到99%左右),具备初步的识别能力,这时的模型就是“直男”。相较于训练很多轮、拟合程度很高的“油腻男”,它的拟合程度较低,还是“直男愣头青”。..............._java ocr ai识别训练

hibernate 数据库类型 date没有时分秒解决_hibernate解析時間只有年月日沒有時分秒-程序员宅基地

文章浏览阅读688次。一、问题现象:  在数据库表中日期字段中存的日期光有年月日,没有时分秒。二、产生原因:三 解决办法   检查表的相应映射xml文件。 <property name="operateDate" type="Date">如果同上面所写,那问题出在 type类型上了正确写法 :<property name="operateDate" type="java.util..._hibernate解析時間只有年月日沒有時分秒

随便推点

springbbot运行无法编译成功,找不到jar包报错:Error:(3, 46) java: 程序包org.springframework.context.annotation不存在-程序员宅基地

文章浏览阅读1k次,点赞2次,收藏2次。文章目录问题描述:解决方案:问题描述:提示:idea springbbot运行无法编译成功,找不到jar包报错E:\ideaProject\demokkkk\src\main\java\com\example\demo\config\WebSocketConfig.javaError:(3, 46) java: 程序包org.springframework.context.annotation不存在Error:(4, 46) java: 程序包org.springframework.conte_error:(3, 46) java: 程序包org.springframework.context.annotation不存在

react常见面试题_recate面试-程序员宅基地

文章浏览阅读6.4k次,点赞6次,收藏36次。1、redux中间件中间件提供第三方插件的模式,自定义拦截 action -&gt; reducer 的过程。变为 action -&gt; middlewares -&gt; reducer 。这种机制可以让我们改变数据流,实现如异步 action ,action 过滤,日志输出,异常报告等功能。常见的中间件:redux-logger:提供日志输出redux-thunk:处理异步操作..._recate面试

交叉编译jpeglib遇到的问题-程序员宅基地

文章浏览阅读405次。由于要在开发板中加载libjpeg,不能使用gcc编译的库文件给以使用,需要自己配置使用另外的编译器编译该库文件。/usr/bin/ld:.libs/jaricom.o:RelocationsingenericELF(EM:40)/usr/bin/ld:.libs/jaricom.o:RelocationsingenericELF(EM:40)...._jpeg_utils.lo: relocations in generic elf (em: 8) error adding symbols: file

【办公类-22-06】周计划系列(1)“信息窗” (2024年调整版本)-程序员宅基地

文章浏览阅读578次,点赞10次,收藏17次。【办公类-22-06】周计划系列(1)“信息窗” (2024年调整版本)

SEO优化_百度seo resetful-程序员宅基地

文章浏览阅读309次。SEO全称为Search Engine Optimization,中文解释为搜索引擎优化。一般指通过对网站内部调整优化及站外优化,使网站满足搜索引擎收录排名需求,在搜索引擎中提高关键词排名,从而把精准..._百度seo resetful

回归预测 | Matlab实现HPO-ELM猎食者算法优化极限学习机的数据回归预测_猎食者优化算法-程序员宅基地

文章浏览阅读438次。回归预测 | Matlab实现HPO-ELM猎食者算法优化极限学习机的数据回归预测_猎食者优化算法