小编Sha*_*jee的帖子

具有时间轴的JavaFX实时LineChart

我正在尝试使用时间轴绘制实时图形,但我发现LineChart构造函数只有签名.

LineChart(Axis<X> xAxis, Axis<Y> yAxis)  
Run Code Online (Sandbox Code Playgroud)

我认为在javafx中嵌入jfree图表不是一个合适的解决方案.

我想在javafx中使用一些jfree功能LineChart,这可能吗?

java charts jfreechart javafx-2

11
推荐指数
1
解决办法
2万
查看次数

未捕获的ReferenceError:myFunction未定义为null:1 webview中的Android异常

我从一个活动调用javascript函数,但我收到Uncaught ReferenceError: myFunction is not defined at null:1错误.这是我的文件

MainActivity.java

package com.example.androidexample;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView webview = (WebView)this.findViewById(R.id.webView1);
        WebSettings webSettings = webview.getSettings();

        // Enable Javascript for interaction
        webSettings.setJavaScriptEnabled(true);

        // Make the zoom controls visible
        webSettings.setBuiltInZoomControls(true);

        // Allow for touching selecting/deselecting data series
        webview.requestFocusFromTouch();

        // Set the client
        webview.setWebViewClient(new WebViewClient()); …
Run Code Online (Sandbox Code Playgroud)

javascript android webview

9
推荐指数
1
解决办法
2万
查看次数

通过GSM调制解调器播放WAV文件

我想通过GSM调制解调器播放WAV文件.这是我的示例代码

private final int BUFFER_SIZE = 8;
private File soundFile;
private AudioInputStream audioStream;
private AudioFormat audioFormat;
public void playSound(String filename) throws IOException{

    String strFilename = filename;

    try {
        soundFile = new File(strFilename);
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }

    try {
        audioStream = AudioSystem.getAudioInputStream(soundFile);
    } catch (Exception e){
        e.printStackTrace();
        System.exit(1);
    }

    audioFormat = audioStream.getFormat();

    DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);

    int nBytesRead = 0;
    byte[] abData = new byte[BUFFER_SIZE];
    while (nBytesRead != -1) {
        try {
            nBytesRead = audioStream.read(abData); …
Run Code Online (Sandbox Code Playgroud)

java modem gsm serial-port

6
推荐指数
1
解决办法
1343
查看次数

使用framebuffer错误Cubieboard A10运行JavaFX应用程序

由于javafx支持Raspberry PI.我想在帧缓冲区中运行FX应用程序.我正在使用Lubuntu LCD显示图像.

当我尝试运行JavaFX应用程序时

java -Djavafx.platform=eglfb Hello.jar
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

我正在使用java8嵌入式hardfloat.

libEGL warning: DRI2: failed to authenticate
eglCreateWindowSurface failed! eglGetError 12291
eglMakeCurrent failed - 12288
Failed to create EGLContextGraphics Device initialization failed for :  es2
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
    at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:300)
    at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
    at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:179)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:214)
    at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:653)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:314)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: …
Run Code Online (Sandbox Code Playgroud)

java linux arm javafx-8

5
推荐指数
1
解决办法
2932
查看次数

数组结构铸造

我有这三种结构,

typedef struct serial_header {
    int zigbeeMsgType;
    int seqNumber;
    int commandIdentifier;
    int dest;
    int src;
}serial_header_t;


typedef struct serial_packet {
  serial_header_t header;
  int data[];
} serial_packet_t;
Run Code Online (Sandbox Code Playgroud)

最后一个是

typedef struct readAttributePacket
{
     int                     u8SourceEndPointId;
     int                     u8DestinationEndPointId;
     int                     u16ClusterId;
     int                     bDirectionIsServerToClient;
     int                     u8NumberOfAttributesInRequest;
     int                     bIsManufacturerSpecific;
     int                     u16ManufacturerCode;
     int                     pu16AttributeRequestList[];
}readAttributePacket_t;
Run Code Online (Sandbox Code Playgroud)

我对此代码感到不安,我只想将驻留在serial_packet_t中的data []数组转换为readAttributePacket_t结构.我认为数据[]应该是

data[]={0x01,0x01,0x04,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
Run Code Online (Sandbox Code Playgroud)

我需要将这些数据转换为readAttributePacket_t结构.但是这下面的代码显示错误.

void main()
{
int a[]=  {0x32,0x00,0x31,0x69,0x69,0x00,0x00,0x01,0x01,0x04,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
int i;
readAttributePacket_t *p;
serial_packet_t *data;

data = (serial_packet_t*)&a;

for(i=0;i<20;i++){
    printf(" %02x \n",a[i]);
}
p = (readAttributePacket_t *)&data->data;
printf("\nu8SourceEndPointId:%x \nu8DestinationEndPointId:%x \nu16ClusterId:%04x \nbDirectionIsServerToClient:%x …
Run Code Online (Sandbox Code Playgroud)

c arrays pointers structure

3
推荐指数
1
解决办法
6703
查看次数

使用 JDeveloper 构建 Java 整个项目 jar

我正在使用 JDeveloper 11g 开发桌面应用程序。我想制作可在java环境中运行的整个项目jar..如果我只使用标准Java库jar工作正常,但我的项目包含外部库,如JfreeChart、Comm、Hibernate3等...当我尝试制作jar时它显示错误如何使我的项目的整个 jar 以及外部库的。

谢谢

java jar jdeveloper executable-jar

2
推荐指数
1
解决办法
2万
查看次数

当端口存在时获取 javax.comm.NoSuchPortException

您好,我已经看到了为什么当端口存在时我会收到 Java NoSuchPortException?帖子,但对我来说不是很清楚!!

在设备管理器中,它显示 COM3 存在,我可以通过腻子连接它,但是这段代码出现了这个错误/异常。

try {
       portId = CommPortIdentifier.getPortIdentifier("COM3");
    } catch (NoSuchPortException ex) {
       System.out.println(ex);
    }

try {
     serialPort = (SerialPort)portId.open("S2CFrameWork", 5000);
    } catch (PortInUseException e) {
        System.out.println(e);
    }
Run Code Online (Sandbox Code Playgroud)

这个简单的代码抛出了一个 javax.comm.NoSuchPortException,我也尝试过使用枚举来获取可用端口列表,但它仍然显示异常。任何人都可以解决这个问题吗?

java serial-port

2
推荐指数
1
解决办法
1万
查看次数

添加回车将<CR>和CTRL-Z返回到java中的String

我正在使用java程序发送短信.

AT命令作为字符串提供.但字符串格式应该是这样的 AT+CMGS="+33146290800"<CR>Please call me soon.<ctrl-Z>.

我必须使用Carriage Return和CTRL-Z字符创建字符串.

如果我用字符串添加0x0D和0x1A.

输出:

AT+CMGS="+33146290800"13Please call me soon.26
Run Code Online (Sandbox Code Playgroud)

我怎样才能完成任务?任何人都可以帮我找到出路.

java

2
推荐指数
1
解决办法
3492
查看次数