Java 8 HeadlessException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 HeadlessException class.

This code example shows how to use the following methods:toString
    public void testConfiguring() throws Exception {
        try { 
            HTTPSamplerBase sampler = (HTTPSamplerBase) new HttpTestSampleGui().createTestElement();
            configure(sampler);
        } catch (HeadlessException e) {
            System.out.println("o.a.j.junit.JMeterTest Error running testConfiguring due to Headless mode, "+e.toString());
            log.warn("o.a.j.junit.JMeterTest Error running testConfiguring due to Headless mode, "+e.toString());
        } 
    } 
 
    private void configure(HTTPSamplerBase sampler) throws Exception {
        sampler.addArgument("arg1", "val1");
        ConfigTestElement config = (ConfigTestElement) new HttpDefaultsGui().createTestElement();
        ((Arguments) config.getProperty(HTTPSamplerBase.ARGUMENTS).getObjectValue()).addArgument(new HTTPArgument(
                "config1", "configValue")); 
        config.setRunningVersion(true);
        sampler.setRunningVersion(true);
        sampler.setRunningVersion(true);
        sampler.addTestElement(config);
        assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    return null; 
  } 
 
  public GraphicsDevice getDefaultScreenDevice()
  { 
    throw new HeadlessException();
  } 
 
  public GraphicsDevice[] getScreenDevices()
  { 
    throw new HeadlessException();
  } 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
	} 
	 
	private static void printGUIErrorMessage(HeadlessException e) {
		System.out.println("Could not execute command 'peer gui'.");
		System.out.print("Cause: ");
		System.out.println(e.getMessage());
	} 
 
	private static void saveProperties(ModuleContext context) throws FileNotFoundException, IOException {
		Properties properties = new Properties();
		properties.putAll(context.getProperties());
		properties.store(new FileOutputStream(PEERGUI_PROPERTIES), null);
	} 
	 
	 
 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 * @return Array of screen devices 
	 */ 
	@Override 
	public GraphicsDevice[] getScreenDevices() throws HeadlessException {
		if(isHeadless()){
			throw new HeadlessException();
		} 
		Framebuffer[] fbs = new Framebuffer[threads.size()];
		 
		for(int i = 0; i < fbs.length; i++){
			fbs[i] = threads.get(i).getScreen();
		} 
		 
		return fbs;
	} 
 
	/** 
	 * Returns the default screen device 
	 *  
	 * @return The default screen device 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 HeadlessException Methods: