我知道如何实现一个关键的监听器; 那不是问题.
public void keyTyped(KeyEvent event) {
if (event.getKeyChar() == KEY_LEFT) {
cTDirection = LEFT;
}
if (event.getKeyChar() == 40) {
cTDirection = DOWN;
}
if (event.getKeyChar() == 39) {
cTDirection = RIGHT;
}
if (event.getKeyChar() == 38) {
cTDirection = UP;
}
}
Run Code Online (Sandbox Code Playgroud)
我把什么放在LEFT_KEY
/ 40/39/38?当我创建一个keylistener并键入键时,我相信我得到了37 - 40.我不知道该放在那里只听箭头键.
似乎无法让错误消失.错误如下.我已经看过谷歌仍然无法搞清楚.这不像我是Cpp的新手,但有一段时间没有被它愚弄.
奇怪的是它在Windows中使用G ++ ...
错误:
main.cpp中
#include <iostream>
#include "Help.h"
using namespace std;
int main () {
Help h;
h.sayName();
// ***
// ***
// ***
return 0;
}
Run Code Online (Sandbox Code Playgroud)
Help.h
#ifndef HELP_H
#define HELP_H
class Help {
public:
Help();
~Help();
void sayName();
protected:
private:
}; …
Run Code Online (Sandbox Code Playgroud) 我有一个背景图像我用open gl 1.0 es绘图.
问题是,当我将这个小图像绘制到大屏幕时,我得到了这个......
模式中的线/断点不应该存在.我尝试了很多东西,我想也许我的地图册错了......怀疑它.我从(0,0,50,50)画出它,它是(x,y,宽度,高度).检查了很多,仍然得到相同的结果,它是应有的.
用我的for循环尝试了不同的东西,下面是......
GL10 gl = this.glGraphics.getGL();
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
guiCam.setViewportAndMatrices();
gl.glEnable(GL10.GL_TEXTURE_2D);
// Set background color //
batcher.beginBatch(Assets.mainmenuAtlas);
for(int x = Assets.mmbackgroundPattern.width / 2; x < this.scale.getWidth() + Assets.mmbackgroundPattern.width / 2; x += Assets.mmbackgroundPattern.width) {
for(int y = Assets.mmbackgroundPattern.height / 2; y < this.scale.getHeight() + Assets.mmbackgroundPattern.height / 2; y += Assets.mmbackgroundPattern.height) {
batcher.drawSprite(x, y, Assets.mmbackgroundPattern.width, Assets.mmbackgroundPattern.height, Assets.mmbackgroundPattern);
}
}
Run Code Online (Sandbox Code Playgroud)
视口和矩阵是:
public void setViewportAndMatrices() {
GL10 gl = glGraphics.getGL();
gl.glViewport(0, 0, glGraphics.getWidth(), glGraphics.getHeight());
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(position.x …
Run Code Online (Sandbox Code Playgroud) 我已经尝试了很多,但似乎无法让它发挥作用.
有人告诉我使用EDT以下例子.
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// Modify the GUI here
}
});
Run Code Online (Sandbox Code Playgroud)
我已经阅读了很多这个主题但仍然不明白.我得到的是一个线程,但.invokeLater对我来说仍然没有意义.老实说,如果你能详细解释一下这将是一个很大的帮助!
程序目标:获取随后每秒创建的随机生成的密钥,以便在GUI中自动更新.
您将如何打开.jar中的.xml文件并进行编辑?
我知道你可以做......
InputStream myStream = this.getClass().getResourceAsStream("xmlData.xml");
Run Code Online (Sandbox Code Playgroud)
但是,如何打开xmlData.xml,编辑文件并将其保存在.jar中?我会发现知道并且不想编辑.jar之外的文件很有用... 并且应用程序需要在整个时间内保持运行!
谢谢!
基本上我不知道该做什么......
我下载了JMF库并将库插入到项目中.它工作正常,直到我遇到这个问题.让我知道你的想法.谢谢!!!
泽夫
我的输出是"[B @ b42cbf"没有错误.
它应该是一个表示"服务器检查"的字符串.
如何修复我的代码以输出字符串而不是地址?
我打印对象的代码已经多次更改,但现在如下所示.
System.out.println(packet.getMessage().toString());
Run Code Online (Sandbox Code Playgroud)
我的包类如下.
import java.io.Serializable;
public class Packet implements Serializable {
final public short MESSAGE = 0;
final public short COMMAND = 1;
private String _ip;
private short _type;
private String _source;
private String _destination;
private byte[] _message;
public Packet(String ip, short type, String source, String destination,
byte[] message) {
this._ip = ip;
this._type = type;
this._source = source;
this._destination = destination;
this._message = message;
}
public String getIP() {
return this._ip;
}
public Short …
Run Code Online (Sandbox Code Playgroud) 我想知道人们如何在java中制作这些病态的GUI?
我知道如何制作标准蹩脚的背景,但就是这样.
基本上我所说的是看起来他们拍摄了Photoshop并设计了整个GUI,然后将其绘制到屏幕上,并在Photoshop中添加了按钮和内容.我该怎么做以及我在寻找什么?
当然我还想要相同的功能......哈哈.