org.lwjgl.Sys Java Examples

The following examples show how to use org.lwjgl.Sys. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LwjglSmoothingTimer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void reset() {
    lastFrameDiff = 0;
    lastFPS = 0;
    lastTPF = 0;

    // init to -1 to indicate this is a new timer.
    oldTime = -1;
    //reset time
    startTime = Sys.getTime();

    tpf = new long[TIMER_SMOOTHNESS];
    smoothIndex = TIMER_SMOOTHNESS - 1;
    invTimerRezSmooth = ( 1f / (LWJGL_TIMER_RES * TIMER_SMOOTHNESS));

    // set tpf... -1 values will not be used for calculating the average in update()
    for ( int i = tpf.length; --i >= 0; ) {
        tpf[i] = -1;
    }
}
 
Example #2
Source File: LwjglSmoothingTimer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void reset() {
    lastFrameDiff = 0;
    lastFPS = 0;
    lastTPF = 0;

    // init to -1 to indicate this is a new timer.
    oldTime = -1;
    //reset time
    startTime = Sys.getTime();

    tpf = new long[TIMER_SMOOTHNESS];
    smoothIndex = TIMER_SMOOTHNESS - 1;
    invTimerRezSmooth = ( 1f / (LWJGL_TIMER_RES * TIMER_SMOOTHNESS));

    // set tpf... -1 values will not be used for calculating the average in update()
    for ( int i = tpf.length; --i >= 0; ) {
        tpf[i] = -1;
    }
}
 
Example #3
Source File: FEMultiplayer.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Disconnect from game. 
 * Allows for resetting server and client if triggered, but is not used in all situations.
 *
 * @param message the message
 */
public static void disconnectGame(String message){
	/*
	//wouldn't be hard to use something like this to reset to lobby rather than quit the game:
	//at the moment this disconnect is only in a few places between stages, i.e. while waiting
	//so it's not too bad to quit the game.
	Player leaver = null;
	for(Player p : session.getPlayers()) {
		if(p.getID() == message.origin) {
			leaver = p;
		}
	}
	session.removePlayer(leaver);
	System.out.println(leaver.getName()+" LEFT THE GAME");
	 * */
	if(FEServer.getServer() != null) {
		//boot the server back to lobby
		FEServer.resetToLobbyAndKickPlayers();
	}else{
		//exit the client
		if(message!=null && !message.equals("")){
			Sys.alert("FE:MP", message);
		}
		System.exit(0);
	}
}
 
Example #4
Source File: LwjglRasteriser.java    From tectonicus with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void printInfo()
{
	System.out.println(" -- Lwjgl Rasteriser -- ");
	System.out.println("\tLWJGL version: " + Sys.getVersion());
	System.out.println("\ttype: "+type);
	System.out.println("\twidth: "+width);
	System.out.println("\theigth: "+height);
	System.out.println("\tpBuffer: "+pbuffer);
	
	System.out.println("\tOpenGL Vendor: "+GL11.glGetString(GL11.GL_VENDOR));
	System.out.println("\tOpenGL Renderer: "+GL11.glGetString(GL11.GL_RENDERER));
	System.out.println("\tOpenGL Version: "+GL11.glGetString(GL11.GL_VERSION));
	
//	System.out.println();
	
//	GL11.glGetString(GL11.GL_EXTENSIONS);
}
 
Example #5
Source File: LwjglAbstractDisplay.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void run(){
    if (listener == null) {
        throw new IllegalStateException("SystemListener is not set on context!"
                                      + "Must set with JmeContext.setSystemListener().");
    }

    loadNatives();
    logger.log(Level.FINE, "Using LWJGL {0}", Sys.getVersion());
    if (!initInThread()) {
        logger.log(Level.SEVERE, "Display initialization failed. Cannot continue.");
        return;
    }
    while (true){
        if (renderable.get()){
            if (Display.isCloseRequested())
                listener.requestClose(false);

            if (wasActive != Display.isActive()) {
                if (!wasActive) {
                    listener.gainFocus();
                    timer.reset();
                    wasActive = true;
                } else {
                    listener.loseFocus();
                    wasActive = false;
                }
            }
        }

        runLoop();

        if (needClose.get())
            break;
    }
    deinitInThread();
}
 
Example #6
Source File: LwjglAbstractDisplay.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void run(){
    if (listener == null)
        throw new IllegalStateException("SystemListener is not set on context!"
                                      + "Must set with JmeContext.setSystemListner().");

    logger.log(Level.INFO, "Using LWJGL {0}", Sys.getVersion());
    initInThread();
    while (true){
        if (renderable.get()){
            if (Display.isCloseRequested())
                listener.requestClose(false);

            if (wasActive != Display.isActive()) {
                if (!wasActive) {
                    listener.gainFocus();
                    timer.reset();
                    wasActive = true;
                } else {
                    listener.loseFocus();
                    wasActive = false;
                }
            }
        }

        runLoop();

        if (needClose.get())
            break;
    }
    deinitInThread();
}
 
Example #7
Source File: GitHubApiHelper.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
/** Beware: there is no timeout for browser GitHub authorization and in case user closed/left
 * authorization page without completing whole process, there will be no feedback in {@link CreateIssueResultHandler}. */
public void createIssue(final String title, final String body, final CreateIssueResultHandler resultHandler) {
    if (!checkApiKey()) {
        resultHandler.onError(new IllegalStateException("GitHub API key is invalid."));
        return;
    }

    authCallbackHandler.setListener(new AuthCallbackHandler.Listener() {
        @Override
        public void onAuthCodeReceived(String authCode) {
            authCallbackHandler.setListener(null);
            try {
                String contentJson = json.toJson(new CreateIssueBody(title, body));

                OAuth2AccessToken accessToken = apiService.getAccessToken(authCode);

                OAuthRequest request = new OAuthRequest(Verb.POST, "https://api.github.com/repos/"+GITHUB_OWNER+"/"+GITHUB_REPO+"/issues");
                request.setPayload(contentJson);
                apiService.signRequest(accessToken, request);
                Response response = apiService.execute(request);

                if (response.getCode() != 201) {
                    resultHandler.onError(new IllegalStateException("GitHub returned bad code: " +
                            response.getCode() + "\n" +
                            response.getMessage() + "\n" +
                            response.getBody()));
                } else {
                    JsonValue jsonRoot = new JsonReader().parse(response.getBody());
                    String issueUrl = jsonRoot.getString("html_url");
                    resultHandler.onSuccess(issueUrl);
                }
            } catch (IOException | InterruptedException | ExecutionException | OAuthException e) {
                e.printStackTrace();
                resultHandler.onError(e);
            }
        }
    });
    Sys.openURL(apiService.getAuthorizationUrl());
}
 
Example #8
Source File: LwjglOffscreenBuffer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void run(){
    logger.log(Level.INFO, "Using LWJGL {0}", Sys.getVersion());
    initInThread();
    while (!needClose.get()){
        runLoop();
    }
    deinitInThread();
}
 
Example #9
Source File: LwjglContext.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void printContextInitInfo() {
    logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n"
            + " * Graphics Adapter: {2}\n"
            + " * Driver Version: {3}\n"
            + " * Scaling Factor: {4}",
            new Object[]{Sys.getVersion(), Thread.currentThread().getName(),
                Display.getAdapter(), Display.getVersion(),
                Display.getPixelScaleFactor()});
}
 
Example #10
Source File: Main.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public final static void fail(Throwable t) {
	try {
		t.printStackTrace();
		if (Display.isCreated())
			Display.destroy();
		while (t.getCause() != null)
			t = t.getCause();
		ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());
		String error = Utils.getBundleString(bundle, "error");
		String error_msg = Utils.getBundleString(bundle, "error_message", new Object[]{t.toString(), Globals.SUPPORT_ADDRESS});
		Sys.alert(error, error_msg);
	} finally {
		shutdown();
	}
}
 
Example #11
Source File: LwjglOffscreenBuffer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void run(){
    loadNatives();
    logger.log(Level.FINE, "Using LWJGL {0}", Sys.getVersion());
    initInThread();
    while (!needClose.get()){
        runLoop();
    }
    deinitInThread();
}
 
Example #12
Source File: LwjglTimer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see Timer#getTime() 
 */
@Override
public long getTime() {
    return Sys.getTime() - startTime;
}
 
Example #13
Source File: LwjglSmoothingTimer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see Timer#getTime() 
 */
@Override
public long getTime() {
    return Sys.getTime() - startTime;
}
 
Example #14
Source File: SoundStore.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Get the Sound based on a specified OGG file
 * 
 * @param ref The reference to the OGG file in the classpath
 * @param in The stream to the OGG to load
 * @return The Sound read from the OGG file
 * @throws IOException Indicates a failure to load the OGG
 */
public Audio getOgg(String ref, InputStream in) throws IOException {
	if (!soundWorks) {
		return new NullAudio();
	}
	if (!inited) {
		throw new RuntimeException("Can't load sounds until SoundStore is init(). Use the container init() method.");
	}
	if (deferred) {
		return new DeferredSound(ref, in, DeferredSound.OGG);
	}
	
	int buffer = -1;
	
	if (loaded.get(ref) != null) {
		buffer = ((Integer) loaded.get(ref)).intValue();
	} else {
		try {
			IntBuffer buf = BufferUtils.createIntBuffer(1);
			
			OggDecoder decoder = new OggDecoder();
			OggData ogg = decoder.getData(in);
			
			AL10.alGenBuffers(buf);
			AL10.alBufferData(buf.get(0), ogg.channels > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16, ogg.data, ogg.rate);
			
			loaded.put(ref,new Integer(buf.get(0)));
			                     
			buffer = buf.get(0);
		} catch (Exception e) {
			Log.error(e);
			Sys.alert("Error","Failed to load: "+ref+" - "+e.getMessage());
			throw new IOException("Unable to load: "+ref);
		}
	}
	
	if (buffer == -1) {
		throw new IOException("Unable to load: "+ref);
	}
	
	return new AudioImpl(this, buffer);
}
 
Example #15
Source File: SoundStore.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Get the Sound based on a specified OGG file
 * 
 * @param ref The reference to the OGG file in the classpath
 * @param in The stream to the OGG to load
 * @return The Sound read from the OGG file
 * @throws IOException Indicates a failure to load the OGG
 */
public Audio getOgg(String ref, InputStream in) throws IOException {
	if (!soundWorks) {
		return new NullAudio();
	}
	if (!inited) {
		throw new RuntimeException("Can't load sounds until SoundStore is init(). Use the container init() method.");
	}
	if (deferred) {
		return new DeferredSound(ref, in, DeferredSound.OGG);
	}
	
	int buffer = -1;
	
	if (loaded.get(ref) != null) {
		buffer = ((Integer) loaded.get(ref)).intValue();
	} else {
		try {
			IntBuffer buf = BufferUtils.createIntBuffer(1);
			
			OggDecoder decoder = new OggDecoder();
			OggData ogg = decoder.getData(in);
			
			AL10.alGenBuffers(buf);
			AL10.alBufferData(buf.get(0), ogg.channels > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16, ogg.data, ogg.rate);
			
			loaded.put(ref,new Integer(buf.get(0)));
			                     
			buffer = buf.get(0);
		} catch (Exception e) {
			Log.error(e);
			Sys.alert("Error","Failed to load: "+ref+" - "+e.getMessage());
			throw new IOException("Unable to load: "+ref);
		}
	}
	
	if (buffer == -1) {
		throw new IOException("Unable to load: "+ref);
	}
	
	return new AudioImpl(this, buffer);
}
 
Example #16
Source File: TextField.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see org.newdawn.slick.gui.AbstractComponent#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
	if (hasFocus()) {
		if (key != -1)
		{
			if ((key == Input.KEY_V) && 
			   ((input.isKeyDown(Input.KEY_LCONTROL)) || (input.isKeyDown(Input.KEY_RCONTROL)))) {
				String text = Sys.getClipboard();
				if (text != null) {
					doPaste(text);
				}
				return;
			}
			if ((key == Input.KEY_Z) && 
			   ((input.isKeyDown(Input.KEY_LCONTROL)) || (input.isKeyDown(Input.KEY_RCONTROL)))) {
				if (oldText != null) {
					doUndo(oldCursorPos, oldText);
				}
				return;
			}
			
			// alt and control keys don't come through here
			if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) {
				return;
			}
			if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) {
				return;
			}
		}
		
		if (lastKey != key) {
			lastKey = key;
			repeatTimer = System.currentTimeMillis() + INITIAL_KEY_REPEAT_INTERVAL;
		} else {
			repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
		}
		lastChar = c;
		
		if (key == Input.KEY_LEFT) {
			if (cursorPos > 0) {
				cursorPos--;
			}
			// Nobody more will be notified
			if (consume) {
				container.getInput().consumeEvent();
			}
		} else if (key == Input.KEY_RIGHT) {
			if (cursorPos < value.length()) {
				cursorPos++;
			}
			// Nobody more will be notified
			if (consume) {
				container.getInput().consumeEvent();
			}
		} else if (key == Input.KEY_BACK) {
			if ((cursorPos > 0) && (value.length() > 0)) {
				if (cursorPos < value.length()) {
					value = value.substring(0, cursorPos - 1)
							+ value.substring(cursorPos);
				} else {
					value = value.substring(0, cursorPos - 1);
				}
				cursorPos--;
			}
			// Nobody more will be notified
			if (consume) {
				container.getInput().consumeEvent();
			}
		} else if (key == Input.KEY_DELETE) {
			if (value.length() > cursorPos) {
				value = value.substring(0,cursorPos) + value.substring(cursorPos+1);
			}
			// Nobody more will be notified
			if (consume) {
				container.getInput().consumeEvent();
			}
		} else if ((c < 127) && (c > 31) && (value.length() < maxCharacter)) {
			if (cursorPos < value.length()) {
				value = value.substring(0, cursorPos) + c
						+ value.substring(cursorPos);
			} else {
				value = value.substring(0, cursorPos) + c;
			}
			cursorPos++;
			// Nobody more will be notified
			if (consume) {
				container.getInput().consumeEvent();
			}
		} else if (key == Input.KEY_RETURN) {
			notifyListeners();
			// Nobody more will be notified
			if (consume) {
				container.getInput().consumeEvent();
			}
		}

	}
}
 
Example #17
Source File: LwjglKeyInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public long getInputTimeNanos() {
    return Sys.getTime() * LwjglTimer.LWJGL_TIME_TO_NANOS;
}
 
Example #18
Source File: LwjglMouseInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public long getInputTimeNanos() {
    return Sys.getTime() * LwjglTimer.LWJGL_TIME_TO_NANOS;
}
 
Example #19
Source File: LwjglSmoothingTimer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * @see com.jme.util.Timer#getTime()
 */
public long getTime() {
    return Sys.getTime() - startTime;
}
 
Example #20
Source File: LwjglSmoothingTimer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * <code>update</code> recalulates the frame rate based on the previous
 * call to update. It is assumed that update is called each frame.
 */
public void update() {
    long newTime = Sys.getTime();
    long oldTime = this.oldTime;
    this.oldTime = newTime;
    if ( oldTime == -1 ) {
        // For the first frame use 60 fps. This value will not be counted in further averages.
        // This is done so initialization code between creating the timer and the first
        // frame is not counted as a single frame on it's own.
        lastTPF = 1 / 60f;
        lastFPS = 1f / lastTPF;
        return;
    }

    long frameDiff = newTime - oldTime;
    long lastFrameDiff = this.lastFrameDiff;
    if ( lastFrameDiff > 0 && frameDiff > lastFrameDiff *100 ) {
        frameDiff = lastFrameDiff *100;
    }
    this.lastFrameDiff = frameDiff;
    tpf[smoothIndex] = frameDiff;
    smoothIndex--;
    if ( smoothIndex < 0 ) {
        smoothIndex = tpf.length - 1;
    }

    lastTPF = 0.0f;
    if (!allSmooth) {
        int smoothCount = 0;
        for ( int i = tpf.length; --i >= 0; ) {
            if ( tpf[i] != -1 ) {
                lastTPF += tpf[i];
                smoothCount++;
            }
        }
        if (smoothCount == tpf.length)
            allSmooth  = true;
        lastTPF *= ( INV_LWJGL_TIMER_RES / smoothCount );
    } else {
        for ( int i = tpf.length; --i >= 0; ) {
            if ( tpf[i] != -1 ) {
                lastTPF += tpf[i];
            }
        }
        lastTPF *= invTimerRezSmooth;
    }
    if ( lastTPF < FastMath.FLT_EPSILON ) {
        lastTPF = FastMath.FLT_EPSILON;
    }

    lastFPS = 1f / lastTPF;
}
 
Example #21
Source File: LwjglTimer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void reset() {
    startTime = Sys.getTime();
    oldTime = getTime();
}
 
Example #22
Source File: LwjglTimer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * @see com.jme.util.Timer#getTime()
 */
public long getTime() {
    return Sys.getTime() - startTime;
}
 
Example #23
Source File: BuyButton.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
public final void mouseClicked(int button, int x, int y, int clicks) {
	Renderer.shutdown();
	Sys.openURL(Settings.getSettings().buy_url);
}
 
Example #24
Source File: MixinMinecraft.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
public long getTime() {
    return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
 
Example #25
Source File: DisplayManager.java    From OpenGL-Animation with The Unlicense 4 votes vote down vote up
private static long getCurrentTime() {
	return Sys.getTime() * 1000 / Sys.getTimerResolution();
}
 
Example #26
Source File: SoundStore.java    From opsu-dance with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Get the Sound based on a specified OGG file
 * 
 * @param ref The reference to the OGG file in the classpath
 * @param in The stream to the OGG to load
 * @return The Sound read from the OGG file
 * @throws IOException Indicates a failure to load the OGG
 */
public Audio getOgg(String ref, InputStream in) throws IOException {
	if (!soundWorks) {
		return new NullAudio();
	}
	if (!inited) {
		throw new RuntimeException("Can't load sounds until SoundStore is init(). Use the container init() method.");
	}
	if (deferred) {
		return new DeferredSound(ref, in, DeferredSound.OGG);
	}
	
	int buffer = -1;
	
	if (loaded.get(ref) != null) {
		buffer = ((Integer) loaded.get(ref)).intValue();
	} else {
		try {
			IntBuffer buf = BufferUtils.createIntBuffer(1);
			
			OggDecoder decoder = new OggDecoder();
			OggData ogg = decoder.getData(in);
			
			AL10.alGenBuffers(buf);
			AL10.alBufferData(buf.get(0), ogg.channels > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16, ogg.data, ogg.rate);
			
			loaded.put(ref,new Integer(buf.get(0)));
			                     
			buffer = buf.get(0);
		} catch (Exception e) {
			Log.error(e);
			Sys.alert("Error","Failed to load: "+ref+" - "+e.getMessage());
			throw new IOException("Unable to load: "+ref);
		}
	}
	
	if (buffer == -1) {
		throw new IOException("Unable to load: "+ref);
	}
	
	return new AudioImpl(this, buffer);
}
 
Example #27
Source File: TextField.java    From opsu-dance with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void keyPressed(KeyEvent e)
{
	e.consume();

	if (e.keyCode == KEY_V && input.isControlDown()) {
		String text = Sys.getClipboard();
		if (text != null) {
			value += text;
			this.setMaxLength(this.maxCharacters);
		}
		return;
	}

	switch (e.keyCode) {
	case KEY_BACK:
		final int len = value.length();
		if (len == 0) {
			break;
		}
		if (!input.isControlDown() || len == 1) {
			value = value.substring(0, len - 1);
			return;
		}
		int lastindex = len - 2;
		while (true) {
			if (Character.isWhitespace(value.charAt(lastindex))) {
				while (lastindex > 0 &&
					Character.isWhitespace(value.charAt(lastindex - 1)))
				{
					lastindex--;
				}
				value = value.substring(0, lastindex);
				break;
			}
			if (--lastindex <= 0) {
				value = "";
				break;
			}
		}
		break;
	default:
		if (e.chr > 31 && value.length() < maxCharacters) {
			value += e.chr;
		}
	}
}
 
Example #28
Source File: DisplayContainer.java    From opsu-dance with GNU General Public License v3.0 4 votes vote down vote up
public long getTime() {
	return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
 
Example #29
Source File: ErrorReportFrame.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
private void createGitHubIssue(String title, String comment, Throwable ex) {
    if (title.trim().length() < 8) {
        showErrorMessage("Title should be at least 8 characters long.");
        return;
    }

    // Extra recognition prefix.
    title = "[Report] " + title;

    try {
        // Try to read log file. If it doesn't exist, use just stacktrace.
        String logContent;
        if (AppConstants.logFile != null && AppConstants.logFile.exists()) {
            logContent = IOUtils.toString(new FileInputStream(AppConstants.logFile.toString()),
                    STRING_ENCODING).trim();
        } else {
            StringWriter stringWriter = new StringWriter();
            ex.printStackTrace(new PrintWriter(stringWriter));
            logContent = stringWriter.toString().trim();
        }

        InputStream templateInputStream = ErrorReportFrame.class.getClassLoader()
                .getResourceAsStream("github-error-report-template.md");
        String bodyTemplate = IOUtils.toString(templateInputStream, STRING_ENCODING);
        String body = comment + bodyTemplate.replace(PLACEHOLDER_LOG, logContent);

        gitHubApiHelper.createIssue(title, body, new GitHubApiHelper.CreateIssueResultHandler() {
            @Override
            public void onSuccess(String issueUrl) {
                // Navigate to a newly created issue and terminate application.
                Sys.openURL(issueUrl);
                ErrorReportFrame.this.dispose();
            }

            @Override
            public void onError(Exception exception) {
                // Truncate string with ellipsis.
                String message = exception.getMessage();
                if (message.length() > 128) {
                    message = message.substring(0, 128) + "...";
                }
                showErrorMessage(message);
            }
        });
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example #30
Source File: RegistrationForm.java    From tribaltrouble with GNU General Public License v2.0 4 votes vote down vote up
public final void mouseClicked(int button, int x, int y, int clicks) {
	String clipboard = (String)LocalEventQueue.getQueue().getDeterministic().log(Sys.getClipboard());
	if (clipboard != null)
		pasteClipboard(clipboard);
}